Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error white coverting to IR using mo.py #44

Open
tarunmcom opened this issue May 28, 2021 · 16 comments
Open

Got error white coverting to IR using mo.py #44

tarunmcom opened this issue May 28, 2021 · 16 comments

Comments

@tarunmcom
Copy link

I downloaded yolo-v4-tiny.weights and converted to pb using provided script. But got error in the next step:-

Model Optimizer version:
[ ERROR ] Exception occurred during running replacer "TFYOLOV3" (<class 'extensions.front.YOLO.YoloV3RegionAddon'>): TensorFlow YOLO V3 conversion mechanism was enabled. Entry points "detector/yolo-v4/Reshape, detector/yolo-v4/Reshape_4, detector/yolo-v4/Reshape_8" were provided in the configuration file. Entry points are nodes that feed YOLO Region layers. Node with name detector/yolo-v4/Reshape doesn't exist in the graph. Refer to documentation about converting YOLO models for more information.

Please help

@TNTWEN
Copy link
Owner

TNTWEN commented May 28, 2021

Hi @tarunmcom
That's because you still use yolov4.json.Please use yolo_v4_tiny.json instead

@su26225
Copy link

su26225 commented Jun 3, 2021

Hi @tarunmcom
That's because you still use yolov4.json.Please use yolo_v4_tiny.json instead

I have encounter a similiar error.when i use the yolo_v4_tiny.json,I got
[ ERROR ] Exception occurred during running replacer "TFYOLOV3" (<class 'extensions.front.YOLO.YoloV3RegionAddon'>): TensorFlow YOLO V3 conversion mechanism was enabled. Entry points "detector/yolo-v4-tiny/Reshape, detector/yolo-v4-ti
ny/Reshape_4" were provided in the configuration file. Entry points are nodes that feed YOLO Region layers. Node with name detector/yolo-v4-tiny/Reshape doesn't exist in the graph. Refer to documentation about converting YOLO models fo
r more information.
thanks for your help!

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

@su26225
So which model are you using?
YOLOv4 or YOLOv4-tiny

@su26225
Copy link

su26225 commented Jun 3, 2021

@su26225
So which model are you using?

I use yolov4-tiny.weights,after the train of darknet

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

@su26225
check the .pb model you are using
The error means the .pb model isn't converted by your yolov4-tiny.weights
OR you can list all commands here

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC

you didn't add --tiny

@su26225
Copy link

su26225 commented Jun 3, 2021

@su26225
check the .pb model you are using
The error means the .pb model isn't converted by your yolov4-tiny.weights
OR you can list all commands here

This is the cammands I used:
./darknet detector train /data2/darknet-master/build/darknet/x64/data/obj.data cfg/yolov4-tiny-custom.cfg /data2/darknet-master/yolov4-tiny.weights -map
python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC
python "C:\Intel\openvino_2021.3.394\deployment_tools\model_optimizer\mo.py" --input_model frozen_darknet_yolov4_model.pb --transformations_config yolov4.json --batch 1 --reverse_input_channels

If I use the yolov4.json,I will get the error:
[ ERROR ] Cannot infer shapes or values for node "detector/yolo-v4/Conv_23/biases".
[ ERROR ] Attempting to use uninitialized value detector/yolo-v4/Conv_23/biases
[[{{node _retval_detector/yolo-v4/Conv_23/biases_0_0}}]]
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function tf_native_tf_node_infer at 0x0000014FFAA861E0>.
[ 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-v4/Conv_23/biases" node.
For more information please refer to Model Optimizer FAQ, question #38.

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

python "C:\Intel\openvino_2021.3.394\deployment_tools\model_optimizer\mo.py" --input_model frozen_darknet_yolov4_model.pb --transformations_config yolov4.json --batch 1 --reverse_input_channels

This is also wrong

python "C:\Intel\openvino_2021.3.394\deployment_tools\model_optimizer\mo.py" --input_model frozen_darknet_yolov4_model.pb --transformations_config yolo_v4_tiny.json --batch 1 --reverse_input_channels

@su26225
Copy link

su26225 commented Jun 3, 2021

python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny

I got it . I used the convert_weights_pb.py in branch of v4-tiny-3l , it doesn't have the flag.tiny.
Howevey , when i changed to use convert_weights_pb.py in master
python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny
python "C:\Intel\openvino_2021.3.394\deployment_tools\model_optimizer\mo.py" --input_model frozen_darknet_yolov4_model.pb --transformations_config yolo_v4_tiny.json --batch 1 --reverse_input_channels
I got the error :
[ ERROR ] Cannot infer shapes or values for node "detector/yolo-v4-tiny/Conv_20/biases".
[ ERROR ] Attempting to use uninitialized value detector/yolo-v4-tiny/Conv_20/biases
[[{{node _retval_detector/yolo-v4-tiny/Conv_20/biases_0_0}}]]
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function tf_native_tf_node_infer at 0x0000018D46807510>.
[ 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-v4-tiny/Conv_20/biases" node.
For more information please refer to Model Optimizer FAQ, question #38.
sorry to bother you again!

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny

I got it . I used the convert_weights_pb.py in branch of v4-tiny-3l , it doesn't have the flag.tiny.
Howevey , when i changed to use convert_weights_pb.py in master
python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny
python "C:\Intel\openvino_2021.3.394\deployment_tools\model_optimizer\mo.py" --input_model frozen_darknet_yolov4_model.pb --transformations_config yolo_v4_tiny.json --batch 1 --reverse_input_channels
I got the error :
[ ERROR ] Cannot infer shapes or values for node "detector/yolo-v4-tiny/Conv_20/biases".
[ ERROR ] Attempting to use uninitialized value detector/yolo-v4-tiny/Conv_20/biases
[[{{node _retval_detector/yolo-v4-tiny/Conv_20/biases_0_0}}]]
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function tf_native_tf_node_infer at 0x0000018D46807510>.
[ 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-v4-tiny/Conv_20/biases" node.
For more information please refer to Model Optimizer FAQ, question #38.
sorry to bother you again!

How many classes your custom model has?
you should change number of classes in .json which has been mentioned in FAQ

@su26225
Copy link

su26225 commented Jun 3, 2021

How many classes your custom model has?
you should change number of classes in .json which has been mentioned in FAQ

yes,I have changed the number of classes from 80 to 2 , but it still have the error .
I try to run the program in Linux , and then I get the .xml 、 .bin , although I don't know why

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

How many classes your custom model has?
you should change number of classes in .json which has been mentioned in FAQ

yes,I have changed the number of classes from 80 to 2 , but it still have the error .
I try to run the program in Linux , and then I get the .xml 、 .bin , although I don't know why

python convert_weights_pb.py --class_names cfg/coco.names --weights_file yolov4-tiny-custom_last.weights --data_format NHWC --tiny

you still use coco.names here

@su26225
Copy link

su26225 commented Jun 3, 2021

you still use coco.names here

I have chaned the content of coco.names . It has only two labels in it .
Now , I am still traped in the step of mo.py.
Should I follow this branch of tiny.3l exactly for deployment , or switch to the master?

@TNTWEN
Copy link
Owner

TNTWEN commented Jun 3, 2021

It's clear that yolov4 and yolov4-tiny use master branch,yolov4-tiny-3l use tiny-3l branch
And all commands are listed in corresponding README in detail.
I recommend you download yolov4.weights yolov4-tiny.weights and try official model first.
You should make sure you could run demo first

And then you only need to change coco.names and .json for custom model.

@su26225
Copy link

su26225 commented Jun 7, 2021

It's clear that yolov4 and yolov4-tiny use master branch,yolov4-tiny-3l use tiny-3l branch
And all commands are listed in corresponding README in detail.
I recommend you download yolov4.weights yolov4-tiny.weights and try official model first.
You should make sure you could run demo first

Thanks . I have solved this issue through upgrading tensorflow version from 1.15 to 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants