(资料图片仅供参考)
defon_yolov8_track(self):image_file=self.image_file_edit.text()label_file=self.label_file_path.text()model_file=self.weight_file_path.text()iflen(image_file)==0orlen(label_file)==0orlen(model_file)==0:QtWidgets.QMessageBox.warning(self,"警告","参数文件未选择...")returnself.traffic_delta_label.setText("流量净值:0")self.traffic_jam_label.setText("总流量:0")self.input_traffic_label.setText("进流量:0")self.output_traffic_label.setText("出流量:0")settings=DLInferSettings()settings.weight_file_path=self.weight_file_path.text()settings.label_map_file_path=self.label_file_path.text()settings.score_threshold=self.conf_spinbox.value()settings.input_image=image_filesettings.track_vehicle=self.vehicle_chkbox.isChecked()settings.track_person=self.person_chkbox.isChecked()settings.track_by_category_index=self.category_combox.currentIndex()settings.track_id=self.track_by_id_spin_box.value()settings.target_deploy=1ifself.hline_rbtn.isChecked():settings.track_line_type=0ifself.vline_rbtn.isChecked():settings.track_line_type=1ifself.diagonal_rbtn.isChecked():settings.track_line_type=2self.work_thread=InferenceThread(settings)self.work_thread.fire_stats_signal.connect(self.on_update_result_image)self.work_thread.finished.connect(self.work_thread.deleteLater)self.work_thread.start()self.startBtn.setStyleSheet("background-color:gray;color:white")self.startBtn.setEnabled(False)self.stopBtn.setStyleSheet("background-color:cyan;color:black")self.stopBtn.setEnabled(True)
defon_update_result_image(self,outs):image=outs.get("result")done=outs.get("done")num_in=outs.get("num_in")num_out=outs.get("num_out")ifimageisnotNone:dst=cv.cvtColor(image,cv.COLOR_BGR2RGB)height,width,channel=dst.shapebytesPerLine=3*widthimg=QtGui.QImage(dst.data,width,height,bytesPerLine,QtGui.QImage.Format_RGB888)pixmap=QtGui.QPixmap(img)pix=pixmap.scaled(QtCore.QSize(1280,720),QtCore.Qt.KeepAspectRatio)self.label.setPixmap(pix)self.show_text("OpenCV开发者联盟-跟踪演示")self.traffic_delta_label.setText("流量净值:%d"%(num_in-num_out))self.traffic_jam_label.setText("总流量:%d"%(num_in+num_out))self.input_traffic_label.setText("进流量:%d"%num_in)self.output_traffic_label.setText("出流量:%d"%num_out)ifdoneisnotNone:self.stopBtn.setStyleSheet("background-color:gray;color:white")self.stopBtn.setEnabled(False)self.startBtn.setStyleSheet("background-color:cyan;color:black")self.startBtn.setEnabled(True)
扫码查看OpenCV+OpenVIO+Pytorch系统化学习路线图
X 关闭
Copyright 2015-2022 华声服务网 版权所有京ICP备2021034106号-36
邮箱:55 16 53 8 @qq.com