WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.21k forks source link

0 gradient in w6 model #1691

Open knowlessthanenough opened 1 year ago

knowlessthanenough commented 1 year ago

the original loss does not work so I follow others change the loss. My loss look like this. loss_w6.txt

it is able to train however after training when i run detect.py Model Summary: 370 layers, 80961284 parameters, 0 gradients Convert model to Traced-model... traced_script_module saved! model is traced! I get no detection and 0 gradient, anyone have similar situation?

thnak commented 1 year ago

only training mode you must need gradient, in others you don't you can check here

knowlessthanenough commented 1 year ago

hkuit155@hkuit155-desktop:/media/hkuit155/6561-3431/yolov7$ python detect.py --weights yolov7-e6e.pt --conf 0.1 --iou-thres 0.1 --img-size 1280 --source test_data/drown.jpg Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.1, device='', exist_ok=False, img_size=1280, iou_thres=0.1, name='exp', no_trace=False, nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='test_data/drown.jpg', update=False, view_img=False, weights=['yolov7-e6e.pt']) YOLOR 🚀 v0.1-122-g3b41c2c torch 1.13.0a0+d0d6b1f2.nv22.09 CUDA:0 (Orin, 30535.84765625MB)

Fusing layers... Model Summary: 792 layers, 151687420 parameters, 817020 gradients Convert model to Traced-model... traced_script_module saved! model is traced!

/home/hkuit155/.local/lib/python3.8/site-packages/torch/functional.py:484: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2984.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] 4 persons, 1 boat, 1 bird, 1 dog, Done. (84.9ms) Inference, (2.8ms) NMS The image with the result is saved in: runs/detect/exp/drown.jpg Done. (0.619s) hkuit155@hkuit155-desktop:/media/hkuit155/6561-3431/yolov7$ python detect.py --weights last.pt --conf 0.1 --iou-thres 0.1 --img-size 1280 --source test_data/drown.jpg Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.1, device='', exist_ok=False, img_size=1280, iou_thres=0.1, name='exp', no_trace=False, nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='test_data/drown.jpg', update=False, view_img=False, weights=['last.pt']) YOLOR 🚀 v0.1-122-g3b41c2c torch 1.13.0a0+d0d6b1f2.nv22.09 CUDA:0 (Orin, 30535.84765625MB)

Fusing layers... Model Summary: 354 layers, 70800337 parameters, 0 gradients Convert model to Traced-model... traced_script_module saved! model is traced!

/home/hkuit155/.local/lib/python3.8/site-packages/torch/functional.py:484: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2984.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] Done. (64.7ms) Inference, (0.9ms) NMS The image with the result is saved in: runs/detect/exp2/drown.jpg Done. (0.362s)

knowlessthanenough commented 1 year ago

the first one is original model you can see in model summary there is 817020 gradients but after i train one epoch on my data it become 0 gradients with no detection