diff --git a/.hypothesis/unicode_data/13.0.0/charmap.json.gz b/.hypothesis/unicode_data/13.0.0/charmap.json.gz old mode 100644 new mode 100755 diff --git a/Calculate_Process/Calculate.py b/Calculate_Process/Calculate.py old mode 100644 new mode 100755 diff --git a/Calculate_Process/__init__.py b/Calculate_Process/__init__.py old mode 100644 new mode 100755 diff --git a/Calculate_Process/__pycache__/Calculate.cpython-310.pyc b/Calculate_Process/__pycache__/Calculate.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Calculate_Process/__pycache__/__init__.cpython-310.pyc b/Calculate_Process/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Image_Process/__pycache__/Image_Generator.cpython-310.pyc b/Image_Process/__pycache__/Image_Generator.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Image_Process/__pycache__/image_enhancement.cpython-310.pyc b/Image_Process/__pycache__/image_enhancement.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Image_Process/__pycache__/load_and_ImageGenerator.cpython-310.pyc b/Image_Process/__pycache__/load_and_ImageGenerator.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Load_process/Load_Indepentend.py b/Load_process/Load_Indepentend.py old mode 100644 new mode 100755 diff --git a/Load_process/Loading_Tools.py b/Load_process/Loading_Tools.py old mode 100644 new mode 100755 diff --git a/Load_process/__pycache__/LoadData.cpython-310.pyc b/Load_process/__pycache__/LoadData.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Load_process/__pycache__/Load_Indepentend.cpython-310.pyc b/Load_process/__pycache__/Load_Indepentend.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Load_process/__pycache__/Loading_Tools.cpython-310.pyc b/Load_process/__pycache__/Loading_Tools.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Load_process/__pycache__/file_processing.cpython-310.pyc b/Load_process/__pycache__/file_processing.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Model_Loss/Loss.py b/Model_Loss/Loss.py old mode 100644 new mode 100755 diff --git a/Model_Loss/__pycache__/Loss.cpython-310.pyc b/Model_Loss/__pycache__/Loss.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Output_Class/Tqdm_Output_Class.py b/Output_Class/Tqdm_Output_Class.py old mode 100644 new mode 100755 diff --git a/Output_Class/__pycache__/Tqdm_Output_Class.cpython-310.pyc b/Output_Class/__pycache__/Tqdm_Output_Class.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Processing_image.py b/Processing_image.py old mode 100644 new mode 100755 diff --git a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc b/Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Read_and_process_image/__pycache__/__init__.cpython-310.pyc b/Read_and_process_image/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/SCP_Process/Scp_Process.py b/SCP_Process/Scp_Process.py old mode 100644 new mode 100755 diff --git a/SCP_Process/__pycache__/Scp_Process.cpython-310.pyc b/SCP_Process/__pycache__/Scp_Process.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Training_Tools/Tools.py b/Training_Tools/Tools.py old mode 100644 new mode 100755 diff --git a/Training_Tools/__init__.py b/Training_Tools/__init__.py old mode 100644 new mode 100755 diff --git a/Training_Tools/__pycache__/Tools.cpython-310.pyc b/Training_Tools/__pycache__/Tools.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/Training_Tools/__pycache__/__init__.cpython-310.pyc b/Training_Tools/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/_validation/__pycache__/ValidationTheEnterData.cpython-310.pyc b/_validation/__pycache__/ValidationTheEnterData.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/all_models_tools/__pycache__/__init__.cpython-310.pyc b/all_models_tools/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/all_models_tools/__pycache__/all_model_tools.cpython-310.pyc b/all_models_tools/__pycache__/all_model_tools.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/all_models_tools/__pycache__/pre_train_model_construction.cpython-310.pyc b/all_models_tools/__pycache__/pre_train_model_construction.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/application/__pycache__/Xception_indepentment.cpython-310.pyc b/application/__pycache__/Xception_indepentment.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/draw_tools/__pycache__/Grad_cam.cpython-310.pyc b/draw_tools/__pycache__/Grad_cam.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/draw_tools/__pycache__/__init__.cpython-310.pyc b/draw_tools/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/draw_tools/__pycache__/draw.cpython-310.pyc b/draw_tools/__pycache__/draw.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/experiments/__pycache__/__init__.cpython-310.pyc b/experiments/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/experiments/__pycache__/experiment.cpython-310.pyc b/experiments/__pycache__/experiment.cpython-310.pyc old mode 100644 new mode 100755 index 5019f9c..6660aa4 Binary files a/experiments/__pycache__/experiment.cpython-310.pyc and b/experiments/__pycache__/experiment.cpython-310.pyc differ diff --git a/experiments/__pycache__/pytorch_Model.cpython-310.pyc b/experiments/__pycache__/pytorch_Model.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/experiments/experiment.py b/experiments/experiment.py index 1f55d0d..c5d0667 100755 --- a/experiments/experiment.py +++ b/experiments/experiment.py @@ -140,14 +140,14 @@ class experiments(): for inputs, labels in epoch_iterator: - labels = functional.one_hot(labels, self.Number_Of_Classes) + OneHot_labels = functional.one_hot(labels, self.Number_Of_Classes) # labels = np.reshape(labels, (int(labels.shape[0]), 1)) - inputs, labels = inputs.to(self.device), labels.to(self.device) + inputs, OneHot_labels = inputs.to(self.device), OneHot_labels.to(self.device) # inputs, labels = inputs.cuda(), labels.cuda() Optimizer.zero_grad() outputs = model(inputs) - loss = criterion(outputs, labels) + loss = criterion(outputs, OneHot_labels) loss.backward() Optimizer.step() running_loss += loss.item() @@ -159,7 +159,8 @@ class experiments(): Training_Loss = running_loss/len(Training) - all_train_labels = torch.argmax(all_train_labels, 1) + # all_train_labels = torch.FloatTensor(all_train_labels) + # all_train_labels = torch.argmax(all_train_labels, 1) train_accuracy = accuracy_score(all_train_labels, all_train_preds) train_losses.append(Training_Loss) @@ -174,11 +175,11 @@ class experiments(): with torch.no_grad(): for inputs, labels in self.Validation: - labels = np.reshape(labels, (int(labels.shape[0]), 1)) - inputs, labels = inputs.to(self.device), labels.to(self.device) + OneHot_labels = functional.one_hot(labels, self.Number_Of_Classes) + inputs, OneHot_labels = inputs.to(self.device), OneHot_labels.to(self.device) outputs = model(inputs) - loss = criterion(outputs, labels) + loss = criterion(outputs, OneHot_labels) val_loss += loss.item() # 驗證預測與標籤 @@ -188,8 +189,6 @@ class experiments(): # 計算驗證損失與準確率 val_loss /= len(self.Validation) - - all_val_labels = torch.argmax(all_val_labels, 1) val_accuracy = accuracy_score(all_val_labels, all_val_preds) val_losses.append(val_loss) @@ -212,19 +211,21 @@ class experiments(): True_Label, Predict_Label = [], [] loss = 0.0 with torch.no_grad(): - for i, (images, labels) in enumerate(self.test): + for images, labels in self.test: + OneHot_labels = functional.one_hot(labels, self.Number_Of_Classes) + images, OneHot_labels = images.to(self.device), OneHot_labels.to(self.device) + outputs = cnn_model(images) - _, predicted = torch.max(outputs.data, 1) + _, predicted = torch.max(outputs, 1) Predict_Label.extend(predicted.cpu().numpy()) True_Label.extend(labels.cpu().numpy()) loss /= len(self.test) - all_val_labels = torch.argmax(all_val_labels, 1) accuracy = accuracy_score(True_Label, Predict_Label) precision = precision_score(True_Label, Predict_Label) recall = recall_score(True_Label, Predict_Label) - AUC = auroc(True_Label, Predict_Label) + AUC = auroc(True_Label, Predict_Label, task = ["Stomatch_Cancer", "Normal"]) f1 = f1_score(True_Label, Predict_Label) return loss, accuracy, precision, recall, AUC, f1, True_Label, Predict_Label diff --git a/experiments/pytorch_Model.py b/experiments/pytorch_Model.py old mode 100644 new mode 100755 diff --git a/merge_class/__pycache__/merge.cpython-310.pyc b/merge_class/__pycache__/merge.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/model_data_processing/__pycache__/__init__.cpython-310.pyc b/model_data_processing/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/model_data_processing/__pycache__/processing.cpython-310.pyc b/model_data_processing/__pycache__/processing.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/model_data_processing/__pycache__/processing_for_cut_image.cpython-310.pyc b/model_data_processing/__pycache__/processing_for_cut_image.cpython-310.pyc old mode 100644 new mode 100755