Repository navigation
Expand file tree
/
Copy pathmodifications.patch
More file actions
65 lines (53 loc) · 2.48 KB
/
Copy pathmodifications.patch
File metadata and controls
65 lines (53 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- sam_net_implementation.py 2025-05-03 22:10:58.898343444 -0400
+++ sam_net_implementation.modified.py 2025-05-06 09:31:34.860673559 -0400
@@ -26,7 +26,7 @@
import nilearn.plotting as nlplt
# get_ipython().system('pip install git+https://github.com/miykael/gif_your_nifti # nifti to gif')
import os
-os.system("pip install git+https://github.com/miykael/gif_your_nifti")
+#os.system("pip install git+https://github.com/miykael/gif_your_nifti")
import gif_your_nifti.core as gif2nif # Nifti to GIF converter
@@ -423,7 +423,7 @@
)
# Save the final model
-model.save("/kaggle/working/3D_MRI_Brain_Tumor_Segmentation.h5")
+model.save("kaggle/working/3D_MRI_Brain_Tumor_Segmentation.h5")
# **Visualize the training process**
@@ -581,7 +581,7 @@
IMG_SIZE = 128
VOLUME_SLICES = 100
VOLUME_START_AT = 22
-OUTPUT_MASKS_FOLDER = '/kaggle/working/pseudo_labels/' # Path where you save predicted masks
+OUTPUT_MASKS_FOLDER = 'kaggle/working/pseudo_labels/' # Path where you save predicted masks
model = tf.keras.models.load_model(
# '/kaggle/input/model-x80-dcs65/model_x81_dcs65.h5',
'data/UNET/model_per_class.h5',
@@ -612,7 +612,7 @@
return volume
# New OUTPUT FOLDER
-OUTPUT_DATASET_FOLDER = '/kaggle/working/dataset/' # Not pseudo_labels/
+OUTPUT_DATASET_FOLDER = 'kaggle/working/dataset/' # Not pseudo_labels/
os.makedirs(os.path.join(OUTPUT_DATASET_FOLDER, "images"), exist_ok=True)
os.makedirs(os.path.join(OUTPUT_DATASET_FOLDER, "masks"), exist_ok=True)
@@ -640,7 +640,7 @@
# Set path
-TRAIN_DATASET_PATH = '/data/BRATS/BraTS2020_TrainingData/MICCAI_BraTS2020_TrainingData/'
+TRAIN_DATASET_PATH = 'data/BRATS/BraTS2020_TrainingData/MICCAI_BraTS2020_TrainingData/'
# Get patient IDs
# List only folders (patients), not any unwanted files
@@ -685,7 +685,7 @@
# In[18]:
-get_ipython().system('pip install git+https://github.com/facebookresearch/segment-anything.git')
+#get_ipython().system('pip install git+https://github.com/facebookresearch/segment-anything.git')
import os
import cv2
import torch
@@ -701,7 +701,7 @@
MODEL_TYPE = "vit_b" # Options: 'vit_b', 'vit_l', 'vit_h'
# SAM_CKPT_PATH = "/kaggle/input/segment-anything/pytorch/vit-b/1/model.pth" # Pretrained SAM checkpoint path
SAM_CKPT_PATH = "data/segment-anything-pytorch-vit-b-v1/model.pth"
-DATASET_PATH = "working/dataset" # Pseudo-labeled dataset: images/ and masks/
+DATASET_PATH = "kaggle/working/dataset" # Pseudo-labeled dataset: images/ and masks/
BATCH_SIZE = 8
NUM_EPOCHS = 10
LEARNING_RATE = 1e-4