WongKinYiu / ScaledYOLOv4

Scaled-YOLOv4: Scaling Cross Stage Partial Network
GNU General Public License v3.0
2.02k stars 575 forks source link

2 different yolov4-tiny configs #165

Open FrancoisThibeau opened 3 years ago

FrancoisThibeau commented 3 years ago

Hi! I am currently going back and forth between this repository and your other repository PyTorch_YOLOv4. I am a bit confused as to how your tiny configs came about. I saw that the config in this repository is the same one as the one in the original Darknet repository. The fields for group_id and groups are not implemented in this repository, nor in the PyTorch_YOLOv4 repository. So basically my questions are: 1) How can I use the yolov4-tiny config based on the Scaled YOLOv4 paper with Pytorch in PyTorch_YOLOv4 or in this one ScaledYOLOv4? 2) Do you have a literature reference on what your yolov4-tiny config in PyTorch_YOLOv4 is based on? I couldn't find a source so far. 3) What's the difference between the 2 yolov4-tiny configs in your 2 repositories?

Thanks by the way for your great repository! Helped me out a lot so far!

FrancoisThibeau commented 3 years ago

I went through the implementations of models.py and layers.py again. I think the only difference between the 2 is that in your PyTorch_YOLOv4 repository, you used the a separate module named [route_lhalf] instead of extending [route] with groups and group ids. If I understood your implementation in layers.py and models.py correctly, you are basically implementing what [route] group and group_id is supposed to achieve, namely tensor splitting (by groups=2) an routing. Is that correct?

WongKinYiu commented 3 years ago

yes, due to original implementation of [route] group and group_id will get differentiated input is unreachable error in pytorch 1.6 or 1.7, I implemented [route_lhalf] instead. However, it caused weights incompatible between darknet and pytorch version.

FrancoisThibeau commented 3 years ago

Thanks your your answer! This means both models are the same architecture and just different way of implementation?

philipp-schmidt commented 3 years ago

@WongKinYiu Hello WongKinYiu, I am using your repo to load darknet weights and export them into ".wts" format so I can parse and load them into TensorRT.

Unfortunately I can not load my darknet networks because group and group_id are not supported, like you say in the posts above. Is there a way to load the network? Changing the [route] layer to [route_lhalf] works but the weight file seems to be incorrect as you say

However, it caused weights incompatible between darknet and pytorch version.

Can you help? I don't need execution or training in pytorch - I only want to load the network to export the correct weights into a new format, similar to this: https://github.com/tjuskyzhang/Scaled-YOLOv4-TensorRT/blob/master/yolov4-csp-tensorrt/gen_wts.py

philipp-schmidt commented 3 years ago

Similar issue: https://github.com/tjuskyzhang/Scaled-YOLOv4-TensorRT/issues/5

GreenTeaHua commented 3 years ago

pytorch 1.9 is ok?