densecap-tensorflow icon indicating copy to clipboard operation
densecap-tensorflow copied to clipboard

about context feature in code

Open binerone opened this issue 4 years ago • 0 comments

Hi. When reading your code, I confused that why the context feature is implemented as in the code: $ROOT/lib/nets/network/py line:340

 global_feature, region_features = tf.split(region_features, [1, -1], axis=0)

around codes as follows

        region_features = slim.fully_connected(fc7, cfg.EMBED_DIM,
                                              weights_initializer=initializer,
                                              trainable=is_training,
                                              activation_fn=None, scope='region_features')
        if cfg.CONTEXT_FUSION:
            # global_feature [1, cfg.EMBED_DIM(512)]
            global_feature, region_features = tf.split(region_features, [1, -1], axis=0)
            batch_size = tf.shape(region_features)[0]
            # global_feature_rep [batch_size(256), cfg.EMBED_DIM(512)]
            global_feature_rep = tf.tile(global_feature, [batch_size, 1])
            gfeat_lstm_cell = rnn.BasicLSTMCell(cfg.EMBED_DIM, forget_bias=1.0,
                state_is_tuple=True)
        else:
            batch_size = tf.shape(region_features)[0]

I do not understand why $region_features$ contain the $global_feature$ in the axis 0?

thanks a lot.

binerone avatar Jul 05 '20 01:07 binerone