CNTK-FastRCNNDetector
CNTK-FastRCNNDetector copied to clipboard
Prepare self trained model for evaluation
Hey everybody,
I'm currently following this tutorial (https://github.com/Microsoft/CNTK/blob/master/Examples/Image/Detection/FastRCNN/BrainScript/CNTK_FastRCNN_Eval.ipynb) to implement a Fast RCNN Evaluator and for the grocery model everything worked fine. Now I want to run the script with my model, which I trained on my own data. The problem is that the structure of the model is different to the pretrained grocery model and as I'm still a beginner with CNTK I don't know who to convert it to the right structure.
The following informations of the structure of the different models are just print(model).
print(grocery-model):
Before preparation: Composite(features: SequenceOver[][Tensor[3,1000,1000]], rois: SequenceOver[][Tensor[100,4]], roiLabels: SequenceOver[][Tensor[100,17]]) -> Tuple[SequenceOver[][Tensor[100,1]], SequenceOver[][Tensor[1,1]], SequenceOver[][Tensor[100,17]]]
After preparation: Composite(features: Sequence[Tensor[3,1000,1000]], rois: Sequence[Tensor[100,4]]) -> Sequence[Tensor[100,17]]
print(my-model):
Before preparation: Composite(data: Tensor[3,850,850], roi_proposals: Tensor[200,4]) -> Tuple[Tensor[200,7], Tensor[200,28]]
Any ideas or suggestions are appreciated.
Update I think I got a part of it this is my code to convert the input:
# load trained model
trained_frcnn_model = load_model(modelPath)
# find the original features and rois input nodes
features_node = find_by_name(trained_frcnn_model, "data")
rois_node = find_by_name(trained_frcnn_model, "rois_proposal")
# find the output "z" node
z_node = find_by_name(trained_frcnn_model, 'drop7')
# define new input nodes for the features (image) and rois
image_input = input_variable(shape=(3,850,850), name='features')
roi_input = input_variable(shape=(200,4), name='rois')
# Clone the desired layers with fixed weights and place holder for the new input nodes
cloned_nodes = combine([z_node.owner]).clone(
CloneMethod.freeze,
{features_node: placeholder(name='features'), rois_node: placeholder(name='rois')})
# apply the cloned nodes to the input nodes
self.model = cloned_nodes(image_input, roi_input)
print("Model loaded successfully!")
But I still don't know about the z output node because I'm pretty sure drop7 is the wrong one but it can't find a z node.