基于pyqt5和yolov8的智慧工地施工人工安全检测系统
主要基于两者进行集成
在前面模型训练基础上,实现安全马甲、安全面具和安全帽的检测。
核心检测代码
def run(self):
self.hilo_corriendo = True
model = YOLO("best.pt")
cap = cv2.VideoCapture(0)
while self.hilo_corriendo:
ret, frame = cap.read()
if ret:
resultados = model.predict(frame, imgsz=640, conf=0.60, classes=self.selected_classes)
anotaciones = resultados[0].plot()
Image = cv2.cvtColor(anotaciones, cv2.COLOR_BGR2RGB)
if self.hilo_corriendo:
convertir_QT = QImage(Image.data, Image.shape[1], Image.shape[0], QImage.Format_RGB888)
pic = convertir_QT.scaled(480, 340, Qt.KeepAspectRatio)
self.Imageupd.emit(pic)
NumDetect = resultados[0].__len__()
NameDetect = resultados[0].verbose()
cap.release()
self.thread_stopped.emit()
运行结果:
源码下载地址:
https://download.csdn.net/download/douyu0814/88484406