def main():
    try:
        args = get_args()
        config = process_config(args.config)
    except:
        print('missing or invalid arguments')
        exit(0)
    if config.exp.mixed_precision:
        print('Use mixed precision training')
        policy = mixed_precision.Policy('mixed_float16')
        mixed_precision.set_policy(policy)
    if config.exp.jpa_optimization:
        tf.config.optimizer.set_jit(True)
    create_dirs([config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir])
    print('Create the training data generator.')
    if (config.generator.is_scenenet == True):
        train_data = ScenenetRGBDDataGenerator(config)
    else:
        train_data = JointDataGenerator(config)
    validation_data = None
    if (type(config.validation.img_dir) == str):
        print('Create the validation data generator.')
        validation_data = JointDataGenerator(config, is_training_set=False)
    print('Create the model.')
    model = factory.create(config.model.class_name)(config, train_data)
    print('Create the trainer')
    trainer = SegmentationTrainer(model, train_data, config, validation_generator=validation_data)
    print('Start training the model.')
    trainer.train()
def main():
    try:
        args = get_args()
        config = process_config(args.config)
    except:
        print('missing or invalid arguments')
        exit(0)
    if config.exp.mixed_precision:
        print('Use mixed precision training')
        policy = mixed_precision.Policy('mixed_float16')
        mixed_precision.set_policy(policy)
    if config.exp.jpa_optimization:
        tf.config.optimizer.set_jit(True)
    create_dirs([config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir])
    print('Create the training data generator.')
    if (config.generator.is_scenenet == True):
        train_data = ScenenetRGBDDataGenerator(config)
    else:
        train_data = JointDataGenerator(config)
    validation_data = None
    if (type(config.validation.img_dir) == str):
        print('Create the validation data generator.')
        validation_data = JointDataGenerator(config, is_training_set=False)
    print('Create the model.')
    model = factory.create(config.model.class_name)(config, train_data)
    print('Create the trainer')
    trainer = SegmentationTrainer(model, train_data, config, validation_generator=validation_data)
    print('Start training the model.')
    trainer.train()