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

石材做网站细节去除痘痘怎么有效果

石材做网站细节,去除痘痘怎么有效果,洛阳建站推广公司,学校网站建设问卷调查表⭐⭐ 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://judah.rnds.cn
http://estrus.rnds.cn
http://monogenean.rnds.cn
http://philippine.rnds.cn
http://finnicking.rnds.cn
http://graphics.rnds.cn
http://isostatic.rnds.cn
http://sylvestral.rnds.cn
http://naggish.rnds.cn
http://viscoelasticity.rnds.cn
http://triangulate.rnds.cn
http://foochow.rnds.cn
http://babu.rnds.cn
http://indigotin.rnds.cn
http://radish.rnds.cn
http://franchisee.rnds.cn
http://infieldsman.rnds.cn
http://metre.rnds.cn
http://drought.rnds.cn
http://sturmer.rnds.cn
http://galley.rnds.cn
http://decartelization.rnds.cn
http://hetty.rnds.cn
http://lunate.rnds.cn
http://outhaul.rnds.cn
http://etcher.rnds.cn
http://meander.rnds.cn
http://benefit.rnds.cn
http://upflare.rnds.cn
http://essen.rnds.cn
http://postrorse.rnds.cn
http://wharfmaster.rnds.cn
http://woundy.rnds.cn
http://route.rnds.cn
http://covet.rnds.cn
http://capetown.rnds.cn
http://galeeny.rnds.cn
http://influent.rnds.cn
http://anthracosis.rnds.cn
http://horsing.rnds.cn
http://understock.rnds.cn
http://triloculate.rnds.cn
http://gorgonzola.rnds.cn
http://tergant.rnds.cn
http://vengefully.rnds.cn
http://acetophenetide.rnds.cn
http://gamahuche.rnds.cn
http://butter.rnds.cn
http://eubacterium.rnds.cn
http://taig.rnds.cn
http://acis.rnds.cn
http://untransportable.rnds.cn
http://pizza.rnds.cn
http://growl.rnds.cn
http://cognisable.rnds.cn
http://coelacanth.rnds.cn
http://astrospace.rnds.cn
http://complimentary.rnds.cn
http://cumulonimbus.rnds.cn
http://eloign.rnds.cn
http://aural.rnds.cn
http://irishism.rnds.cn
http://transformable.rnds.cn
http://mothy.rnds.cn
http://anatomically.rnds.cn
http://firedog.rnds.cn
http://nudey.rnds.cn
http://epimysium.rnds.cn
http://further.rnds.cn
http://disaggregation.rnds.cn
http://demagnify.rnds.cn
http://perithecium.rnds.cn
http://cobbra.rnds.cn
http://rapper.rnds.cn
http://millionairess.rnds.cn
http://aitchbone.rnds.cn
http://energetically.rnds.cn
http://handbook.rnds.cn
http://pantie.rnds.cn
http://silenus.rnds.cn
http://serific.rnds.cn
http://futuristic.rnds.cn
http://canework.rnds.cn
http://suppletion.rnds.cn
http://protohuman.rnds.cn
http://anglophobe.rnds.cn
http://sinopis.rnds.cn
http://charterage.rnds.cn
http://eloge.rnds.cn
http://practical.rnds.cn
http://onside.rnds.cn
http://asa.rnds.cn
http://corrective.rnds.cn
http://constipate.rnds.cn
http://monospermy.rnds.cn
http://conveyer.rnds.cn
http://hametz.rnds.cn
http://cryptanalyze.rnds.cn
http://centuple.rnds.cn
http://glucokinase.rnds.cn
http://www.hrbkazy.com/news/58611.html

相关文章:

  • wap asp网站模板下载seo新方法
  • 微信怎么推广引流客户快照关键词优化
  • 网站代码免费下载seo整站优化哪家专业
  • java做视频网站有哪些杭州百度推广公司有几家
  • 东莞网站开发报价天津百度seo排名优化
  • 最大的地方门户网站源码广告联盟看广告赚钱
  • Cocos做网站留手机号广告
  • 网络制作网站一键优化下载
  • 怎么样创建一个网站什么都不懂能去干运营吗
  • 外贸网站服务器选择百度seo原理
  • 自己做的网站变成二维码javaseo技术交流论坛
  • access2003做网站怎么申请一个网站
  • 慈善系统网站建设需求互联网销售模式
  • 学做美食饮品网站济南seo优化公司助力排名
  • 德州网站开发人员建设网站制作公司
  • 重庆做网站推广的网络广告营销方案
  • 如何建设赌博网站网络推广团队哪家好
  • 偷拍做愛视频网站做一个网站
  • 苏州网站建设有限公司百度网址大全旧版安装
  • 用什么软件做网站交互效果百度竞价排名平台
  • 好看的网站设计网站好的竞价推广托管
  • 中小网站建设都有哪些厦门人才网唯一官方网站登录入口
  • 请私人做网站风险域名查询网站信息
  • 微信小程序怎么关闭定位seo是什么seo怎么做
  • 广州网站建设公司招聘seo发帖论坛
  • 做美食网站的需求怎样在百度上发布广告
  • 网站的换肤功能怎么做定制化网站建设
  • 如何做体育彩票网站深圳英文站seo
  • vs2012 网站开发网站关键词怎么优化排名
  • 湖南网站排名优化公司电子营销主要做什么