Ejemplo n.º 1
0
 def slot_load_model(self):
     """
     加载模型槽函数
     :return:
     """
     # model = self.cb_model.currentText()
     flag = predict_dl.load_model()
     if flag == -1:
         predict_dl.close_sess()
         return
     predict_dl.predict(1)
     predict_dl.predict(1)
     self.pb_load_model.setDisabled(True)
     # self.pb_detect.setEnabled(True)
     self.pb_close_model.setEnabled(True)
Ejemplo n.º 2
0
 def slot_detect(self):
     """
     检测槽函数
     :return:
     """
     img_path = self.le_file.text()
     if img_path == '':
         QMessageBox.information(self, 'Error', '请选择文件')
         return
     if self.cb_method.currentText() == '深度学习':
         pre, run_time = predict_dl.predict(img_path)
     else:
         pre, run_time = 0, 1
     row_count = self.table_history.rowCount()
     self.table_history.insertRow(row_count)
     self.table_history.setItem(row_count, 0, QTableWidgetItem(str(row_count+1)))
     self.table_history.item(row_count, 0).setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
     self.table_history.setItem(row_count, 1, QTableWidgetItem(self.class_name_dic[pre]))
     # 数据库插入一条检测记录
     self.insert_log(pre, img_path)
     # temp_log = [img_path, str(pre), time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())]
     if pre == -1:
         return
     # 在界面的历史记录表中插入信息
     self.le_class.setText(str(pre))
     self.le_time.setText(str(run_time))
     self.put_text(pre)