yolov4-deepsort icon indicating copy to clipboard operation
yolov4-deepsort copied to clipboard

ValueError: cannot reshape array of size 4480136 into shape (1024,512,3,3)

Open zcd357 opened this issue 2 years ago • 6 comments

Hello, I use my own training weight file to run save_model.py and report an error ValueError: cannot reshape array of size 4480136 into shape (1024,512,3,3) My picture training size is 416,416 Also,i have changed config.py But still have the error. HELP! thank you!

zcd357 avatar Dec 22 '21 06:12 zcd357

Hi, try to change line 14 in yolov4-deepsort/core/config.py, from __C.YOLO.CLASSES = "./data/classes/coco.names" to: __C.YOLO.CLASSES = "./data/classes/obj.names" than copy your obj.names file (essentially a .txt file containing your class names, one line per name) in the same directory: ./data/classes/obj.names

it works for me

kaylC4 avatar Jan 03 '22 15:01 kaylC4

I'm also having this problem, tried everything. I have trained a custom model for detection of 1 class only which works fine, but want to implement tracking as well. I changed line 14 in the config.py as well as placed names and weight file in the correct folder. Checked everywhere that the correct files are being passed through, but still get:

conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 3343962 into shape (1024,512,3,3)

Could the problem be related to that there's only 1 class in my model?

MartinCKE avatar Mar 02 '22 11:03 MartinCKE

I'm also having this problem, tried everything. I have trained a custom model for detection of 1 class only which works fine, but want to implement tracking as well. I changed line 14 in the config.py as well as placed names and weight file in the correct folder. Checked everywhere that the correct files are being passed through, but still get:

conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 3343962 into shape (1024,512,3,3)

Could the problem be related to that there's only 1 class in my model?

Okay so apparently this issue dissapears if i add the "--tiny" flag.. which is weird since the model isn't trained for tiny yolov4. But the end result is images/videos with no detections what so ever.. so something must be wrong with the model implementation or "translation" to tensor flow, since it works as it should directly with darknet or OpenCV.

MartinCKE avatar Mar 02 '22 13:03 MartinCKE

i have trained a custom model for detection of 8 class. when i detect in yolo darknet it shows result but when i used this weights in deepsort its not tracking any objects.no error found.please help me

alkadafare01 avatar Mar 11 '22 06:03 alkadafare01

Did anyone get the solution to this problem?

jashidack avatar May 11 '22 15:05 jashidack

I'm also having this problem, tried everything. I have trained a custom model for detection of 1 class only which works fine, but want to implement tracking as well. I changed line 14 in the config.py as well as placed names and weight file in the correct folder. Checked everywhere that the correct files are being passed through, but still get: conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 3343962 into shape (1024,512,3,3) Could the problem be related to that there's only 1 class in my model?

Okay so apparently this issue dissapears if i add the "--tiny" flag.. which is weird since the model isn't trained for tiny yolov4. But the end result is images/videos with no detections what so ever.. so something must be wrong with the model implementation or "translation" to tensor flow, since it works as it should directly with darknet or OpenCV.

Hey @MartinCKE , thanks for the idea. It 'worked' for me in a sense of no errors, but when i run the detection, it wouldn't detect anything (tested it on the kite.png and picture from my drive) :(. Did it work for you?

dvdkwei avatar Jun 26 '22 22:06 dvdkwei