-
Notifications
You must be signed in to change notification settings - Fork 1
/
train_depth.py
53 lines (47 loc) · 1.15 KB
/
train_depth.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#%%
from dataloader import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader # For custom data-sets
import matplotlib.pyplot as plt
import pytorch_lightning as pl
from models.deeplab import Deeplab
from utils import *
from file_utils import *
import sys
import time
from experiments.experiment_depth_dl_aug import *
# from IPython import get_ipython
# get_ipython().run_line_magic("load_ext", "autoreload")
# get_ipython().run_line_magic("autoreload", "2")
#%%
exp_name = "default_depth_dl_aug"
#%%
if len(sys.argv) > 1:
exp_name = sys.argv[1]
#%%
config_dict = read_file(exp_name)
config_dict
#%%
#%%
tb_logger = pl.loggers.TensorBoardLogger(
save_dir="./",
name=f'{str(config_dict["experiment_name"])}', # This will create different subfolders for your models
version=f'v_{str(config_dict["version_number"])}',
)
#%%
hparams = dict_to_args(config_dict)
#%%
exp = DepthExperiment(hparams)
trainer = pl.Trainer(
fast_dev_run=False,
gpus=1,
max_epochs=hparams.num_epochs,
progress_bar_refresh_rate=5,
logger=tb_logger,
)
#%%
trainer.fit(exp)
trainer.test(exp)
#%%