yolov5-pip

Packaged version of ultralytics/yolov5 + many extra features

GPL-3.0 License

Downloads
187.4K
Stars
289
Committers
10
yolov5-pip - v6.1.7

Published by fcakyon about 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.6...6.1.7

yolov5-pip - v6.1.6

Published by fcakyon over 2 years ago

yolov5-pip - v6.1.5

Published by fcakyon over 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.4...6.1.5

yolov5-pip - v6.1.4

Published by fcakyon over 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.3...6.1.4

yolov5-pip - v6.1.3

Published by fcakyon over 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.2...6.1.3

yolov5-pip - v6.1.2

Published by fcakyon over 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.1...6.1.2

yolov5-pip - v6.1.1

Published by fcakyon over 2 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.1.0...6.1.1

yolov5-pip - v6.1.0

Published by fcakyon over 2 years ago

This yolov5 package contains everything from ultralytics/yolov5 at this commit plus:

  1. Easy installation via pip: pip install yolov5
  2. Full CLI integration with Fire package
  3. NeptuneAI logger support (metric, model and dataset logging)
  4. S3 support (model and dataset upload)
  5. Classwise AP logging during experiment
  6. COCO dataset format support (for training)

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.0.7...6.1.0

yolov5-pip - v6.0.7

Published by fcakyon over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.0.6...6.0.7

yolov5-pip - v6.0.6

Published by fcakyon almost 3 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.0.5...6.0.6

yolov5-pip - v6.0.5

Published by fcakyon almost 3 years ago

What's Changed

Full Changelog: https://github.com/fcakyon/yolov5-pip/compare/6.0.4...6.0.5

COCO Dataset Support

  • Start a training using a COCO formatted dataset:
# data.yml
train_json_path: "train.json"
train_image_dir: "train_image_dir/"
val_json_path: "val.json"
val_image_dir: "val_image_dir/"
$ yolov5 train --data data.yaml --weights yolov5s.pt

New AWS and Neptune.AI Utilities

  • Automatically upload weights and datasets to AWS S3 (with Neptune.AI artifact tracking integration):
export AWS_ACCESS_KEY_ID=YOUR_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_KEY
$ yolov5 train --data data.yaml --weights yolov5s.pt --s3_upload_dir YOUR_S3_FOLDER_DIRECTORY --upload_dataset
  • Add yolo_s3_data_dir into data.yaml to match Neptune dataset with a present dataset in S3.
# data.yml
train_json_path: "train.json"
train_image_dir: "train_image_dir/"
val_json_path: "val.json"
val_image_dir: "val_image_dir/"
yolo_s3_data_dir: s3://bucket_name/data_dir/
yolov5-pip - v6.0.4

Published by fcakyon about 3 years ago

new features

  • export and log results.html at the end of training, log category based metrics (#51)
  • handle when neptune installed but not set (#50)
yolov5-pip - v6.0.3

Published by fcakyon about 3 years ago

update v6.0.3

yolov5-pip - v6.0.1

Published by fcakyon about 3 years ago

Use from Python

import yolov5

# load model
model = yolov5.load('yolov5s')

# set image
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

# perform inference
results = model(img)

# inference with larger input size
results = model(img, size=1280)

# inference with test time augmentation
results = model(img, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, x2, y1, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()

# save results into "results/" folder
results.save(save_dir='results/')

from yolov5 import YOLOv5

# set model params
model_path = "yolov5/weights/yolov5s.pt"
device = "cuda:0" # or "cpu"

# init yolov5 model
yolov5 = YOLOv5(model_path, device)

# load images
image1 = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
image2 = 'https://github.com/ultralytics/yolov5/blob/master/data/images/bus.jpg'

# perform inference
results = yolov5.predict(image1)

# perform inference with larger input size
results = yolov5.predict(image1, size=1280)

# perform inference with test time augmentation
results = yolov5.predict(image1, augment=True)

# perform inference on multiple images
results = yolov5.predict([image1, image2], size=1280, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, x2, y1, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()

# save results into "results/" folder
results.save(save_dir='results/')
  • You can directly use these functions by importing them:
from yolov5 import train, val, detect, export

train.run(imgsz=640, data='coco128.yaml')
val.run(imgsz=640, data='coco128.yaml', weights='yolov5s.pt')
detect.run(imgsz=640)
export.run(imgsz=640, weights='yolov5s.pt')
  • You can pass any argument as input:
from yolov5 import detect

img_url = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

detect.run(source=img_url, weights="yolov5s6.pt", conf_thres=0.25, imgsz=640)

Use from CLI

You can call yolov5 train, yolov5 detect, yolov5 val and yolov5 export commands after installing the package via pip:

Finetune one of the pretrained YOLOv5 models using your custom data.yaml:

$ yolov5 train --data data.yaml --weights yolov5s.pt --batch-size 16 --img 640
                                          yolov5m.pt              8
                                          yolov5l.pt              4
                                          yolov5x.pt              2

Visualize your experiments via Neptune.AI:

$ yolov5 train --data data.yaml --weights yolov5s.pt --neptune_project NAMESPACE/PROJECT_NAME --neptune_token YOUR_NEPTUNE_TOKEN

yolov5 detect command runs inference on a variety of sources, downloading models automatically from the latest YOLOv5 release and saving results to runs/detect.

$ yolov5 detect --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 stream

You can export your fine-tuned YOLOv5 weights to any format such as torchscript, onnx, coreml, pb, tflite, tfjs:

$ yolov5 export --weights yolov5s.pt --include 'torchscript,onnx,coreml,pb,tfjs'
yolov5-pip - v5.0.10

Published by fcakyon about 3 years ago

yolov5-pip - v5.0.9

Published by fcakyon about 3 years ago

yolov5-pip - v5.0.8

Published by fcakyon about 3 years ago

  • update to 24.08.21 ultralytics/yolov5

  • cli api changes:

Use from CLI

You can call yolov5 train, yolov5 detect, yolov5 val and yolov5 export commands after installing the package via pip:

Run 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).

$ yolov5 train --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 64
                                      yolov5m                                40
                                      yolov5l                                24
                                      yolov5x                                16

yolov5 detect command runs inference on a variety of sources, downloading models automatically from the latest YOLOv5 release and saving results to runs/detect.

$ yolov5 detect --img 1280 --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 stream

To run inference on example images in yolov5/data/images:

yolov5-pip - v5.0.7

Published by fcakyon over 3 years ago

  • remove check_requirements (#37)
yolov5-pip - v5.0.6

Published by fcakyon over 3 years ago

Install

pip install yolov5
pip install "numpy>=1.18.5,<1.20" "matplotlib>=3.2.2,<4"
pip install yolov5

Use from Python

import yolov5

# load model
model = yolov5.load('yolov5s')

# set image
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

# perform inference
results = model(img)

# inference with larger input size
results = model(img, size=1280)

# inference with test time augmentation
results = model(img, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, x2, y1, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()

# save results into "results/" folder
results.save(save_dir='results/')

from yolov5 import YOLOv5

# set model params
model_path = "yolov5/weights/yolov5s.pt" # it automatically downloads yolov5s model to given path
device = "cuda" # or "cpu"

# init yolov5 model
yolov5 = YOLOv5(model_path, device)

# load images
image1 = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
image2 = 'https://github.com/ultralytics/yolov5/blob/master/data/images/bus.jpg'

# perform inference
results = yolov5.predict(image1)

# perform inference with larger input size
results = yolov5.predict(image1, size=1280)

# perform inference with test time augmentation
results = yolov5.predict(image1, augment=True)

# perform inference on multiple images
results = yolov5.predict([image1, image2], size=1280, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, x2, y1, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()

# save results into "results/" folder
results.save(save_dir='results/')
  • You can directly use these functions by importing them:
from yolov5 import train, test, detect, export

train.run(imgsz=640, data='coco128.yaml')
test.run(imgsz=640, data='coco128.yaml', weights='yolov5s.pt')
detect.run(imgsz=640)
export.run(imgsz=640, weights='yolov5s.pt')
  • You can pass any argument as input:
from yolov5 import detect

img_url = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

detect.run(source=img_url, weights="yolov5s6.pt", conf_thres=0.25, imgsz=640)

Use from CLI

You can call yolo_train, yolo_detect, yolo_test and yolo_export commands after installing the package via pip:

Run 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).

$ yolo_train --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 64
                                    yolov5m                                40
                                    yolov5l                                24
                                    yolov5x                                16

yolo_detect command runs inference on a variety of sources, downloading models automatically from the latest YOLOv5 release and saving results to runs/detect.

$ yolo_detect --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 stream

To run inference on example images in yolov5/data/images:

yolov5-pip - v5.0.5

Published by fcakyon over 3 years ago

PLUS:

  • neptune ai support:
    yolo_train --data coco.yaml --weights yolov5s.pt --neptune_token YOUR_TOKEN --neptune_project YOUR/PROJECT

  • mmdet style metric logging support
    yolo_train --data coco.yaml --weights yolov5s.pt --mmdet_tags

Package Rankings
Top 2.43% on Pypi.org
Related Projects