Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added model with augmentations and .json export metrics #31

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ColonSegNet_brightcontr.onnx
Binary file not shown.
1 change: 1 addition & 0 deletions data/models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| ColonSegNet-07112023-2359.onnx (20MB or 20,067,028) | [:link:](TOADD) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1s-eKu6QjaV54jva_ylG1VxwCj1B8nwJ3)
| Geometric Tx | [:link:](https://drive.google.com/file/d/1vE023Thky0vKfoYD7wZecrglHEgp3z-W/view?usp=sharing) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1s-eKu6QjaV54jva_ylG1VxwCj1B8nwJ3) |
| Baseline model 4 epochs | [:link:](https://drive.google.com/file/d/1SWPzOeqKyKqBM9FVfj0qCPn8cxEhX9BK/view?usp=drive_link) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/TOADD) |
| ColonSegNet_brightcontr.onnx (20MB) | [:link:](https://drive.google.com/file/d/1IoeDmH-nBcOrmrg1SBEx2wuMjRCuO0K_/view?usp=drive_link) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1CgdpeDY4SLpKddk6dFvXpFwcx0skF8dj#scrollTo=e7dn13rCydBf) |
| Add Your Model by creation a new row | [:link:](COPY&PASTE_DRIVE_LINK) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/COPY&PASTE_DRIVE_LINK) |

### Examples to download models in your local machine
Expand Down
9 changes: 9 additions & 0 deletions eval_metrics_brightcontr_model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Jaccard": 0.3948154304786141,
"F1": 0.5096914044004484,
"Recall": 0.6564222323237617,
"Precision": 0.5460967256637365,
"Acc": 0.8621585210164388,
"F2": 0.5096914044004484,
"Mean FPS": 0.1118420037964724
}
9 changes: 9 additions & 0 deletions eval_metrics_orig_model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Jaccard": 0.7238557526652066,
"F1": 0.8206050156575089,
"Recall": 0.8496177143081016,
"Precision": 0.8434546635722502,
"Acc": 0.9493032137552897,
"F2": 0.8206050156575089,
"Mean FPS": 0.10518452201876329
}
25 changes: 25 additions & 0 deletions export_eval_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
print(f"Jaccard: {jaccard:1.4f} - F1: {f1:1.4f} - Recall: {recall:1.4f} - Precision: {precision:1.4f} - Acc: {acc:1.4f} - F2: {f2:1.4f}")
print("Mean FPS: ", mean_fps)
import json

data = {
"Jaccard": jaccard,
"F1": f1,
"Recall": recall,
"Precision": precision,
"Acc": acc,
"F2": f2,
"Mean FPS": mean_fps,
}

# ct = datetime.datetime.now()
# ts = ct.timestamp()
# ts_str = str(ts)
file_ext = ".json"
path_to_file = "results/eval_metrics_brightcontr_model" #ts_str
path_to_file = path_to_file + file_ext

text = json.dumps(data, indent=4)
with open(path_to_file, "w") as out_file_obj:
# write the text into the file
out_file_obj.write(text)
Binary file added files/checkpoint.pth
Binary file not shown.
24 changes: 24 additions & 0 deletions files/train_log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Dataset Size after Augmentation:
Train: 1760 - Valid: 120

Hyperparameters:
Image Size: (512, 512)
Batch Size: 6
LR: 0.0001
Epochs: 3
Optimizer: Adam
Loss: BCE Dice Loss

Epoch: 01 | Epoch Time: 9m 48s
Train Loss: 1.088
Val. Loss: 0.991

Epoch: 02 | Epoch Time: 9m 47s
Train Loss: 0.888
Val. Loss: 0.900

Epoch: 03 | Epoch Time: 9m 47s
Train Loss: 0.780
Val. Loss: 0.868

Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def __init__(self, data, source="replayer"):
self.sample_data_path = data

self.model_path_map = {

#"ultrasound_seg": os.path.join(self.sample_data_path, "colon.onnx"),
"ultrasound_seg": os.path.join(self.sample_data_path, "ColonSegNet-07112023-2359.onnx"),
#"ultrasound_seg": os.path.join(self.sample_data_path, "ColonSegNet_brightcontr.onnx"),
Expand Down