I would like to know how can I extract the feature map of a mobilenet trained on tensorflow object detection API. I want to take that feature map in order to feed another classifier. Thanks!


1 Answer 1

import tensorflow as tf

# Sample frozen model
MODEL = "frozen_inference_graph.pb"

# An existing operation from the frozen model
OP_NAME = "WeightSharedConvolutionalBoxPredictor/BoxPredictionTower/conv2d_2/BatchNorm/feature_0/beta/read/_360__cf__363"

# Load the graph from the frozen model
detection_graph = tf.Graph()
with detection_graph.as_default():
    od_graph_def = tf.GraphDef()
    with tf.gfile.GFile(MODEL, 'rb') as fid:
        serialized_graph = fid.read()
        tf.import_graph_def(od_graph_def, name='')

# print all operations
for op in detection_graph.get_operations():

# print tensor ( without :0 you will get the operation itself )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.