Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ininder__gg
Beginner
131 Views

problem in editing the masks parameter in json file for the mo_tf.py

hi,

   I'm following the document and trying to convert the darknet yolo_v3 tiny model to TensorFlow, then convert the Tensorflow model to openvino model.

  now I'm doing the mo_tf.py step. there is a yolo_v3_tiny.json file and the mask is 

     "masks": [[3, 4, 5], [0, 1, 2]],

According to the document, I have to edit it based on the *.cfg of my original darknet, since in my *.cfg the mask is only

mask = 0,1,2

 

However, no matter I edit the mask in *.json file as

       "masks": [[0, 1, 2]],

or

      "masks": [0, 1, 2],

 it always shows the [error]

[ ERROR ]  Cannot infer shapes or values for node "detector/yolo-v3-tiny/Conv_12/BiasAdd/YoloRegion".
[ ERROR ]  object of type 'int' has no len()
[ ERROR ]  
[ ERROR ]  It can happen due to bug in custom shape infer function <function RegionYoloOp.regionyolo_infer at 0x7f817db88598>.
[ 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 ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "detector/yolo-v3-tiny/Conv_12/BiasAdd/YoloRegion" node. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38. 
 

The origin parameter ( "masks": [[3, 4, 5], [0, 1, 2]],  ) works fine and the detection result is not different from the one in darknet. But I still wonder how to edit the mask properly.

0 Kudos
4 Replies
Shubha_R_Intel
Employee
131 Views

Dear ininder, gg,

It seems like what you are doing is perfectly correct. You should be able to reduce the masks from "masks":[[6, 7, 8], [3, 4, 5], [0, 1, 2]] to [0,1,2].  Let me try it myself and I will report back on this forum.

Sorry for the inconvenience !

Shubha

 

Shubha_R_Intel
Employee
131 Views

Dear ininder, gg,

I have reproduced this as well and filed a bug on your behalf. Sorry for the inconvenience !

I will post updates right here on the forum.

Thanks,

Shubha

 

Evgenya_S_Intel
Employee
131 Views

Dear ininder, gg,

 

I see that you are using public YOLO tiny v3 model. It is totally correct to use yolo_v3_tiny.json without any changes.

masks parameter in json file specifies mask for each region in the yolo model, you can find it in cfg file by searching maks in [yolo] layer.  

 

Thanks, 

Evgenya

Shubha_R_Intel
Employee
131 Views

Dear ininder, gg,

Thank you for your patience. I found out that this is not a bug, but it actually stems from a Model Optimizer re-design. The actual bug is in the documentation and in the log messages - since suddenly changing the way Model Optimizer works today compared to how it used to work definitely led to customers' confusion.

Here is a summary:

  1. There is no need to change the  yolo_v3_tiny.json  masks . It is the same as we described in the docs. Everything should work for you out-of-the-box
  2. Documentation was not updated after masks parameter change, so we do have bug, but in documentation only
  3. Earlier version of .json file for YOLO had common mask parameter shared for all yolo regions, but we improved the yolo conversion pipeline and  now we specify unique values for each region by using mask*s* parameter. It helps to translate model correctly.

Hope it helps. And thanks for your patience !

Shubha

Reply