Closed manoj652 closed 4 years ago
@manoj652 Looks like the sub-graph replacement configuration file that you specified with the --tensorflow_object_detection_api_pipeline_config command line parameter is not suitable for your version of the FasterRCNN topology. Could you re-run the Model Optimizer with the --log_level DEBUG command line option and attach the log file?
@lazarevevgeny
--log_level DEBUG SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ChangeCoordinateFrame/truediv1/mul SecondStagePostprocessor/scalelogits/reciprocal SecondStagePostprocessor/scalelogits/mul [ ERROR ] Found the following nodes '[]' with name 'swapped_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalAndROIPoolingReplacement replacement didn't work. [ 2018-11-15 21:55:55,244 ] [ DEBUG ] [ main:327 ] Traceback (most recent call last): File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/main.py", line 321, in main return driver(argv) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/main.py", line 263, in driver mean_scale_values=mean_scale) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 171, in tf2nx class_registration.apply_replacements(graph, class_registration.ClassType.FRONT_REPLACER) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 102, in apply_replacements replacer.find_and_replace_pattern(graph) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/front/tf/replacement.py", line 91, in find_and_replace_pattern self.replace_sub_graph(graph, match) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/mo/front/common/replacement.py", line 115, in replace_sub_graph new_sub_graph = self.generate_sub_graph(graph, match) File "/home/manojvasi/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/extensions/front/tf/ObjectDetectionAPI.py", line 261, in generate_sub_graph format(proposal_nodes_ids)) mo.utils.error.Error: Found the following nodes '[]' with name 'swapped_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalAndROIPoolingReplacement replacement didn't work.
@lazarevevgeny
the entire --log_level DEBUG
@manoj652 @lazarevevgeny i am also getting same error "mo.utils.error.Error: Found the following nodes '[]' with name 'swapped_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalAndROIPoolingReplacement replacement didn't work."
I ran the below command.
python3 mo_tf.py --input_model tensorflow_faster_rcnn_resnet_frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support_api_v1.7.json --tensorflow_object_detection_api_pipeline_config pipeline.config
Logs are same as @manoj652
@roburst2 @lazarevevgeny i was able to convert the tensorflow community models to ir format but when we use those pretrained models i was able to convert mobilenetssdv2 which was custom trained also converted
but for fasterrcnn i am getting this error
@manoj652 with the same command were you able to convert? and i am trying to convert the fasterrcnn which custom trained
@roburst2 iam not able to convert fasterrcnn_inceptionv2 custom trained model
apart from fasterrcnn i can able to convert mobilenetssdv2
@manoj652 @roburst2 please, wait for the repo update or download the OpenVINO 2018R4 package https://software.intel.com/en-us/openvino-toolkit/ with the fix.
@lazarevevgeny I am using *Converting TensorFlow Object Detection API Models 2018 R4 release only.I am using the below command and getting error "[ ERROR ] Found the following nodes '[]' with name 'swapped_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalAndROIPoolingReplacement replacement didn't work**"
python3 mo_tf.py --input_model=/home/hasmeet/Subin/faster_rcnn_resnet/models/research/fine_tuned_model/frozen_inference_graph.pb --tensorflow_use_custom_operations_config=/opt/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config=/home/hasmeet/Subin/faster_rcnn_resnet/models/research/pretrained/faster_rcnn_resnet101/faster_rcnn_resnet.config
@roburst2 could you try 'faster_rcnn_support_api_v1.7.json'?
@lazarevevgeny i tried with this one also. it is giving same error. Please let me know the reason behind this issue
@roburst2 could you run the MO with --log_level DEBUG and attach generated output?
@lazarevevgeny
logleveldebug.txt
@roburst2 you can try to debug the issue yourself. Open the 'faster_rcnn_support_api_v1.7.json', find description of the ObjectDetectionAPIProposalReplacement
. Take a look at the graph in the TensorBoard and check that all nodes mentioned in the "start_points" and "end_points" arrays exist. If no, then find where these nodes are located in the pre-trained models from the TF models repo and find analogue in your model.
@manoj652 I see in the log the following error:
[ 2018-11-15 21:55:55,037 ] [ DEBUG ] [ class_registration:100 ] Run replacer <class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIProposalAndROIPoolingReplacement'> [ INFO ] Node "CropAndResize" does not exist in the graph. Failed to match sub-graph by points "ObjectDetectionAPIProposalAndROIPoolingReplacement".
Find node of type CropAndResize in your model and update the json file with that name.
Executed this command: python3 mo_tf.py --input_model=<fine_tuned_model1/frozen_inference_graph.pb> --tensorflow_use_custom_operations_config=/opt/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support_api_v1.7.json --tensorflow_object_detection_api_pipeline_config=<fine_tuned_model/pipeline.config> --log_level=DEBUG
Debug log file: logleveldebugroburst2.txt
@roburst2 you have the same issue as @manoj652 . Please, try to find correct name for the CropAndResize operation in your graph and update the json file with that name.
@lazarevevgeny could you tell me frrom where i can find the name for CropAndResize and update. can you elaborate.
@roburst2 @lazarevevgeny
@roburst2 the file that you specified with the --tensorflow_use_custom_operations_config command line parameter: /opt/intel/computer_vision_sdk_2018.3.343/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support_api_v1.7.json
@lazarevevgeny @roburst2 i changed in config file_api.1.7.json file i am still getting the error @lazarevevgeny any suggestions
The name of the node is "CropAndResize/CropAndResize" and not "CropAndResize" (this is the name of the scope). And this will probably not work with the 2018R3 release which you use.
@lazarevevgeny where is this "CropAndResize/CropAndResize" in faster_rcnn_support_api_v1.7.json
do i need to use 2018R4 if yes where to change in the 1.7.json file
Json file
Graph file
@lazarevevgeny @manoj652 I have tried and getting same error.
I am using 2018R4 release
@manoj652 you need 2018R4 to get updates of the MO scripts converting these models.
@roburst2 you have updated the file correctly. Could you take a look at the log file (generated with the --log_level DEBUG command line) for the string "Run replacer <class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIProposalAndROIPoolingReplacement'>"? It will show you why the replacer didn't work.
@roburst2 did u tried in 2018R4
@manoj652 @lazarevevgeny I was also using 2018R3. I will install and try again
@manoj652 @lazarevevgeny I tried with 2018R4 and now getting this error
mo.utils.error.Error: Exception occurred during running replacer "ObjectDetectionAPIDetectionOutputReplacement": Found the following nodes '[]' with name 'proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work
logfile: loglevelR4.txt
@lazarevevgeny i installed R4 version i tried i am getting new error
--loglevel_debug
[ 2018-11-19 18:48:49,974 ] [ DEBUG ] [ infer:133 ] --------------------
[ 2018-11-19 18:48:49,974 ] [ DEBUG ] [ infer:134 ] Partial infer for stack3/Concat
[ 2018-11-19 18:48:49,974 ] [ DEBUG ] [ infer:135 ] Op: Concat
[ 2018-11-19 18:48:49,975 ] [ DEBUG ] [ infer:146 ] Inputs:
[ 2018-11-19 18:48:49,976 ] [ DEBUG ] [ infer:39 ] input[0]: shape = [1], value = [300]
[ 2018-11-19 18:48:49,976 ] [ DEBUG ] [ infer:39 ] input[1]: shape = [1], value = [14]
[ 2018-11-19 18:48:49,976 ] [ DEBUG ] [ infer:39 ] input[2]: shape = [1], value = [14]
[ 2018-11-19 18:48:49,977 ] [ DEBUG ] [ infer:39 ] input[3]: shape = [1], value = [576]
[ 2018-11-19 18:48:49,977 ] [ DEBUG ] [ infer:148 ] Outputs:
[ 2018-11-19 18:48:49,977 ] [ DEBUG ] [ infer:39 ] output[0]: shape = [4], value = [300 14 14 576]
[ 2018-11-19 18:48:49,977 ] [ DEBUG ] [ infer:133 ] --------------------
[ 2018-11-19 18:48:49,977 ] [ DEBUG ] [ infer:134 ] Partial infer for Reshape_5
[ 2018-11-19 18:48:49,978 ] [ DEBUG ] [ infer:135 ] Op: Reshape
[ ERROR ] Number of elements in input [ 1 100 14 14 576] and output [300, 14, 14, 576] of reshape node Reshape_5 mismatch
[ 2018-11-19 18:48:49,979 ] [ DEBUG ] [ infer:146 ] Inputs:
[ 2018-11-19 18:48:49,979 ] [ DEBUG ] [ infer:39 ] input[0]: shape = [ 1 100 14 14 576], value =
[ ERROR ] It can happen due to bug in custom shape infer function <function tf_reshape_ext.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/main.py", line 325, in main
return driver(argv)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/main.py", line 267, in driver
mean_scale_values=mean_scale)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 230, in tf2nx
partial_infer(graph)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 200, in partial_infer
refer_to_faq_msg(38)) from err
mo.utils.error.Error: Stopped shape/value propagation at "Reshape_5" node.
For more information please refer to Model Optimizer FAQ (
@lazarevevgeny as given in the log "[ INFO ] Node "map_1/TensorArrayStack/TensorArrayGatherV3" does not exist in the graph. Failed to match sub-graph by points "ObjectDetectionAPIProposalReplacement""
How can i add this node in a graph file
@roburst2 use tensorboard to see the graph and the find cropsize u will see input and output tensors
i guess mostly it will be like this "map/TensorArrayStack/TensorArrayGatherV3"
@lazarevevgeny @roburst2 i fixed it by using older fasterrcnn model config file trained it with my data and used R4 openvino this is not working guys
@manoj652 can you send me the fasterrcnn config file which you have used.
pipeline.txt @roburst2 my config file is fasterrcnn_inceptionv2 if u use fasterrcnnresnet use old modelsmaster github pipelineconfig
Thanks @manoj652 i will try with the old fasterrcnnresnet config
@manoj652 which tensorflow github commit you used for old config file? Because the config file in models/research/object_detection/samples/config in latest commit is giving the same error.
Also did you retrain the model? Or you have passed the downloaded one?
@roburst2 download the fasterrcnnresnet from modelzoo repo whch was already trained on coco then use that that config file for u r neww training model
@lazarevevgeny @roburst2 i am still getting the error i thought i converted
odel Optimizer version: 1.4.292.6ef7232d
[ WARNING ] Model Optimizer removes pre-processing block of the model which resizes image keeping aspect ratio. The Inference Engine does not support dynamic image size so the Intermediate Representation file is generated with the input image size of a fixed size.
Specify the "--input_shape" command line parameter to override the default shape which is equal to (600, 600).
The Preprocessor block has been removed. Only nodes performing mean value subtraction and scaling (if applicable) are kept.
The graph output nodes "num_detections", "detection_boxes", "detection_classes", "detection_scores" have been replaced with a single layer of type "Detection Output". Refer to IR catalogue in the documentation for information about this layer.
[ ERROR ] Cannot infer shapes or values for node "ToFloat_3".
[ ERROR ] NodeDef mentions attr 'Truncate' not in Op<name=Cast; signature=x:SrcT -> y:DstT; attr=SrcT:type; attr=DstT:type>; NodeDef: ToFloat_3 = CastDstT=DT_FLOAT, SrcT=DT_UINT8, Truncate=false. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function tf_native_tf_node_infer at 0x7fe07f1dfd90>.
[ ERROR ] Or because the node inputs have incorrect values/shapes.
[ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information.
[ ERROR ] Stopped shape/value propagation at "ToFloat_3" node.
For more information please refer to Model Optimizer FAQ (
@lazarevevgeny @roburst2 __loglevedebug
tensorflow.python.framework.errors_impl.InvalidArgumentError: NodeDef mentions attr 'Truncate' not in Op<name=Cast; signature=x:SrcT -> y:DstT; attr=SrcT:type; attr=DstT:type>; NodeDef: ToFloat_3 = CastDstT=DT_FLOAT, SrcT=DT_UINT8, Truncate=false. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 136, in partial_infer node.infer(node) File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/front/tf/partial_infer/tf.py", line 60, in tf_native_tf_node_infer tf_subgraph_infer(tmp_node) File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/front/tf/partial_infer/tf.py", line 135, in tf_subgraph_infer all_constants, output_tensors = get_subgraph_output_tensors(node) File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/front/tf/partial_infer/tf.py", line 115, in get_subgraph_output_tensors tf.import_graph_def(graph_def, name='') File "/home/manojvasi/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func return func(*args, **kwargs) File "/home/manojvasi/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 422, in import_graph_def raise ValueError(str(e)) ValueError: NodeDef mentions attr 'Truncate' not in Op<name=Cast; signature=x:SrcT -> y:DstT; attr=SrcT:type; attr=DstT:type>; NodeDef: ToFloat_3 = CastDstT=DT_FLOAT, SrcT=DT_UINT8, Truncate=false. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/main.py", line 325, in main
return driver(argv)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/main.py", line 267, in driver
mean_scale_values=mean_scale)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 230, in tf2nx
partial_infer(graph)
File "/home/manojvasi/intel/computer_vision_sdk_2018.4.420/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 200, in partial_infer
refer_to_faq_msg(38)) from err
mo.utils.error.Error: Stopped shape/value propagation at "ToFloat_3" node.
For more information please refer to Model Optimizer FAQ (
@manoj652 try to install the latest version of the TF (1.11 or 1.12).
@manoj652 I am able to convert with the faster_rcnn_resnet101_coco
@lazarevevgeny tensorlfow 1.12 is not supporting its asking me to install above tensorflow 1.2
right now i am running tensorflow 1.10 for 3000 steps i was able to covert the same model but for 36000 steps same model is throwing these errors
@roburst2 put config file of faster_rcnn_resnet101_coco which u converted to ir format
@roburst2 did u converted in OPENVINO R4 ,how many steps u trained ,can u tell me the checkpoints of frozengraph.pb
yes i converted in OPENVINO R4 and for 10000 steps i trained
@roburst2 i am getting same error for fasterrcnn_resnet which tensorflow version u used to convert
Metadata-Version: 2.0 Name: tensorflow Version: 1.9.0
Metadata-Version: 2.0 Name: tensorflow-gpu Version: 1.4.0
could u send u r mail id i may send my frozengraph to see if it able to convert in ur machine
i tried with both fastercnn resent and fasterrcnn inception i may abl e to convert the files in ir format for 5000 steps but after that i am getting an error i trained my model upto 33500 steps i can t able to converti tried with both r3 and r4 openvino with tensorflow 1.9 cpu
dldt The Preprocessor block has been removed. Only nodes performing mean value subtraction and scaling (if applicable) are kept.
[ ERROR ] Found the following nodes '[]' with name 'swapped_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalAndROIPoolingReplacement replacement didn't work.