Commit 03e3b7e4 authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Training step folder

parent 433f429e
......@@ -27,20 +27,20 @@ from torch.utils.tensorboard import SummaryWriter
from dataset import NumpyCSVDataset, augment_3D_HN
from networks import CiompiDO, ResNet50_3d
from split import train_test_indexes_patient_wise
from config import get_project_root
PATH = Path(os.getcwd())
print(PATH)
#%%
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
multigpu = True
#
PROJECT_ROOT = get_project_root()
DATASET = 'HN_val'
BBOX_SUBDATASET = 'bbox_64'
DATASET_DIR = PATH / 'data' / DATASET / 'processed' / 'bbox' / BBOX_SUBDATASET
EXPERIMENT_DIR = PATH / 'experiments'
DATASET_DIR = PROJECT_ROOT / 'data' / DATASET / 'processed' / 'bbox' / BBOX_SUBDATASET
EXPERIMENT_DIR = PROJECT_ROOT / 'experiments'
PRETRAINED_MED3D_WEIGHTS = PATH / 'pretrained_weights' / 'resnet_50.pth'
PRETRAINED_MED3D_WEIGHTS = PROJECT_ROOT / 'pretrained_weights' / 'resnet_50.pth'
PRETRAINED_T_STAGE = EXPERIMENT_DIR / 'Tstage_4_noTx_CT_20191114-163418' / 'weights.pth'
# %%
### Settings
......@@ -50,7 +50,7 @@ settings = {
"model": CiompiDO,
"batch_size": 16,
"lr": 1e-5,
"epochs": 300,
"epochs": 1,
"optim": torch.optim.Adam,
"K": 0.2,
"n_classes": 4, # TSTAGE
......@@ -86,7 +86,7 @@ PRETRAINED = settings["pretrained"]
def new_run_log_dir(experiment_name):
log_dir = PATH / "tb-runs"
log_dir = PROJECT_ROOT / "tb-runs"
if not os.path.exists(log_dir):
os.makedirs(log_dir)
run_log_dir = log_dir / experiment_name
......@@ -100,7 +100,9 @@ writer = SummaryWriter(log_dir)
# %%
# ### Data Handlers
clinical_file = PATH / 'data' / DATASET / 'processed' / f'clinical_{DATASET}.csv'
clinical_file = (
PROJECT_ROOT / 'data' / DATASET / 'processed' / f'clinical_{DATASET}.csv'
)
target_column = "T-stage_grouped"
# %%
np.random.seed(SEED)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment