serving
serving copied to clipboard
Is it possible to return different layers from model?
Is there a (hack) way for return different layers result from serving?
For example: Module 2

- If want to return F7 (4096 nodes), not the final layer F8 (1000 nodes), is it possible?
- If want to return both F7 and Latent Layer(H), how to handle it?
Update:
SavedModelBuilder has method add_meta_graph_and_variables, which use meta_graph_pb2, might be there are some way that using graph_pb2?
Different layers can be easily retrieved if the activations have been collected and returned, e.g., end_points in inceptions models
net, end_points = inception.inception_v3(inputs, num_classes, is_training=False)
net7 = end_points["Mixed_7c"]
It could also be acquired by get_tensor_by_name with naming, for example,
prediction = sess.graph.get_tensor_by_name("InceptionV3/Logits/Predictions:0")
Then, multiple tensors can be appended to outputs in the model exporter
'outputs': exporter.generic_signature({
'prediction': prediction,
'net': net,
'net7': net7
})
@moonite Great! It makes sense. Thanks!