Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6490 Discussions

yolo_v3 tiny model shows different result with darknet one

ininder__gg
Beginner
1,611 Views

hi sir,

    I want to something similar to "Build a Safety Gear Detector" demo. And I find some ready-to-use yolov3_tiny model in darknet here

I use the command to convert to darknet model to tensorflow one

sudo python3 ./convert_weights_pb.py --class_names ~/hardhat.names --data_format NHWC --weights_file ~/yolov3-tiny_final.weights --tiny

 

and use the command to convert tensorflow model to openvino one

sudo python3 mo_tf.py --input_model ~/hardHat.pb --tensorflow_use_custom_operations_config /opt/intel/openvino/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3_tiny.json --batch 1 --data_type FP32

 

And the yolo_v3_tiny.json is look like:

 

[
  {
    "id": "TFYOLOV3",
    "match_kind": "general",
    "custom_attributes": {
      "classes": 5,
      "anchors": [10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319],
      "coords": 4,
      "num": 6,
      "masks": [[3, 4, 5], [0, 1, 2]],
      "entry_points": ["detector/yolo-v3-tiny/Reshape", "detector/yolo-v3-tiny/Reshape_4"]
    }
  }
]

However, the result in openvino is different from the original model by using the Opencv dnn

as in the image, the left image is result of darknet model by using Opencv dnn module, the right image is the model converted to openvino and use the yolov3 demo program in open_model_zoo. The converted openvino model can only show result of label 0. And In this example it shows nothing.

 

What should I do now?

0 Kudos
1 Solution
JesusE_Intel
Moderator
1,611 Views

Hi ininder, gg,

Try adding the --reverse_input_channels to the model optimizer command. This is the command I used with my custom trained model from darknet.

python3 <OpenVINO>/deployment_tools/model_optimizer/mo_tf.py --input_model frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config
yolov3_tiny_custom.json --batch 1 --data_type FP32 --reverse_input_channels

Regards,

Jesus

View solution in original post

0 Kudos
3 Replies
JesusE_Intel
Moderator
1,612 Views

Hi ininder, gg,

Try adding the --reverse_input_channels to the model optimizer command. This is the command I used with my custom trained model from darknet.

python3 <OpenVINO>/deployment_tools/model_optimizer/mo_tf.py --input_model frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config
yolov3_tiny_custom.json --batch 1 --data_type FP32 --reverse_input_channels

Regards,

Jesus

0 Kudos
ininder__gg
Beginner
1,611 Views

hi sir,

after use the --reverse_input_channels command it works fine now

thank you!

0 Kudos
JesusE_Intel
Moderator
1,611 Views

Hi ininder, gg,

Glad this worked for you! Feel free to reach out again if you have additional questions.

Regards,

Jesus

0 Kudos
Reply