From ab98b61fd444a3c3e3b69160c6fc9e1b41377b5a Mon Sep 17 00:00:00 2001 From: tgupta6 <tgupta6@illinois.edu> Date: Fri, 30 Sep 2016 15:35:10 -0500 Subject: [PATCH] l2 on word vectors and put back relu and bn in obj atr network --- constants_vision_gpu_1.py | 6 +++--- .../eval.py | 4 ++-- .../inference.py | 16 ++++++++-------- word2vec/word_vector_management.py | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/constants_vision_gpu_1.py b/constants_vision_gpu_1.py index f3d87f0..dd75d16 100644 --- a/constants_vision_gpu_1.py +++ b/constants_vision_gpu_1.py @@ -5,7 +5,7 @@ def mkdir_if_not_exists(dir_name): if not os.path.exists(dir_name): os.mkdir(dir_name) -experiment_name = 'obj_atr_through_ans_mil' +experiment_name = 'obj_atr_through_ans_mil_wordvecl2' #experiment_name = 'object_attribute_classifier_large_images' # Global output directory (all subexperiments will be saved here) global_output_dir = '/data/tanmay/GenVQA_Exp_Results' @@ -121,7 +121,7 @@ region_fine_tune_from_iter = 3000 region_fine_tune_from = region_model + '-' + str(region_fine_tune_from_iter) # Object Attribute Classifier Evaluation Params -region_eval_on = 'val' # One of {'val','test','train'} +region_eval_on = 'train_held_out' # One of {'train_subset','train_held_out','test'} region_model_to_eval = region_model + '-' + '77500' region_attribute_scores_dirname = os.path.join( @@ -214,7 +214,7 @@ answer_fine_tune_from = answer_model + '-' + str(answer_fine_tune_from_iter) # Answer eval params answer_eval_on = 'val' -answer_model_to_eval = answer_model + '-69500' +answer_model_to_eval = answer_model + '-55000' answer_eval_data_json = os.path.join( answer_output_dir, diff --git a/object_attribute_classifier_cached_features/eval.py b/object_attribute_classifier_cached_features/eval.py index 17ccfe9..5b51587 100644 --- a/object_attribute_classifier_cached_features/eval.py +++ b/object_attribute_classifier_cached_features/eval.py @@ -291,8 +291,8 @@ if __name__=='__main__': initializer = create_initializer( graph, sess, - constants.pretrained_model) - #constants.answer_model_to_eval) + #constants.pretrained_model) + constants.answer_model_to_eval) #constants.region_model_to_eval) print 'Creating feed dict creator...' diff --git a/object_attribute_classifier_cached_features/inference.py b/object_attribute_classifier_cached_features/inference.py index 8a1887f..84b52cf 100644 --- a/object_attribute_classifier_cached_features/inference.py +++ b/object_attribute_classifier_cached_features/inference.py @@ -78,10 +78,10 @@ class ObjectAttributeInference(): out_dim, 'fc', func = None) - # fc2_out = layers.batch_norm( - # fc2_out, - # tf.constant(self.training)) - # fc2_out = tf.nn.relu(fc2_out) + fc2_out = layers.batch_norm( + fc2_out, + tf.constant(self.training)) + fc2_out = tf.nn.relu(fc2_out) return fc2_out @@ -108,10 +108,10 @@ class ObjectAttributeInference(): out_dim, 'fc', func = None) - # fc2_out = layers.batch_norm( - # fc2_out, - # tf.constant(self.training)) - # fc2_out = tf.nn.relu(fc2_out) + fc2_out = layers.batch_norm( + fc2_out, + tf.constant(self.training)) + fc2_out = tf.nn.relu(fc2_out) return fc2_out diff --git a/word2vec/word_vector_management.py b/word2vec/word_vector_management.py index cfeb8b7..73f15e8 100644 --- a/word2vec/word_vector_management.py +++ b/word2vec/word_vector_management.py @@ -43,6 +43,7 @@ class word_vector_manager(): 'word_vec_fc2', func = None) + tf.add_to_collection('to_regularize',word_vecs_fc2) return word_vecs_fc2 def init_word_vector_tensor(self): -- GitLab