ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
49.78k stars 16.12k forks source link

Yolov5s weights size #1734

Closed miladsoltany closed 3 years ago

miladsoltany commented 3 years ago

❔Question

Hi, I noticed that the pre-trained weights on coco are only 14MBs. However when I train it on my own dataset, my weights are about 56 megabytes. I was wondering why that is. Thank you in advance.

Additional context

github-actions[bot] commented 3 years ago

Hello @miladsoltany, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 3 years ago

Weights are finalized to official sizes upon training completion.

On Fri, Dec 18, 2020 at 2:31 PM github-actions[bot] < notifications@github.com> wrote:

Hello @miladsoltany https://github.com/miladsoltany, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials https://docs.ultralytics.com/yolov5 to get started, where you can find quickstart guides for simple tasks like Custom Data Training https://docs.ultralytics.com/yolov5/tutorials/train_custom_data all the way to advanced concepts like Hyperparameter Evolution https://docs.ultralytics.com/yolov5/tutorials/hyperparameter_evolution.

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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging https://docs.ultralytics.com/yolov5/tutorials/train_custom_data#visualize if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. Requirements

Python 3.8 or later with all requirements.txt https://github.com/ultralytics/yolov5/blob/master/requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA https://developer.nvidia.com/cuda/ CUDNN https://developer.nvidia.com/cudnn, Python https://www.python.org/ and PyTorch https://pytorch.org/ preinstalled):

Status

[image: CI CPU testing] https://github.com/ultralytics/yolov5/workflows/CI%20CPU%20testing/badge.svg

If this badge is green, all YOLOv5 GitHub Actions https://github.com/ultralytics/yolov5/actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py https://github.com/ultralytics/yolov5/blob/master/train.py), testing ( test.py https://github.com/ultralytics/yolov5/blob/master/test.py), inference (detect.py https://github.com/ultralytics/yolov5/blob/master/detect.py) and export (export.py https://github.com/ultralytics/yolov5/blob/master/models/export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ultralytics/yolov5/issues/1734#issuecomment-748351170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMXEGNJUJWADUEJCCVJZILSVPJ5VANCNFSM4VBYIFNA .

-- https://www.ultralytics.com/

Glenn JocherFounder & CEO, Ultralytics LLC +1 301 237 6695 https://www.facebook.com/ultralytics https://www.twitter.com/ultralytics https://www.youtube.com/ultralytics https://www.github.com/ultralytics https://www.linkedin.com/company/ultralytics https://www.instagram.com/ultralytics https://contact.ultralytics.com/

dsantiago commented 3 years ago

Same here!

What do you mean @glenn-jocher with "upon training completion"? Do you mean all epochs passed in parameters for train, f.e if i pass --epochs 1000, i need to wait all 1000 epochs to final model size be compressed? Because in the meantime it is about 56mb.

ilyalasy commented 3 years ago

@dsantiago, not final weights will always have larger size than ones that you get after completion of training. You can use this function to strip weights to minimal size.

miladsoltany commented 3 years ago

Thank you @glenn-jocher and @Misterion777 for your speedy responses.

glenn-jocher commented 3 years ago

Training checkpoints include optimizer gradients with momentum, which are at least as large as the model weights. Once training finishes gradient and training info is stripped and final checkpoint saved at official sizes.

glenn-jocher commented 3 years ago
97808084-edfcb100-1c64-11eb-83eb-ffed43a0859f
github-actions[bot] commented 3 years ago

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.