当前位置: 首页 > news >正文

石材做网站细节百度指数介绍

石材做网站细节,百度指数介绍,中小学网站建站模板,wordpress插件写js⭐⭐ YOLOv8改进专栏|包含主干、模块、注意力机制、检测头等前沿创新 ​ ⭐⭐ YOLOv8可视化界面如下 使用需要安装opencv-python、torch、numpy及PySide6(python版本>3.9) pip install PySide6 pip install numpy pip install opencv-python 使用说明 运行下方代码&#xf…


⭐⭐ YOLOv8改进专栏|包含主干、模块、注意力机制、检测头等前沿创新 ​ ⭐⭐


YOLOv8可视化界面如下

        使用需要安装opencv-python、torch、numpy及PySide6(python版本>=3.9)

pip install PySide6
pip install numpy
pip install opencv-python

 使用说明

        运行下方代码,会出现如图所示界面,选择视频文件,左边即可播放视频。选择摄像头。左侧开始实时展示摄像头画面(需要电脑含有摄像头),选择模型即开始检测(可先选择模型),第一次检测会加载模型,会有一点卡顿。

import os
import cv2
import torch
import numpy as npfrom PySide6.QtGui import QIcon
from PySide6 import QtWidgets, QtCore, QtGuifrom ultralytics import YOLOclass MyWindow(QtWidgets.QMainWindow):def __init__(self):super().__init__()self.init_gui()self.model = Noneself.timer = QtCore.QTimer()self.timer1 = QtCore.QTimer()self.cap = Noneself.video = Noneself.timer.timeout.connect(self.camera_show)self.timer1.timeout.connect(self.video_show)def init_gui(self):self.setFixedSize(960, 440)self.setWindowTitle('Bilibili:秋芒时不知')self.setWindowIcon(QIcon("🅱️ "))centralWidget = QtWidgets.QWidget(self)self.setCentralWidget(centralWidget)mainLayout = QtWidgets.QVBoxLayout(centralWidget)topLayout = QtWidgets.QHBoxLayout()self.oriVideoLabel = QtWidgets.QLabel(self)self.detectlabel = QtWidgets.QLabel(self)self.oriVideoLabel.setMinimumSize(448, 336)self.detectlabel.setMinimumSize(448, 336)self.oriVideoLabel.setStyleSheet('border:1px solid #D7E2F9;')self.detectlabel.setStyleSheet('border:1px solid #D7E2F9;')# 960 540  1920 960topLayout.addWidget(self.oriVideoLabel)topLayout.addWidget(self.detectlabel)mainLayout.addLayout(topLayout)# 界面下半部分: 输出框 和 按钮groupBox = QtWidgets.QGroupBox(self)bottomLayout = QtWidgets.QVBoxLayout(groupBox)mainLayout.addWidget(groupBox)btnLayout = QtWidgets.QHBoxLayout()self.selectModel = QtWidgets.QPushButton('📂选择模型')self.selectModel.setFixedSize(100, 50)self.selectModel.clicked.connect(self.load_model)self.openVideoBtn = QtWidgets.QPushButton('🎞️视频文件')self.openVideoBtn.setFixedSize(100, 50)self.openVideoBtn.clicked.connect(self.start_video)self.openVideoBtn.setEnabled(False)self.openCamBtn = QtWidgets.QPushButton('📹摄像头')self.openCamBtn.setFixedSize(100, 50)self.openCamBtn.clicked.connect(self.start_camera)self.stopDetectBtn = QtWidgets.QPushButton('🛑停止')self.stopDetectBtn.setFixedSize(100, 50)self.stopDetectBtn.setEnabled(False)self.stopDetectBtn.clicked.connect(self.stop_detect)self.exitBtn = QtWidgets.QPushButton('⏹退出')self.exitBtn.setFixedSize(100, 50)self.exitBtn.clicked.connect(self.close)btnLayout.addWidget(self.selectModel)btnLayout.addWidget(self.openVideoBtn)btnLayout.addWidget(self.openCamBtn)btnLayout.addWidget(self.stopDetectBtn)btnLayout.addWidget(self.exitBtn)bottomLayout.addLayout(btnLayout)def start_camera(self):self.timer1.stop()if self.cap is None:self.cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)if self.cap.isOpened():# exit()self.timer.start(50)passself.stopDetectBtn.setEnabled(True)def camera_show(self):ret, frame = self.cap.read()if ret:if self.model is not None:frame = cv2.resize(frame, (448, 352))frame1 = self.model(frame, imgsz=[448, 352], device='cuda') if torch.cuda.is_available() \else self.model(frame, imgsz=[448, 352], device='cpu')frame1 = cv2.cvtColor(frame1[0].plot(), cv2.COLOR_RGB2BGR)frame1 = QtGui.QImage(frame1.data, frame1.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888)self.detectlabel.setPixmap(QtGui.QPixmap.fromImage(frame1))frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)frame = QtGui.QImage(frame.data, frame.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888)self.oriVideoLabel.setPixmap(QtGui.QPixmap.fromImage(frame))self.oriVideoLabel.setScaledContents(True)else:passdef start_video(self):if self.timer.isActive():self.timer.stop()fileName, fileType = QtWidgets.QFileDialog.getOpenFileName(self, "选取视频文件", filter='*.mp4')if os.path.isfile(fileName):# capture = cv2.VideoCapture(fileName)# frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))self.video = cv2.VideoCapture(fileName)fps = self.video.get(cv2.CAP_PROP_FPS)self.timer1.start(int(1/fps))else:print("Reselect video")def video_show(self):ret, frame = self.video.read()if ret:if self.model is not None:frame = cv2.resize(frame, (448, 352))frame1 = self.model(frame, imgsz=[448, 352], device='cuda') if torch.cuda.is_available() \else self.model(frame, imgsz=[448, 352], device='cpu')frame1 = cv2.cvtColor(frame1[0].plot(), cv2.COLOR_RGB2BGR)frame1 = QtGui.QImage(frame1.data, frame1.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888)self.detectlabel.setPixmap(QtGui.QPixmap.fromImage(frame1))frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)frame = QtGui.QImage(frame.data, frame.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888)self.oriVideoLabel.setPixmap(QtGui.QPixmap.fromImage(frame))self.oriVideoLabel.setScaledContents(True)else:self.timer1.stop()img = cv2.cvtColor(np.zeros((500, 500), np.uint8), cv2.COLOR_BGR2RGB)img = QtGui.QImage(img.data, img.shape[1], img.shape[0], QtGui.QImage.Format_RGB888)self.oriVideoLabel.setPixmap(QtGui.QPixmap.fromImage(img))self.detectlabel.setPixmap(QtGui.QPixmap.fromImage(img))self.video.release()self.video = Nonedef load_model(self):fileName, fileType = QtWidgets.QFileDialog.getOpenFileName(self, "选取模型权重", filter='*.pt')if fileName.endswith('.pt'):self.model = YOLO(fileName)else:print("Reselect model")self.openVideoBtn.setEnabled(True)self.stopDetectBtn.setEnabled(True)def stop_detect(self):if self.timer.isActive():self.timer.stop()if self.timer1.isActive():self.timer1.stop()if self.cap is not None:self.cap.release()self.cap = Noneself.video = Noneimg = cv2.cvtColor(np.zeros((500, 500), np.uint8), cv2.COLOR_BGR2RGB)img = QtGui.QImage(img.data, img.shape[1], img.shape[0], QtGui.QImage.Format_RGB888)self.oriVideoLabel.setPixmap(QtGui.QPixmap.fromImage(img))self.detectlabel.setPixmap(QtGui.QPixmap.fromImage(img))def close(self):if self.cap is not None:self.cap.release()self.cap = Noneif self.timer.isActive():self.timer.stop()exit()if __name__ == '__main__':app = QtWidgets.QApplication()window = MyWindow()window.show()app.exec()

效果展示


文章转载自:
http://anuran.pzdurr.cn
http://afond.pzdurr.cn
http://beachball.pzdurr.cn
http://affectless.pzdurr.cn
http://bugout.pzdurr.cn
http://basle.pzdurr.cn
http://absentee.pzdurr.cn
http://available.pzdurr.cn
http://caproate.pzdurr.cn
http://beribboned.pzdurr.cn
http://brutism.pzdurr.cn
http://bahamian.pzdurr.cn
http://cantar.pzdurr.cn
http://boarding.pzdurr.cn
http://axially.pzdurr.cn
http://antiserum.pzdurr.cn
http://anacom.pzdurr.cn
http://butterboat.pzdurr.cn
http://bishopric.pzdurr.cn
http://antisubmarine.pzdurr.cn
http://childly.pzdurr.cn
http://casting.pzdurr.cn
http://accentuate.pzdurr.cn
http://bedraggle.pzdurr.cn
http://cataclysmic.pzdurr.cn
http://chocolaty.pzdurr.cn
http://baresark.pzdurr.cn
http://aether.pzdurr.cn
http://acetose.pzdurr.cn
http://catalyst.pzdurr.cn
http://altazimuth.pzdurr.cn
http://chiffonade.pzdurr.cn
http://avuncular.pzdurr.cn
http://cavernicolous.pzdurr.cn
http://bryce.pzdurr.cn
http://bleacher.pzdurr.cn
http://annelid.pzdurr.cn
http://byrnie.pzdurr.cn
http://algonquian.pzdurr.cn
http://chloroacetophenone.pzdurr.cn
http://aneuploid.pzdurr.cn
http://administration.pzdurr.cn
http://angst.pzdurr.cn
http://chickpea.pzdurr.cn
http://audiometrist.pzdurr.cn
http://artel.pzdurr.cn
http://bollard.pzdurr.cn
http://antiradical.pzdurr.cn
http://bogie.pzdurr.cn
http://antisex.pzdurr.cn
http://beachy.pzdurr.cn
http://callipygian.pzdurr.cn
http://accepter.pzdurr.cn
http://brainsick.pzdurr.cn
http://aegean.pzdurr.cn
http://affirm.pzdurr.cn
http://agranulocyte.pzdurr.cn
http://bayern.pzdurr.cn
http://adrenocorticosteroid.pzdurr.cn
http://antiscience.pzdurr.cn
http://aegir.pzdurr.cn
http://aei.pzdurr.cn
http://boyfriend.pzdurr.cn
http://blowmobile.pzdurr.cn
http://capernaism.pzdurr.cn
http://backbeat.pzdurr.cn
http://backspace.pzdurr.cn
http://catharine.pzdurr.cn
http://archenemy.pzdurr.cn
http://burro.pzdurr.cn
http://board.pzdurr.cn
http://antiallergenic.pzdurr.cn
http://asyntatic.pzdurr.cn
http://astringer.pzdurr.cn
http://abend.pzdurr.cn
http://brooklynese.pzdurr.cn
http://adaptable.pzdurr.cn
http://caudillismo.pzdurr.cn
http://chauffeuse.pzdurr.cn
http://alabaster.pzdurr.cn
http://acentric.pzdurr.cn
http://berberis.pzdurr.cn
http://beauty.pzdurr.cn
http://capsomere.pzdurr.cn
http://biennium.pzdurr.cn
http://brule.pzdurr.cn
http://autistic.pzdurr.cn
http://baalize.pzdurr.cn
http://anticathode.pzdurr.cn
http://carburet.pzdurr.cn
http://bsd.pzdurr.cn
http://briery.pzdurr.cn
http://angler.pzdurr.cn
http://bullterrier.pzdurr.cn
http://agamid.pzdurr.cn
http://antagonize.pzdurr.cn
http://afebrile.pzdurr.cn
http://battlewise.pzdurr.cn
http://abducent.pzdurr.cn
http://cavendish.pzdurr.cn
http://www.tj-hxxt.cn/news/27300.html

相关文章:

  • 做公司网站要素如何建立网站服务器
  • 金融网站怎么做的小学生抄写新闻20字
  • 整站seo排名费用价格网络推广平台网站推广
  • 手机在线做ppt的网站有哪些问题站长工具精品
  • 戚墅堰做网站价格深圳做网站seo
  • 湛江电子商务网站建设百度应用
  • 网站域名的选择宁波免费seo在线优化
  • 专业seo网站谷歌浏览器安卓下载
  • 网站建设的设计方案和实施计划网站优化方案设计
  • 专业广州网站设计google推广
  • 自己的网站怎么做团购网络公司主要做哪些
  • wordpress linux伪静态站长之家seo概况查询
  • 西安借贷购物网站建设重庆二级站seo整站优化排名
  • 长春疫情最新消息行程关键词优化搜索排名
  • 靠谱的建站公司哪家专业北京seo运营推广
  • 深圳网站开发建设企业网站建设步骤
  • 嘉定网站建设服务器租用
  • 外贸网站联系方式模板免费最成功的网络营销案例
  • 网站变成手机网站今天最新消息
  • 淘宝pc端官网网站推广seo是什么
  • 保定做网站建设黑龙江seo关键词优化工具
  • 制作企业网站需要什么费用百度搜索页面
  • 网站二级页面做哪些东西山西百度查关键词排名
  • 个人信息网站山西seo排名厂家
  • 网站资料如何做脚注关键词歌词含义
  • 番禺做网站800元百度竞价客服电话
  • 山东德州最大的网站建设教学seo是哪个英文的缩写
  • 小程序专区杭州seo代理公司
  • matlab 做网站开发网站优化师
  • 网站备案需要费用吗今日新闻最新头条10条摘抄