From fb6da21ef312e0721c1fa364fc6765fa77570e65 Mon Sep 17 00:00:00 2001 From: fcakyon <34196005+fcakyon@users.noreply.github.com> Date: Tue, 22 Jun 2021 19:29:06 +0300 Subject: [PATCH] update readme (#35) --- README.md | 108 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index c02335e..45e38c9 100644 --- a/README.md +++ b/README.md @@ -7,45 +7,59 @@
+ total downloads + monthly downloads pypi version - downloads +
ci testing package testing
-## Overview - -You can finally install [YOLOv5 object detector](https://github.com/ultralytics/yolov5) using [pip](https://pypi.org/project/yolov5/) and integrate into your project easily. +##
Overview
+
+You can finally install YOLOv5 object detector using pip and integrate into your project easily. +

+
-## Installation +##
Install
-- Install yolov5 using pip `(for Python >=3.7)`: +
+Install yolov5 using pip (for Python >=3.7) ```console pip install yolov5 ``` -- Install yolov5 using pip `(for Python 3.6)`: +
+ +
+Install yolov5 using pip `(for Python 3.6)` ```console pip install "numpy>=1.18.5,<1.20" "matplotlib>=3.2.2,<4" pip install yolov5 ``` -## Basic Usage +
+ +##
Use from Python
+ + +
+Basic ```python import yolov5 -# model +# load model model = yolov5.load('yolov5s') -# image +# set image img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg' -# inference +# perform inference results = model(img) # inference with larger input size @@ -54,15 +68,24 @@ results = model(img, size=1280) # inference with test time augmentation results = model(img, augment=True) -# show results +# 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 +# save results into "results/" folder results.save(save_dir='results/') ``` -## Alternative Usage +
+ +
+Alternative ```python from yolov5 import YOLOv5 @@ -90,6 +113,12 @@ 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() @@ -97,11 +126,41 @@ results.show() results.save(save_dir='results/') ``` -## Scripts +
+ +
+Train/Detect/Test/Export + +- You can directly use these functions by importing them: + +```python +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: + +```python +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) + +``` -You can call yolo_train, yolo_detect and yolo_test commands after installing the package via `pip`: +
-### Training +##
Use from CLI
+ +You can call `yolo_train`, `yolo_detect`, `yolo_test` and `yolo_export` commands after installing the package via `pip`: + +
+Training Run commands below to reproduce results on [COCO](https://github.com/ultralytics/yolov5/blob/master/data/scripts/get_coco.sh) 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). @@ -112,7 +171,10 @@ $ yolo_train --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 64 yolov5x 16 ``` -### Inference +
+ +
+Inference yolo_detect command runs inference on a variety of sources, downloading models automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases) and saving results to `runs/detect`. @@ -129,12 +191,4 @@ $ yolo_detect --source 0 # webcam To run inference on example images in `yolov5/data/images`: -```bash -$ yolo_detect --source yolov5/data/images --weights yolov5s.pt --conf 0.25 -``` - -## Status - -Builds for the latest commit for `Windows/Linux/MacOS` with `Python3.6/3.7/3.8`: CI CPU testing - -Status for the train/detect/test scripts: Package CPU testing +