Open ashuezy opened 5 years ago
18x256x1x1 = 4608
@PINTO0309 how should i use only 1 class of detection using YOLO, I am not able to convert it through Openvino. ./convert_weights_pb.py --class_name coco.names --data_format NHWC --weight_file yolov3.weights Traceback (most recent call last): File "./convert_weights_pb.py", line 52, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "./convert_weights_pb.py", line 42, in main load_ops = load_weights(tf.global_variables(scope='detector'), FLAGS.weights_file) File "/home/night/Desktop/github/tensorflow-yolo-v3/utils.py", line 115, in load_weights (shape[3], shape[2], shape[0], shape[1])) ValueError: cannot reshape array of size 4607 into shape (18,256,1,1) I have trained my own Yolo on just one class, help us find a way out to that.
@ashuezy @NightFury10497
Have you performed the following link work?
Implementing YOLO v3 in Tensorflow (TF-Slim) https://itnext.io/implementing-yolo-v3-in-tensorflow-tf-slim-c3c55ff59dbe
and, https://github.com/mystic123/tensorflow-yolo-v3/issues/17 https://github.com/mystic123/tensorflow-yolo-v3/issues/15 https://github.com/mystic123/tensorflow-yolo-v3/issues/64
@PINTO0309
Comand
python3 mo_tf.py --input_model /opt/github/tensorflow-yolo-v3/frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config /home/night/Downloads/OpenVINO-YoloV3-master/yolo_v3_changed.json --batch 1
ERROR
Model Optimizer version: 1.5.12.49d067a0
[ ERROR ] Cannot infer shapes or values for node "detector/yolo-v3/meshgrid_1/mul_1/YoloRegion".
[ ERROR ] index 2 is out of bounds for axis 0 with size 2
[ ERROR ]
[ ERROR ] It can happen due to bug in custom shape infer function <function RegionYoloOp.regionyolo_infer at 0x7fa52ed07268>.
[ 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 ] Stopped shape/value propagation at "detector/yolo-v3/meshgrid_1/mul_1/YoloRegion" node.
For more information please refer to Model Optimizer FAQ (
I got the same reason, and here's how I solve it.
First,check is your environment right.
I trained my weights file on Win 10 at first, after debug, I find the weight size is not equal to the network actually needed, in my case, the size of my one-class weights is 8676243 while the network needs 8676244.
After changing into Ubuntu, I use Ubuntu 18.04(Ubuntu 16.04 should be the same), and retrained my one-class yolov3-tinny model, I use this weights to convert into pb format, it finally works
So check your environment, I advice you train your model on Ubuntu and use tensorflow-gpu V1.12.
Finally, I'd like anyone to tell me why it's different in Windows and Ubuntu, in my guess, it's probably the reason of the value's precision is different in Ubuntu and Windows.
This happens for problem in (.names) file. You should check tow things to solve this.