theAIGuysCode / Object-Detection-API

Yolov3 Object Detection implemented as APIs, using TensorFlow and Flask
Apache License 2.0
339 stars 179 forks source link

ValueError: cannot reshape array of size 4607 into shape (18,256,1,1) #27

Closed Hatem-Jr closed 3 years ago

Hatem-Jr commented 3 years ago

I am trying to convert this yolov3 custom model: https://drive.google.com/drive/folders/17jysPykGMkNw66lDMd0kryybCvGOesKi?usp=sharing into tensorflow format

in the load_weights.py I changed line 10 to: flags.DEFINE_integer('num_classes', 1, 'number of classes in the model')

and in the ./data/labels/coco.names file I changed it to only "mice" (it detects mice for video analysis purposes)

however it begins converting until it produces the error in the title of this issue after this line in the cmd: Screenshot (15)

please if someone could help that would be much appreciated

Hatem-Jr commented 3 years ago

The solution to this would be to train your yolov3 model by following the instructions in this video: https://www.youtube.com/watch?v=10joRJt39Ns&t=2071s

for it to work with custom trained models and not having to change anything in utils.py because it will mess up the object detection if you get a "trained" model from the internet because in a lot of cases you will not know the yolov3.cfg file and the parameters used in it for the training configuration