微信公众号:OpenCV学堂
关注获取更多计算机视觉与深度学习知识
前言
程序实现
class InferenceThread(QtCore.QThread):
fire_stats_signal = QtCore.pyqtSignal(dict)
def __init__(self, settings):
super(InferenceThread, self).__init__()
self.settings = settings
self.detector = YOLOv8PtInference(settings)
self.input_image = settings.input_image
def run(self):
if self.detector is None:
return
if self.input_image.endswith(".mp4"):
cap = cv.VideoCapture(self.input_image)
while True:
ret, frame = cap.read()
if ret is True:
self.detector.infer_image(frame)
self.fire_stats_signal.emit({"result": frame})
else:
break
else:
frame = cv.imread(self.input_image)
self.detector.infer_image(frame)
self.fire_stats_signal.emit({"result": frame})
self.fire_stats_signal.emit({"done": "done"})
return
实例分割 - 运行截图如下:
姿态评估 - 运行截图如下:
扫码查看OpenCV+OpenVIO+Pytorch系统化学习路线图
文章引用微信公众号"OpenCV学堂",如有侵权,请联系管理员删除!