Exemple #1
0
def main(_):
    from vqa_eval import evaluate_model, write_result_log
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            acc = test_once(model_path)
        return acc

    mode = 'ap_' if FLAGS.retrain else ''
    ckpt_dir = FLAGS.checkpoint_dir % (mode,
                                       FLAGS.version,
                                       FLAGS.model_type)
    if FLAGS.sample_negative:
        ckpt_dir += '_sn'

    if FLAGS.use_fb_data:
        ckpt_dir += '_fb'

    if FLAGS.use_fb_bn:
        ckpt_dir += '_bn'

    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
def main(_):
    from vqa_eval import evaluate_model, write_result_log
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file, quest_ids = test(model_path)
        print(res_file)
        acc, details = evaluate_model(res_file,
                                      quest_ids,
                                      version=FLAGS.version)
        write_result_log(model_path, FLAGS.model_type, acc, details)
        return acc

    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    if FLAGS.sample_negative:
        ckpt_dir += '_sn'

    if FLAGS.use_fb_data:
        ckpt_dir += '_fb'

    if FLAGS.use_fb_bn:
        ckpt_dir += '_bn'

    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #3
0
def main(_):
    from watch_model import ModelWatcher
    subset = 'kptest'
    # subset = 'kptrain'
    target_split = 'train' if 'train' in subset else 'val'

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file = ivqa_decoding_beam_search(checkpoint_path=model_path,
                                                 subset=subset)
            if FLAGS.mode == 'full':
                cider = evaluate_oracle(res_file, split=target_split)
            else:
                cider = evaluate_question_standard(res_file)

        return float(cider[1])

    #
    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    # ckpt_dir = '/import/vision-ephemeral/fl302/models/v2_kpvaq_VAQ-RL_ft/'
    # res_file = ivqa_decoding_beam_search(None,
    #                                      subset=subset)
    # print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
def main(_):
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            ap = test(model_path)
        return ap

    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #5
0
def main(_):
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            ap = test(model_path)
        return ap

    # ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    ckpt_dir = '/data1/fl302/projects/vqa2.0/model/curr_VQA-Soft-QRD-LS_Res5c'
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #6
0
def main(_):
    from watch_model import ModelWatcher
    subset = 'kpval'

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file = vaq_decoding_greedy(subset=subset)
            cider = evaluate_question(res_file, subset=subset)
        return cider

    ckpt_dir = FLAGS.checkpoint_dir % FLAGS.model_type
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #7
0
def main(_):
    from watch_model import ModelWatcher
    subset = 'kpval'

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file = ivqa_decoding_beam_search(subset=subset)
            cider = evaluate_question(res_file,
                                      subset=subset,
                                      version=FLAGS.test_version)
        return cider

    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
def main():
    from vqa_eval import evaluate_model, write_result_log
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file, quest_ids = test(model_path)
        print(res_file)
        acc, details = evaluate_model(res_file, quest_ids, version='v1')
        write_result_log(model_path, 'Fusion', acc, details)
        return acc

    ckpt_dir = FLAGS.checkpoint_dir % ('v1', 'Fusion')
    # print(ckpt_dir)
    # test_model(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #9
0
def main(_):
    from watch_model import ModelWatcher
    subset = 'kpval'

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file = ivqa_decoding_beam_search(checkpoint_path=model_path,
                                                 subset=subset)
            cider = evaluate_question(res_file,
                                      subset=subset,
                                      version=FLAGS.test_version)
        return cider

    # ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    ckpt_dir = '/import/vision-ephemeral/fl302/models/v2_kpvaq_VAQ-Mixer_ft'
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #10
0
def main(_):
    from watch_model import ModelWatcher
    subset = FLAGS.subset

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file = ivqa_decoding_beam_search(checkpoint_path=model_path,
                                                 subset=subset)
            cider = evaluate_oracle(res_file)
        return cider

    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.version, FLAGS.model_type)
    # ckpt_dir = '/import/vision-ephemeral/fl302/models/v2_kpvaq_VAQ-RL_ft/'
    # res_file = ivqa_decoding_beam_search(None,
    #                                      subset=subset)
    # print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()
Exemple #11
0
def main(_):
    from vqa_eval import evaluate_model, write_result_log
    from watch_model import ModelWatcher

    def test_model(model_path):
        with tf.Graph().as_default():
            res_file, quest_ids = test()
        print(res_file)
        acc, details = evaluate_model(res_file,
                                      quest_ids,
                                      version=FLAGS.version)
        write_result_log(model_path, FLAGS.model_type, acc, details)
        return acc

    ckpt_dir = FLAGS.checkpoint_dir % (FLAGS.model_trainset, FLAGS.model_type)
    print(ckpt_dir)
    watcher = ModelWatcher(ckpt_dir, test_model)
    watcher.run()