def TrainImageButton_Click(self): if self.flag == 0: print("请先训练好模型!\n请先训练好模型!\n请先训练好模型!\n请先训练好模型!\n请先训练好模型!") elif self.flag2 == 0: print("请先获取X光图片\n请先获取X光图片\n请先获取X光图片\n请先获取X光图片\n请先获取X光图片\n") else: y_score = Covid19Classification.predict(self.model, self.image1) y_pred = np.rint(y_score) self.PredLabel.setText("Pred: Covid19" if int(y_pred[0]) == 1 else "Pred: Normal")
def IndexButton_Click(self): Covid19Classification.show_anything(self.model, self.X_test, self.y_test, flag=3)
def TestButton_Click(self): if self.flag == 0: print("请先训练好模型!\n请先训练好模型!\n请先训练好模型!\n请先训练好模型!\n请先训练好模型!") else: Covid19Classification.test(self.model, self.X_test, self.y_test)
def LoadParams_Click(self): self.model, self.X_test, self.y_test = Covid19Classification.train( load_params=True) self.flag = 1 print("模型已加载!!\n模型已加载!!\n模型已加载!!\n模型已加载!!\n模型已加载!!\n")
def TrainButton_Click(self): self.model, self.X_test, self.y_test = Covid19Classification.train( load_params=False) self.flag = 1