Got it

Yolov3 object detection Inference Atlas200DK Error!

Created: May 17, 2021 01:24:22Latest reply: May 28, 2021 09:27:55 955 13 2 0 1
  HiCoins as reward: 0 (problem unresolved)

Hello,

I trained a tensorflow Yolov3 implementation from here: https://github.com/YunYang1994/tensorflow-yolov3 and I followed all the steps for generated the .pb model for inference on coco dataset.


After that, with the ATC model conversion tool I converted the .pb to .om model with the followed command.


atc --model=yolov3_coco_shape.pb --framework=3 --output=yolov3_coco_shape --soc_version=Ascend310 --input_format=NHWC --output_type=FP32 --input_shape="input/input_data:1,416,416,3"


Then, for the inference process with the .om model I used the same pre-process and pos-process functions from the original tensorflow implementation. My script is attached with this message. (inference_yolov3.txt).

The implementation run without errors but the inference results with the .om model is unsatisfied.  


 I noted that the outputs of the model.execute function for the om model has the same dimensions that the original tensorflow implementation, however the arrays values are different. The image above shows an example


Could someone explain to me where is the error??

 

Thanks in advance for your support



om inference Error





Attachment: You need to log in to download or view. No account? Register

Featured Answers

Recommended answer

user_4147187
MVE Created May 19, 2021 02:30:04

Hello, comparing PB model and OM model, I consider whether the operator output results are too different.

If you can transform the model and reason properly, then your environment should be fine.

Inference results are not correct, according to your description may be some operators out of order.


1. Download and install depend on: https://github.com/wizyoung/YOLOv3_TensorFlow

2. Fit yolov3.weights to ~/test/ yolov3_tensorflow-master /data/darknet_weights and voc_names.txt for the training category

3. Change the number of classes in test/ yolov3_tensorflow-master convert_weigh.py and run python3 convert_weigh.py

4.~/test/ yolov3_tensorflow-master /data/darknet_weights generates 3 CKPT models and runs python3 topb.py to generate yolov3.pb model.

5. Copy aipp_yolov3_picture. CFG to the same folder as. Pb file.

omg --model ./yolov3.pb --framework 3 --output ./yolov3_facemask --insert_op_conf ./aipp_yolov3_picture.cfg --input_shape "Placeholder:1,416,416,3"

Hope I can help you.

:)

View more
  • x
  • convention:

All Answers
Could you send us your pb model to reproduce the problem?
View more
  • x
  • convention:

alex33
alex33 Created May 17, 2021 11:10:58 (0) (0)
@yaoyu1230 thanks, my pb file -> https://drive.google.com/file/d/1Fi6vxCgoeljhRv07n9omRuqP1pKZztgT/view?usp=sharing  

Hello ,,,

Thanks for your response, here is my .pb file

https://drive.google.com/file/d/1Fi6vxCgoeljhRv07n9omRuqP1pKZztgT/view?usp=sharing

View more
  • x
  • convention:

ok,we will deal with it and reply to you when we come to a conclusion.
View more
  • x
  • convention:

It has been verified that there is a difference in accuracy between the pb model and the om model, and we are locating this problems,and still we will reply to you when we come to a conclusion.
View more
  • x
  • convention:

Hello, comparing PB model and OM model, I consider whether the operator output results are too different.

If you can transform the model and reason properly, then your environment should be fine.

Inference results are not correct, according to your description may be some operators out of order.


1. Download and install depend on: https://github.com/wizyoung/YOLOv3_TensorFlow

2. Fit yolov3.weights to ~/test/ yolov3_tensorflow-master /data/darknet_weights and voc_names.txt for the training category

3. Change the number of classes in test/ yolov3_tensorflow-master convert_weigh.py and run python3 convert_weigh.py

4.~/test/ yolov3_tensorflow-master /data/darknet_weights generates 3 CKPT models and runs python3 topb.py to generate yolov3.pb model.

5. Copy aipp_yolov3_picture. CFG to the same folder as. Pb file.

omg --model ./yolov3.pb --framework 3 --output ./yolov3_facemask --insert_op_conf ./aipp_yolov3_picture.cfg --input_shape "Placeholder:1,416,416,3"

Hope I can help you.

:)

View more
  • x
  • convention:

Posted by user_4147187 at 2021-05-19 02:30 Hello, comparing PB model and OM model, I consider whether the operator output results are too diffe ...

Hello @user_4147187 , thanks for your response,

1. Can you share me the topb.py script to generate the .pb file, it is missing on the original github repository.


Best regards

View more
  • x
  • convention:

Posted by alex33 at 2021-05-19 11:02 Posted by user_4147187 at 2021-05-19 11:02 Hello, comparing PB model and OM model, I consider whe ...

import tensorflow as tf

from tensorflow.python.framework import graph_util

from tensorflow.python.platform import gfile


def freeze_graph(input_path,output_path):

output_node_names="yolov3/yolov3_head/feature_map_1,yolov3/yolov3_head/feature_map_2,yolov3/yolov3_head/feature_map_3"

saver=tf.train.import_meta_graph(input_path+".meta",clear_devices=True)

graph=tf.get_default_graph()

input_graph_def=graph.as_graph_def()


with tf.Session() as sess:

saver.restore(sess,input_path)

output_graph_def=graph_util.convert_variables_to_constants(

sess=sess,

input_graph_def=input_graph_def,

output_node_names=output_node_names.split(",")

)


with tf.gfile.GFile(output_path,'wb') as fgraph:

fgraph.write(output_graph_def.SerializeToString())


if __name__ == '__main__':

input_path ="./yolov3.ckpt"

output_path="./yolov3/yolov3.pb"

freeze_graph(input_path,output_path)


View more
  • x
  • convention:

Posted by user_4147187 at 2021-05-19 02:30 Hello, comparing PB model and OM model, I consider whether the operator output results are too diffe ...
Dear @user_4147187,

Is omg (offline mode generator) previous generation of ATC (Ascend Tensor Compiler)?
How to install omg that can run with CANN 3.3.0?

Thank you very much in advance.

Warmest Regards,
Suryadi
View more
  • x
  • convention:

Posted by user_4147187 at 2021-05-19 12:12import tensorflow as tffrom tensorflow.python.framework import graph_utilfrom tensorflow.python.pl ...

Dear @user_4147187,

Would you mind capture the screenshot of topb.py, because the code losses its indentation?

Thank you very much in advance.

Warmest Regards,
Suryadi

View more
  • x
  • convention:

12
Back to list

Comment

You need to log in to comment to the post Login | Register

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.