目录a.其中主要包含有图片检测、权重加载、可信度调整、检测结果保存,日志输出功能(可扩充)
b.文件中的权重和数据集可以更换,训练介绍后不影响GUI的使用
- yolov3目标检测可视化框架(轻量级)——以火焰识别为例
- 一、功能介绍
- 1.主界面布局
- 2.权重加载
- 3.读取文件 -> 目标检测
- 4.更改可信度 -> 目标检测
- 5.保存图片
- 二、更换检测数据
- 三、源码
二、更换检测数据
可以参考:https://blog.csdn.net/qq_21578849/article/details/84980298
三、源码def open_weight(self):
self.weightName, weightType = QFileDialog.getOpenFileName(self, "打开权重文件", "", "*.pth;;All Files(*)")
self.lineEdit.setText(str(self.weightName))
self.txt += f'[+]权重文件加载成功!地址:{self.weightName}\n'
self.textEdit.setPlainText(self.txt)
self.pushButton.setEnabled(True)
def status_msg(self, msg, time):
self.statusBar.showMessage(str(msg), int(time))
QApplication.processEvents()
def open_image(self):
self.imgName, imgType = QFileDialog.getOpenFileName(self, "打开图片", "", "*.jpg;;*.png;;All Files(*)")
imgName_cv2 = cv2.imread(self.imgName)
imgName_cv2 = cv2.resize(imgName_cv2, (450, 360))
try:
if imgName_cv2.all != None:
im0 = cv2.cvtColor(imgName_cv2, cv2.COLOR_RGB2BGR)
showImage = QtGui.QImage(im0, im0.shape[1], im0.shape[0], 3 * im0.shape[1], QtGui.QImage.Format_RGB888)
self.label.setPixmap(QtGui.QPixmap.fromImage(showImage))
self.pushButton_3.setEnabled(True)
self.txt+=f'[+]图片加载成功!地址:{self.imgName}\n'
self.textEdit.setPlainText(self.txt)
except Exception as e:
print(str(e))
self.status_msg('[-]不能含有中午路径'+str(e),5000)
QApplication.processEvents()
def cvImgtoQtImg(self,cvImg):
QtImgBuf = cv2.cvtColor(cvImg, cv2.COLOR_BGR2BGRA)
QtImg = QtGui.QImage(QtImgBuf.data, QtImgBuf.shape[1], QtImgBuf.shape[0], QtGui.QImage.Format_RGB32)
return QtImg
源文件下载:传送门
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)