-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
36 lines (31 loc) · 995 Bytes
/
run.py
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
from train import train
from predict import predict
import argparse
if __name__ == "__main__":
# Change the parameters depending on which model and hyermarameter you want to use
batch_size = 50
epochs = 1
lr = 3e-4
model_name = "UNet"
loss_name = "dice"
print(f"Training model {model_name} with {loss_name} loss for {epochs} epochs with learning rate {lr} and batch size {batch_size}")
model, train_losses, val_losses = train(
model_name,
epochs=epochs,
lr=lr,
batch_size=batch_size,
loss_name=loss_name,
)
print("Finished training!")
print("Predicting test images...")
# Change the parameters depending on which models you want to use
args = {
"use_unet": True,
"use_GCDCNN": False,
"use_linknet": True,
"use_crop": False,
"use_TTA": False,
}
# Call the predict function with your args
args = argparse.Namespace(**args)
predict(args)