def main():
    flags['seed'] = 1234

    # Parse Arguments
    parser = argparse.ArgumentParser(description='Faster R-CNN Networks Arguments')
    parser.add_argument('-n', '--run_num', default=0)  # Saves all under /save_directory/model_directory/Model[n]
    parser.add_argument('-e', '--epochs', default=1)  # Number of epochs for which to train the model
    parser.add_argument('-r', '--restore', default=0)  # Binary to restore from a model. 0 = No restore.    
    parser.add_argument('-m', '--model_restore', default=1)  # Restores from /save_directory/model_directory/Model[n]
    parser.add_argument('-f', '--file_epoch', default=1)  # Restore filename: 'part_[f].ckpt.meta'
    parser.add_argument('-s', '--slim', default=1)  # Binary to restore a TF-Slim Model. 0 = No eval.
    parser.add_argument('-t', '--train', default=1)  # Binary to train model. 0 = No train.
    parser.add_argument('-v', '--eval', default=1)  # Binary to evalulate model. 0 = No eval.
    parser.add_argument('-y', '--yaml', default='pascal_voc2007.yml')  # YAML file to override config defaults
    parser.add_argument('-l', '--learn_rate', default=1e-3)  # learning Rate 
    parser.add_argument('-i', '--vis', default=0)  # enable visualizations
    parser.add_argument('-g', '--gpu', default=0)  # specifiy which GPU to use
    args = vars(parser.parse_args())

    # Set Arguments
    flags['run_num'] = int(args['run_num'])
    flags['num_epochs'] = int(args['epochs'])
    
    flags['restore_num'] = int(args['model_restore'])
    flags['file_epoch'] = int(args['file_epoch'])
    
    if args['restore'] == 0:
        flags['restore'] = False
    else:
        flags['restore'] = True
        flags['restore_file'] = 'part_' + str(args['file_epoch']) + '.ckpt.meta'
        flags['restore_slim_file'] = None

    if args['yaml'] != 'default': 
        dictionary = cfg_from_file('cfgs/' + args['yaml'])
        print('Restoring from %s file' % args['yaml'])
    else:
        dictionary = []
        print('Using Default settings')
        
    flags['learning_rate'] = float(args['learn_rate'])
    flags['vis'] = True if (int(args['vis']) == 1) else False
    flags['gpu'] = int(args['gpu'])
    
    update_flags()
    
    model = FasterRcnnRes50(flags, dictionary)
    if int(args['train']) == 1:
        model.train()
    if int(args['eval']) == 1:
        model.evaluate()
    model.close()
def main():
    flags['seed'] = 1234

    # Parse Arguments
    parser = argparse.ArgumentParser(description='Faster R-CNN Networks Arguments')
    parser.add_argument('-n', '--run_num', default=0)  # Saves all under /save_directory/model_directory/Model[n]
    parser.add_argument('-e', '--epochs', default=1)  # Number of epochs for which to train the model
    parser.add_argument('-r', '--restore', default=0)  # Binary to restore from a model. 0 = No restore.    
    parser.add_argument('-m', '--model_restore', default=1)  # Restores from /save_directory/model_directory/Model[n]
    parser.add_argument('-f', '--file_epoch', default=1)  # Restore filename: 'part_[f].ckpt.meta'
    parser.add_argument('-s', '--slim', default=1)  # Binary to restore a TF-Slim Model. 0 = No eval.
    parser.add_argument('-t', '--train', default=1)  # Binary to train model. 0 = No train.
    parser.add_argument('-v', '--eval', default=1)  # Binary to evalulate model. 0 = No eval.
    parser.add_argument('-y', '--yaml', default='pascal_voc2007.yml')  # YAML file to override config defaults
    parser.add_argument('-l', '--learn_rate', default=1e-3)  # learning Rate 
    parser.add_argument('-i', '--vis', default=0)  # enable visualizations
    parser.add_argument('-g', '--gpu', default=0)  # specifiy which GPU to use
    args = vars(parser.parse_args())

    # Set Arguments
    flags['run_num'] = int(args['run_num'])
    flags['num_epochs'] = int(args['epochs'])
    
    flags['restore_num'] = int(args['model_restore'])
    flags['file_epoch'] = int(args['file_epoch'])
    
    if args['restore'] == 0:
        flags['restore'] = False
    else:
        flags['restore'] = True
        flags['restore_file'] = 'part_' + str(args['file_epoch']) + '.ckpt.meta'
        flags['restore_slim_file'] = None

    if args['yaml'] != 'default': 
        dictionary = cfg_from_file('cfgs/' + args['yaml'])
        print('Restoring from %s file' % args['yaml'])
    else:
        dictionary = []
        print('Using Default settings')
        
    flags['learning_rate'] = float(args['learn_rate'])
    flags['vis'] = True if (int(args['vis']) == 1) else False
    flags['gpu'] = int(args['gpu'])
    
    update_flags()
    
    model = FasterRcnnRes50(flags, dictionary)
    if int(args['train']) == 1:
        model.train()
    if int(args['eval']) == 1:
        model.evaluate()
    model.close()
Beispiel #3
0
def main():
    # Parse Arguments
    parser = argparse.ArgumentParser(description='PASCAL_VOC Arguments')
    parser.add_argument('-n', '--year', default='2007')
    parser.add_argument(
        '-y', '--yaml',
        default='pascal_voc2007.yml')  # YAML file to override config defaults
    args = vars(parser.parse_args())

    if args['yaml'] != 'default':
        dictionary = cfg_from_file('../../Models/cfgs/' + args['yaml'])
        print('Restoring from %s file' % args['yaml'])
    else:
        dictionary = []
        print('Using Default settings')

    gen_Annotations_dir(args['year'])
    gen_Images_dir(args['year'])
    gen_Names_dir(args['year'])