Exemple #1
0
    # meta data
    data = extract_data.object_data()

    # config
    cfg = data.cfg
    utils.saveConfig(cfg)
    hoi_mapping = data.hoi_labels

    # data
    genTrain = DataGenerator(imagesMeta=data.trainGTMeta,
                             cfg=cfg,
                             data_type='train',
                             do_meta=False)

    # models
    Models = methods.AllModels(cfg, mode='train', do_hoi=True)
    _, _, model_hoi = Models.get_models()

    sys.stdout.flush()

    #if False:
    # train
    callbacks = [callbacks.MyModelCheckpointInterval(cfg), \
                 callbacks.MyLearningRateScheduler(cfg), \
                 callbacks.MyModelCheckpointWeightsInterval(cfg),\
                 callbacks.SaveLog2File(cfg), \
                 callbacks.PrintCallBack()]

    if cfg.dataset == 'TUPPMI':
        model_hoi.fit_generator(generator = genTrain.begin(), \
                    steps_per_epoch = genTrain.nb_batches, \
Exemple #2
0
    # Create batch generators
    genTrain = DataGenerator(imagesMeta=data.trainGTMeta,
                             cfg=cfg,
                             data_type='train',
                             do_meta=True,
                             mode='test')
    genVal = DataGenerator(imagesMeta=data.valGTMeta,
                           cfg=cfg,
                           data_type='val',
                           do_meta=True,
                           mode='test')
    #    genTest = DataGenerator(imagesMeta = data.testGTMeta, cfg=cfg, data_type='test', do_meta=True)

    Models = methods.AllModels(cfg,
                               mode='test',
                               do_rpn=False,
                               do_det=True,
                               do_hoi=False)
    Stages = stages.AllStages(cfg,
                              Models,
                              obj_mapping,
                              hoi_mapping,
                              mode='test')

# Val data
evalVal = det_test.saveEvalData(genVal, Stages, cfg, obj_mapping)
det_test.saveEvalResults(genVal, cfg)

# Test data
#evalTest = det_test.saveEvalData(genTest, Stages, cfg, obj_mapping)
#det_test.saveEvalResults(evalTest, genTest, cfg)
Exemple #3
0
if True:
    # meta data
    data = extract_data.object_data()

    # config
    cfg = data.cfg
    obj_mapping = data.class_mapping

    # data
    genTrain = DataGenerator(imagesMeta=data.trainGTMeta,
                             cfg=cfg,
                             data_type='train',
                             do_meta=False)
    genVal = DataGenerator(imagesMeta=data.valGTMeta,
                           cfg=cfg,
                           data_type='val',
                           do_meta=False)

    # models
    Models = methods.AllModels(cfg,
                               mode='train',
                               do_rpn='rpn' in cfg.my_results_dir,
                               do_det='det' in cfg.my_results_dir,
                               do_hoi='hoi' in cfg.my_results_dir)
    sys.stdout.flush()

    #if False:
    # Save stuff
    Models.save_model(only_weights=True)

    print('Path:', cfg.my_results_path)