yolov5
Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.
File Explorer
- bug-report.yml
- config.yml
- feature-request.yml
- question.yml
- ci-testing.yml
- cla.yml
- docker.yml
- format.yml
- links.yml
- merge-main-into-prs.yml
- stale.yml
- dependabot.yml
- predict.py
- train.py
- tutorial.ipynb
- val.py
- hyp.no-augmentation.yaml
- hyp.Objects365.yaml
- hyp.scratch-high.yaml
- hyp.scratch-low.yaml
- hyp.scratch-med.yaml
- hyp.VOC.yaml
- bus.jpg
- zidane.jpg
- download_weights.sh
- get_coco.sh
- get_coco128.sh
- get_imagenet.sh
- get_imagenet10.sh
- get_imagenet100.sh
- get_imagenet1000.sh
- Argoverse.yaml
- coco.yaml
- coco128-seg.yaml
- coco128.yaml
- GlobalWheat2020.yaml
- ImageNet.yaml
- ImageNet10.yaml
- ImageNet100.yaml
- ImageNet1000.yaml
- Objects365.yaml
- SKU-110K.yaml
- VisDrone.yaml
- VOC.yaml
- xView.yaml
- anchors.yaml
- yolov3-spp.yaml
- yolov3-tiny.yaml
- yolov3.yaml
- yolov5-bifpn.yaml
- yolov5-fpn.yaml
- yolov5-p2.yaml
- yolov5-p34.yaml
- yolov5-p6.yaml
- yolov5-p7.yaml
- yolov5-panet.yaml
- yolov5l6.yaml
- yolov5m6.yaml
- yolov5n6.yaml
- yolov5s-ghost.yaml
- yolov5s-LeakyReLU.yaml
- yolov5s-transformer.yaml
- yolov5s6.yaml
- yolov5x6.yaml
- yolov5l-seg.yaml
- yolov5m-seg.yaml
- yolov5n-seg.yaml
- yolov5s-seg.yaml
- yolov5x-seg.yaml
- __init__.py
- common.py
- experimental.py
- tf.py
- yolo.py
- yolov5l.yaml
- yolov5m.yaml
- yolov5n.yaml
- yolov5s.yaml
- yolov5x.yaml
- predict.py
- train.py
- tutorial.ipynb
- val.py
- test_flask_rest_api.py
- test_invariant_common.py
- test_invariant_export.py
- Dockerfile
- Dockerfile-arm64
- Dockerfile-cpu
- example_request.py
- README.md
- restapi.py
- __init__.py
- clearml_utils.py
- hpo.py
- README.md
- __init__.py
- comet_utils.py
- hpo.py
- optimizer_config.json
- README.md
- __init__.py
- wandb_utils.py
- __init__.py
- __init__.py
- augmentations.py
- dataloaders.py
- general.py
- loss.py
- metrics.py
- plots.py
- __init__.py
- activations.py
- augmentations.py
- autoanchor.py
- autobatch.py
- callbacks.py
- dataloaders.py
- downloads.py
- general.py
- loss.py
- metrics.py
- plots.py
- torch_utils.py
- triton.py
- .dockerignore
- .gitattributes
- .gitignore
- AGENTS.md
- benchmarks.py
- CITATION.cff
- CLAUDE.md
- CONTRIBUTING.md
- detect.py
- export.py
- hubconf.py
- LICENSE
- pyproject.toml
- README.md
- README.zh-CN.md
- requirements.txt
- train.py
- tutorial.ipynb
- val.py
# Installation Guide
pythonSetup Steps
git clone https://github.com/ultralytics/yolov5
Clone the YOLOv5 repository.
cd yolov5
Navigate to the project directory.
pip install -r requirements.txt
Install required python packages.
python detect.py --weights yolov5s.pt --source 0
Run object detection inference with the model.
Key Commands
pip install -r requirements.txt
Install all python dependency packages specified in requirements.txt.
python detect.py --weights yolov5s.pt --source 0
Run object detection inference on sources like webcam, images, or videos.
python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.pt
Train a YOLOv5 model using a custom dataset.
python val.py --weights yolov5s.pt --data coco128.yaml
Validate the performance of the trained model.
python export.py --weights yolov5s.pt --include onnx
Export the trained model to other formats such as ONNX or TensorRT.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Command Glossary
Commands referenced in this DOCs, explained below.
git clone
View Details ▼
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
pip install
View Details ▼
pip install
Install Python packages.
pip install {{package1 package2 ...}}
Install one or more packages:
pip install {{package1 package2 ...}} {{[-U|--upgrade]}}
Upgrade all specified packages to the latest version, installing any that are not already present:
pip install {{package}}=={{version}}
Install a specific version of a package:
python
View Details ▼
python
Python language interpreter.
python
Start a REPL (interactive shell):
python {{path/to/file.py}}
Execute a specific Python file:
python -i {{path/to/file.py}}
Execute a specific Python file and start a REPL:
