issue met when try to load mask rcnn model with dnn module

asked 2018-09-19 23:53:13 -0600

Hi guys, When tried to load mask rcnn model(Mask-RCNN Inception v2 from tensorflow model zoo, also listed on OpenCV github wiki), I've met this issue: msk_net = dnn.readNet(msknet_model, msknet_config) cv2.error: OpenCV(3.4.2) /io/opencv/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp:659: error: (-215:Assertion failed) !field.empty() in function 'getTensorContent'

i thought it could be caused by *.pbtxt not right, so re-generate that config file as follow: python3 tf_text_graph_mask_rcnn.py --input ./mask_rcnn_inception_v2_coco_2018_01_28/frozen_inference_graph.pb --config ./mask_rcnn_inception_v2_coco_2018_01_28/pipeline.config --output ./mask_rcnn_inception_v2_coco_2018_01_28/graph.pbtxt

Number of classes: 90 Scales: [0.25, 0.5, 1.0, 2.0] Aspect ratios: [0.5, 1.0, 2.0] Width stride: 16.000000 Height stride: 16.000000 Features stride: 16.000000 2018-09-20 11:49:14.170689: I tensorflow/tools/graph_transforms/transform_graph.cc:318] Applying sort_by_execution_order

but still the same issue is there.

then I noticed that there is another might-be options: to simplify the *.pb file or fuse constant nodes, like below, even though i am not sure it could fix my issue or not: python ~/tensorflow/tensorflow/python/tools/optimize_for_inference.py \ --input frozen_inference_graph.pb \ --output opt_graph.pb \ --input_names image_tensor \ --output_names "num_detections,detection_scores,detection_boxes,detection_classes" \ --placeholder_type_enum 4 \ --frozen_graph

yet i have some confusion on that output_names argument: for mask rcnn, would those 4 output names be enough? if not, what those should be?

Could any buddy please help me on this? Thank you so much~~~

edit retag flag offensive close merge delete

Comments

Mask rcnn has been added in OpenCV 3.4.3. Please use scripts from your local version of library but not from master branch.

dkurt gravatar imagedkurt ( 2018-09-20 00:13:34 -0600 )edit
1

@dkurt it works!!! thank you so much~ (^o^)/

JustJason gravatar imageJustJason ( 2018-09-20 00:43:54 -0600 )edit