yolov7
yolov7 copied to clipboard
How to do gradient accumulation or how to check yolov7 is doing gradient accumulation
I have 4GB memory GPU which can support at most batch size of 8 images but I want to train at least 16 images batch and some where on internet I heard the concept gradient accumulation biut don't know how this thing can work in yolov7.
You have a hyper-parameter named "nbs" that does exactly what you need. It is hard coded here:
https://github.com/WongKinYiu/yolov7/blob/3b41c2cc709628a8c1966931e696b14c11d6db0c/train.py#L110
Does that mean I always use a batch_size of 64, while I use CLI like this?
python yolov7/train.py --device 0 --batch-size 1 --epochs 50 --data yolov7/data/AICUP.yaml --img 1280 1280 --cfg yolov7/cfg/training/yolov7-AICUP.yaml --weights 'pretrained/yolov7-e6e.pt' --name yolov7-AICUP --hyp yolov7/data/hyp.scratch.custom.yaml