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

pretrain weights #33

Closed
ou525 opened this issue Jun 10, 2020 · 11 comments
Closed

pretrain weights #33

ou525 opened this issue Jun 10, 2020 · 11 comments
Labels
question Further information is requested Stale Stale and schedule for closing soon

Comments

@ou525
Copy link

ou525 commented Jun 10, 2020

When I train my own data set, do I still use the provided complete model as pre-training weights?

@ou525 ou525 added the bug Something isn't working label Jun 10, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jun 10, 2020

Hello @ou525, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Google Colab Notebook, Docker Image, and GCP Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI surveillance systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher glenn-jocher added question Further information is requested and removed bug Something isn't working labels Jun 10, 2020
@glenn-jocher
Copy link
Member

@ou525 if your dataset is small, then yes you are strongly recommended to start training from the pretrained checkpoints:

python train.py --cfg yolov5s.yaml --weights yolov5s.pt

@ou525
Copy link
Author

ou525 commented Jun 11, 2020

@glenn-jocher,thank you very much for your work and reply!
There is another problem, I set the training size to 640, the saved train_batch*.jpg is 1280X1280, the boxes are normal, but the test_batch*.jpg is 1280X448, and the boxes in gt.jpg are wrong

@ou525
Copy link
Author

ou525 commented Jun 11, 2020

My dataset has only four categories, which is different from the coco dataset. So can pre-training weights be used? When I training, the error is not compatible with yolov5l.yaml, specify --weights'' or specify a --cfg compatible with yolov5l.pt

@yxNONG
Copy link
Contributor

yxNONG commented Jun 12, 2020

@glenn-jocher the pretrained weight is whether for the Darknet or for the whole yolo network?
if it's for the whole yolo, when i change the num of class, the yolo detect head's shape is supposed to change
in that case, can i still load the pretrained weight to the adjust yolo ?
looking for your reply, thanks

@glenn-jocher
Copy link
Member

glenn-jocher commented Jun 12, 2020

@ou525 @yxNONG you can request pretrained weights with train.py such as:
python train.py --cfg c --weights yolov5s.pt

It does not matter how many output classes are specified in yolov5s.yaml. All pretrained layers with matching sizes are loaded.

If you train an 80 class model, then all pretrained layers are loaded. If you train a model with different class counts, then pretrained output layers will not be loaded (because they are not the same shape). All other pretrained layers will be loaded.

For more information on this you can see our PyTorch Hub post:
https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading

@ou525
Copy link
Author

ou525 commented Jun 17, 2020

@glenn-jocher when I updated the code to No. 16, I started training with pre-training weights, but there was a phenomenon of map 0. Is this normal?
Epoch gpu_mem GIoU obj cls total targets img_size
0/49 6.53G 0.05633 0.03247 0.0106 0.09941 17 608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:10:08<00:00, 5.75s/it]
Class Images Targets P R [email protected] [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [12:07<00:00, 2.14s/it]
all 5.43e+03 2.41e+04 0.494 0.787 0.752 0.406

 Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
  1/49     6.73G   0.04195   0.02837  0.002496   0.07282        19       608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:14:47<00:00,  5.95s/it]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [25:43<00:00,  4.54s/it]
             all    5.43e+03    2.41e+04           0           0           0           0

 Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
  2/49     6.73G   0.04216   0.03074  0.002763   0.07566        16       608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:18:39<00:00,  6.12s/it]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [25:51<00:00,  4.56s/it]
             all    5.43e+03    2.41e+04           0           0           0           0

 Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
  3/49     6.73G   0.04186    0.0325  0.002924   0.07728        10       608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:15:52<00:00,  6.00s/it]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [25:39<00:00,  4.53s/it]
             all    5.43e+03    2.41e+04           0           0           0           0

 Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
  4/49     6.73G   0.04029   0.03193  0.002385   0.07461        24       608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:14:47<00:00,  5.95s/it]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [25:49<00:00,  4.56s/it]
             all    5.43e+03    2.41e+04           0           0           0           0

 Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
  5/49     6.74G   0.03929   0.03121  0.002087   0.07259        92       608:  78%|██████████████████████████████████████████████████████████████▋                 | 1065/1359 [1:45:58<09:14,  1.88s/it]
  5/49     6.74G   0.03914   0.03114  0.002126    0.0724        31       608: 100%|████████████████████████████████████████████████████████████████████████████████| 1359/1359 [2:13:43<00:00,  5.90s/it]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|████████████████████████████████████████████████████████████████████████| 340/340 [25:41<00:00,  4.53s/it]

@glenn-jocher
Copy link
Member

@ou525 train 300 epochs and then post your results.png.

@ou525
Copy link
Author

ou525 commented Jun 17, 2020

@glenn-jocher If training based on pre-training weights still needs so many epochs, if it can not converge quickly, then the role of pre-training weights is not lost?

@glenn-jocher
Copy link
Member

@ou525 if you want to see the effect, then train with and without them, both to 300, and post your results.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale Stale and schedule for closing soon
Projects
None yet
Development

No branches or pull requests

3 participants