mystic123 / tensorflow-yolo-v3

Implementation of YOLO v3 object detector in Tensorflow (TF-Slim)
https://medium.com/@pawekapica_31302/implementing-yolo-v3-in-tensorflow-tf-slim-c3c55ff59dbe
Apache License 2.0
893 stars 353 forks source link

Cannot reshape array of size 391694 into shape (512,256,3,3) for Yolov3-Tiny #79

Closed AlexeyAB closed 5 years ago

AlexeyAB commented 5 years ago

I just downloaded 3 files:

Run this command: python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

and get an error:

image

https://github.com/mystic123/tensorflow-yolo-v3/blob/ed60b9087b04e1d9ca40f8a9d8455d5c30c7c0d3/utils.py#L114-L115

I saw similar issues but with other error messages than ... into shape (512,256,3,3)

stangier commented 5 years ago

I have a similar problem when using YoloV3 (not tiny). Please see attached screenshot for more information. The Error Occurs at the same position as your error @AlexeyAB

image

As far as I know, the problem is caused by the fact that ptr + num_params is larger than the length of the array weights so the actual number of elements in the area ptr:ptr + num_params is smaller than ptr + num_params. This means that the array cannot be resized because the calculation in line 112 doesn't fit to the lenght of the array.

image

dexception commented 5 years ago

@AlexeyAB Did u use this command ?

git checkout ed60b90

For more info: https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html

Also OpenVino has a bug for yolov3-tiny conversion and it has not been resolved as of yet for 2019R1.

https://github.com/opencv/dldt/issues/151

AlexeyAB commented 5 years ago

@dexception

Did u use this command ?

git checkout ed60b90

No, It seems that ed60b90 is the last commit, so it isn't necessary yet: https://github.com/mystic123/tensorflow-yolo-v3/commits/master

For more info: https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html

Yes, I used this manual.

Do you know, can we use OpenCV-dnn module with Myriad VPU? If we compiled OpenCV with OpenVINO backend: https://github.com/opencv/opencv/wiki/Intel's-Deep-Learning-Inference-Engine-backend

stangier commented 5 years ago

I solved this issue for me. Apparently I trained with a YoloV3 Tiny configuration but I thought that it was a full YoloV3 configuration. After using the --tiny flag to convert my model it worked flawlessly.

AlexeyAB commented 5 years ago

@stangier

Yes, I solved this issue. The problem was windows newline character \r\n at the end of command in sh-file.

python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

violet17 commented 4 years ago

@stangier

Yes, I solved this issue. The problem was windows newline character \r\n at the end of command in sh-file.

python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

How to solve it?

Ibanez1408 commented 3 years ago

I solved this issue for me. Apparently I trained with a YoloV3 Tiny configuration but I thought that it was a full YoloV3 configuration. After using the --tiny flag to convert my model it worked flawlessly.

I have the same error. If I use the yolov3-320 I can run it fine, but when I use the yolov3-tiny, I get the error.

freedom9393 commented 3 years ago

@stangier

Yes, I solved this issue. The problem was windows newline character \r\n at the end of command in sh-file.

python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

I did not understand your reply. Could you explain more deteailed, please?