Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.48k stars 1.49k forks source link

Difference between yolov4.pth and yolov4.conv.137.pth #469

Open Wilson0925 opened 3 years ago

Wilson0925 commented 3 years ago

Hi, are they just two different pretrained models, or they relate to each other?

beybars1 commented 2 years ago

Hi!

Generally, we use yolov4.pth, that was trained on MSCOCO dataset, as the final weights file to detect objects. It is already trained/validated for optimality. It is a good way to test the YOLOv4 model in your specific task.

The yolov4.conv.137.pth is similarly trained on MSCOCO dataset, but in this case the last layers were frozen and were not used. We just eliminate them since we want to use this pre-trained weights to be trained for our specific object detection task. It is a common task to use this file to train the model on your own dataset. By doing this, we get all the semantically rich information of low level patterns such as lines and circles as well as more complex patterns from the MSCOCO dataset, and use these knowledge to adapt the model for our task.

hustCYQ commented 2 years ago

Hi!

Generally, we use yolov4.pth, that was trained on MSCOCO dataset, as the final weights file to detect objects. It is already trained/validated for optimality. It is a good way to test the YOLOv4 model in your specific task.

The yolov4.conv.137.pth is similarly trained on MSCOCO dataset, but in this case the last layers were frozen and were not used. We just eliminate them since we want to use this pre-trained weights to be trained for our specific object detection task. It is a common task to use this file to train the model on your own dataset. By doing this, we get all the semantically rich information of low level patterns such as lines and circles as well as more complex patterns from the MSCOCO dataset, and use these knowledge to adapt the model for our task.

Excuse me, I want to train and test the model on COCO. I use the pre-trained model yolov4.pth and set Cfg.use_darknet_cfg to False. Theoretically speaking, the loss function should be small and have a high AP at the beginning. In fact, the loss is very large. AP is close to 0. how should I adjust it?

ingbeeedd commented 2 years ago

There's a problem in code