hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.23k stars 1.24k forks source link

Retraining and no detection #406

Open savingbudteam opened 2 years ago

savingbudteam commented 2 years ago

Hi everyone, I have followed this tutorial and the linked colab in order to have yolov4 weights retrained on my custom dataset. https://www.youtube.com/watch?v=mmj3nxGT2YQ&ab_channel=TheAIGuy

I've succesfully imported the .weight file and converted it to .pb (tensorflow) through save_model.py. The problem is that when using detect.py, I don't have any detection. The bbox detected are the exact number of the total objects, but inside the bbox every item is equal to zero.

The model is working without any problem on darknet and I've been training the model for almost 6000 epochs. I've already checked config.py and it is aligned with yolov4-cfg.cfg. Any idea on what may be causing the problem?

simetin commented 2 years ago

Any luck on finding the issue ?

BenjaminMidtvedt commented 2 years ago

What I found usually works is to save the model by just doing model.save("path/to/models"). Note, you should save it as a folder (e.g., no suffix such as .h5 or .pb). Then, initialize a new model and do model.load_weights("path/to/models"). Across TensorFlow versions, this seems the most stable for loading subclassed models.