theAIGuysCode / yolov4-deepsort

Object tracking implemented with YOLOv4, DeepSort, and TensorFlow.
GNU General Public License v3.0
1.33k stars 750 forks source link

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

Open zcd357 opened 2 years ago

zcd357 commented 2 years ago

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!

kaylC4 commented 2 years ago

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

MartinCKE commented 2 years ago

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 commented 2 years ago

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.

alkadafare01 commented 2 years ago

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

jashidack commented 2 years ago

Did anyone get the solution to this problem?

dvdkwei commented 2 years ago

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?