New Push in 20241207
This commit is contained in:
parent
ab05d5d87f
commit
7c0d37548b
0
.hypothesis/unicode_data/13.0.0/charmap.json.gz
Normal file → Executable file
0
.hypothesis/unicode_data/13.0.0/charmap.json.gz
Normal file → Executable file
0
Calculate_Process/Calculate.py
Normal file → Executable file
0
Calculate_Process/Calculate.py
Normal file → Executable file
0
Calculate_Process/__init__.py
Normal file → Executable file
0
Calculate_Process/__init__.py
Normal file → Executable file
0
Calculate_Process/__pycache__/Calculate.cpython-310.pyc
Normal file → Executable file
0
Calculate_Process/__pycache__/Calculate.cpython-310.pyc
Normal file → Executable file
0
Calculate_Process/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
Calculate_Process/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/Image_Generator.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/Image_Generator.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/image_enhancement.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/image_enhancement.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/load_and_ImageGenerator.cpython-310.pyc
Normal file → Executable file
0
Image_Process/__pycache__/load_and_ImageGenerator.cpython-310.pyc
Normal file → Executable file
0
Load_process/Load_Indepentend.py
Normal file → Executable file
0
Load_process/Load_Indepentend.py
Normal file → Executable file
0
Load_process/Loading_Tools.py
Normal file → Executable file
0
Load_process/Loading_Tools.py
Normal file → Executable file
0
Load_process/__pycache__/LoadData.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/LoadData.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/Load_Indepentend.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/Load_Indepentend.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/Loading_Tools.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/Loading_Tools.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/file_processing.cpython-310.pyc
Normal file → Executable file
0
Load_process/__pycache__/file_processing.cpython-310.pyc
Normal file → Executable file
0
Model_Loss/Loss.py
Normal file → Executable file
0
Model_Loss/Loss.py
Normal file → Executable file
0
Model_Loss/__pycache__/Loss.cpython-310.pyc
Normal file → Executable file
0
Model_Loss/__pycache__/Loss.cpython-310.pyc
Normal file → Executable file
0
Output_Class/Tqdm_Output_Class.py
Normal file → Executable file
0
Output_Class/Tqdm_Output_Class.py
Normal file → Executable file
0
Output_Class/__pycache__/Tqdm_Output_Class.cpython-310.pyc
Normal file → Executable file
0
Output_Class/__pycache__/Tqdm_Output_Class.cpython-310.pyc
Normal file → Executable file
0
Processing_image.py
Normal file → Executable file
0
Processing_image.py
Normal file → Executable file
0
Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc
Normal file → Executable file
0
Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc
Normal file → Executable file
0
Read_and_process_image/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
Read_and_process_image/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
SCP_Process/Scp_Process.py
Normal file → Executable file
0
SCP_Process/Scp_Process.py
Normal file → Executable file
0
SCP_Process/__pycache__/Scp_Process.cpython-310.pyc
Normal file → Executable file
0
SCP_Process/__pycache__/Scp_Process.cpython-310.pyc
Normal file → Executable file
0
Training_Tools/Tools.py
Normal file → Executable file
0
Training_Tools/Tools.py
Normal file → Executable file
0
Training_Tools/__init__.py
Normal file → Executable file
0
Training_Tools/__init__.py
Normal file → Executable file
0
Training_Tools/__pycache__/Tools.cpython-310.pyc
Normal file → Executable file
0
Training_Tools/__pycache__/Tools.cpython-310.pyc
Normal file → Executable file
0
Training_Tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
Training_Tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
_validation/__pycache__/ValidationTheEnterData.cpython-310.pyc
Normal file → Executable file
0
_validation/__pycache__/ValidationTheEnterData.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/all_model_tools.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/all_model_tools.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/pre_train_model_construction.cpython-310.pyc
Normal file → Executable file
0
all_models_tools/__pycache__/pre_train_model_construction.cpython-310.pyc
Normal file → Executable file
0
application/__pycache__/Xception_indepentment.cpython-310.pyc
Normal file → Executable file
0
application/__pycache__/Xception_indepentment.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/Grad_cam.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/Grad_cam.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/draw.cpython-310.pyc
Normal file → Executable file
0
draw_tools/__pycache__/draw.cpython-310.pyc
Normal file → Executable file
0
experiments/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
experiments/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
BIN
experiments/__pycache__/experiment.cpython-310.pyc
Normal file → Executable file
BIN
experiments/__pycache__/experiment.cpython-310.pyc
Normal file → Executable file
Binary file not shown.
0
experiments/__pycache__/pytorch_Model.cpython-310.pyc
Normal file → Executable file
0
experiments/__pycache__/pytorch_Model.cpython-310.pyc
Normal file → Executable file
|
|
@ -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
|
||||
|
||||
|
|
|
|||
0
experiments/pytorch_Model.py
Normal file → Executable file
0
experiments/pytorch_Model.py
Normal file → Executable file
0
merge_class/__pycache__/merge.cpython-310.pyc
Normal file → Executable file
0
merge_class/__pycache__/merge.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/__init__.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/processing.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/processing.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/processing_for_cut_image.cpython-310.pyc
Normal file → Executable file
0
model_data_processing/__pycache__/processing_for_cut_image.cpython-310.pyc
Normal file → Executable file
Loading…
Reference in New Issue
Block a user