diff --git a/answer_classifier_cached_features/eval.py b/answer_classifier_cached_features/eval.py index 0f6b0debfcfe79bd6bbf2d01b12dc6f032831997..09d5e6da153a16570edafad3c50588318926cfcf 100644 --- a/answer_classifier_cached_features/eval.py +++ b/answer_classifier_cached_features/eval.py @@ -38,16 +38,23 @@ def create_initializer(graph, sess, model): return initializer() def create_batch_generator(mode): - if mode=='val': + if mode=='val_subset': vqa_resnet_feat_dir = constants.vqa_val_resnet_feat_dir vqa_anno = constants.vqa_val_anno - num_questions = constants.num_val_questions + num_questions = constants.num_val_subset_questions + offset = 0 + elif mode=='val_rest': + vqa_resnet_feat_dir = constants.vqa_val_resnet_feat_dir + vqa_anno = constants.vqa_val_anno + num_questions = constants.num_val_rest_questions + offset = constants.num_val_subset_questions elif mode=='train': vqa_resnet_feat_dir = constants.vqa_train_resnet_feat_dir vqa_anno = constants.vqa_train_anno num_questions = constants.num_train_questions + offset = 0 else: - print "mode needs to be one of {'train','test','val'}, found " + mode + print "mode needs to be one of {'train','val_subset','val_rest'}, found " + mode data_mgr = vqa_data.data( vqa_resnet_feat_dir, @@ -63,7 +70,7 @@ def create_batch_generator(mode): constants.answer_batch_size, num_questions, 1, - 0) + offset) batch_generator = tftools.data.async_batch_generator( data_mgr, @@ -266,7 +273,10 @@ if __name__=='__main__': training=False) print 'Starting a session...' - sess = tf.Session(graph=graph.tf_graph) + config = tf.ConfigProto() + config.gpu_options.allow_growth = True + config.gpu_options.per_process_gpu_memory_fraction = 0.5 + sess = tf.Session(config=config, graph=graph.tf_graph) print 'Creating initializer...' initializer = create_initializer( diff --git a/constants_vision_gpu_2.py b/constants_vision_gpu_2.py index 1768b59c93fd4deee45c37c987de5fcd14b6f7d7..1764eb4dc450ce2fcd977c67ac5f1f4176a93649 100644 --- a/constants_vision_gpu_2.py +++ b/constants_vision_gpu_2.py @@ -153,7 +153,9 @@ vqa_answer_vocab_json = os.path.join( # VQA dataset params num_train_questions = 248349 -num_val_questions = 10000 #121512 +num_val_subset_questions = 10000 +num_val_questions = 121512 +num_val_rest_questions = num_val_questions - num_val_subset_questions num_test_questions = 0 # Answer classifier training params