-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (27 loc) · 1 KB
/
Copy pathmain.py
File metadata and controls
36 lines (27 loc) · 1 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
from data_loader.reader import FruitsDataLoader
from models.template_model import TemplateModel
from trainers.fruit_model_trainer import FruitModelTrainer
from utils.config import process_config
from utils.dirs import create_dirs
from utils.utils import get_args
def main():
# capture the config path from the run arguments
# then process the json configuration file
try:
args = get_args()
config = process_config(args.config)
except:
print("missing or invalid arguments")
exit(0)
# create the experiments dirs
create_dirs([config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir])
print('Create the data generator.')
data_loader = FruitsDataLoader(config)
print('Create the model.')
model = TemplateModel(config)
print('Create the trainer')
trainer = FruitModelTrainer(model.model, data_loader.get_train_val_data(), config)
print('Start training the model.')
trainer.train()
if __name__ == '__main__':
main()