Python 3.7 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:
pip install -r requirements.txt
A trained model has saved in /weights/best.pt
python train.py --batch 1 --epochs 200 --data ./data/data.yaml --cfg models/yolov5s.yaml --weights '' --device 0- detect.py runs inference on a variety of sources, downloading models automatically from the latest YOLOv5 release and saving results to
runs/detect.
$ python detect.py --source 0 # webcam
file.jpg # image
file.mp4 # video
path/ # directory
path/*.jpg # glob
rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa # rtsp stream
rtmp://192.168.1.105/live/test # rtmp stream
http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http streamTo run inference on example video in data/street.mp4:
python detect.py --source data/street.mp4 --weights weights/best.ptTo run inference on intel realsense camera:
python detect.py --source intel --weights weights/best.ptRun commands below to reproduce results on COCO dataset (dataset auto-downloads on first use). Training times for YOLOv5s/m/l/x are 2/4/6/8 days on a single V100 (multi-GPU times faster). Use the largest --batch-size your GPU allows (batch sizes shown for 16 GB devices).
$ python train.py --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 64
yolov5m 40
yolov5l 24
yolov5x 16Thanks to repos from ultralytics and iAmEthanMai, more ref