Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YOLOv9-t BFLOPs discrepancy #506

Open
dbacea opened this issue Jun 20, 2024 · 3 comments
Open

YOLOv9-t BFLOPs discrepancy #506

dbacea opened this issue Jun 20, 2024 · 3 comments

Comments

@dbacea
Copy link

dbacea commented Jun 20, 2024

In the official table and research paper, the listed number of parameters and FLOPs for YOLOv9-t equal 2.0M and 7.7G. But when training from scratch:
python -m torch.distributed.launch --nproc_per_node 2 --master_port 9527 train_dual.py --workers 4 --device 0,1 --sync-bn --batch 32 --data data/coco.yaml --img 640 --cfg models/detect/yolov9-t.yaml --weights '' --name yolov9-t --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15

The number of parameters and the BFLOPs printed at the end of training differ from the ones in the official table. The obtained number of parameters equals 3.67M, while the FLOPs equals 16.2G.

Where could this big difference coming from?

@ankandrew
Copy link

ankandrew commented Jun 20, 2024

The YOLOv9-T that appears in the table is the converted one (aux branch is removed). The aux branch won't be used during inference, just during training. For a fair comparison, you need to compare the YOLOv9-* (converted) with the corresponding Gelan-* network architecture. The one you see being reported seems to include the aux branch, thus more parameters and FLOPS being shown.

@dbacea
Copy link
Author

dbacea commented Jun 20, 2024

If I understand correctly, the number of parameters and the FLOPs of Gelan-t should be comparable to the ones posted in the official table for YOLOv9-t.
I've trained a gelan-t from scratch:
python -m torch.distributed.launch --nproc_per_node 2 --master_port 9527 train.py --workers 4 --device 0,1 --sync-bn --batch 32 --data data/coco.yaml --img 640 --cfg models/detect/gelan-t.yaml --weights '' --name gelan-t --hyp hyp.scratch-high.yaml --min-items 0 --epochs 1 --close-mosaic 15

The architecture:
Annotation 2024-06-20 161856_gelan_t

Which shows that the number of parameters equals 2442640 and the FLOPs 10.1G.

After training (and layers fusion) the number of parameters equals 2407632 and the FLOPs 9.8G, which still are higher than the ones posted for YOLOv9-t.

Annotation 2024-06-20 161856_gelan_t_post_training

Is there an additional step to be taken?

@ankandrew
Copy link

ankandrew commented Jun 20, 2024

If I understand correctly, the number of parameters and the FLOPs of Gelan-t should be comparable to the ones posted in the official table for YOLOv9-t.

Yes. But in the OG post you compared to the 3.67M number, which corresponds to the one with the aux branch. But yes, YOLOv9-t-converted and Gelan-t numbers don't seem to match with what is in the docs table.

After training (and layers fusion) the number of parameters equals 2407632 and the FLOPs 9.8G, which still are higher than the ones posted for YOLOv9-t.

At this point your question converges to the same as mine, see #505 (comment). I think the used gelan-t.yaml to parametrize the yolov9-t.yaml is slightly different than the one provided in the configs.

Is there an additional step to be taken?

I'm on the same boat as you, these don't seem to match. Let's wait for author answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants