yolov5-thin


Nameyolov5-thin JSON
Version 6.1.5 PyPI version JSON
download
home_pagehttps://github.com/SethWen/yolov5-pip.git
SummaryPackaged version of the Yolov5 object detector
upload_time2023-04-23 09:05:20
maintainer
docs_urlNone
author
requires_python>=3.6
licenseGPL
keywords machine-learning deep-learning ml pytorch yolo object-detection vision yolov3 yolov4 yolov5
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
  packaged ultralytics/yolov5
</h1>

<h4 align="center">
  pip install yolov5
</h4>

<div align="center">
  <a href="https://pepy.tech/project/yolov5"><img src="https://pepy.tech/badge/yolov5" alt="total downloads"></a>
  <a href="https://pepy.tech/project/yolov5"><img src="https://pepy.tech/badge/yolov5/month" alt="monthly downloads"></a>
  <a href="https://twitter.com/fcakyon"><img src="https://img.shields.io/twitter/follow/fcakyon?color=blue&logo=twitter&style=flat" alt="fcakyon twitter"></a>
  <br>
  <a href="https://badge.fury.io/py/yolov5"><img src="https://badge.fury.io/py/yolov5.svg" alt="pypi version"></a>
  <a href="https://github.com/fcakyon/yolov5-pip/actions/workflows/ci.yml"><img src="https://github.com/fcakyon/yolov5-pip/actions/workflows/ci.yml/badge.svg" alt="ci testing"></a>
  <a href="https://github.com/fcakyon/yolov5-pip/actions/workflows/package_testing.yml"><img src="https://github.com/fcakyon/yolov5-pip/actions/workflows/package_testing.yml/badge.svg" alt="package testing"></a>
</div>

## <div align="center">Overview</div>

<div align="center">
You can finally install <a href="https://github.com/ultralytics/yolov5">YOLOv5 object detector</a> using <a href="https://pypi.org/project/yolov5/">pip</a> and integrate into your project easily.

<img src="https://user-images.githubusercontent.com/26833433/136901921-abcfcd9d-f978-4942-9b97-0e3f202907df.png" width="1000">
</div>

<br>
This yolov5 package contains everything from ultralytics/yolov5 <a href="https://github.com/ultralytics/yolov5/tree/177da7f348181abdf4820ad26707eb8b3dd4fdc9">at this commit</a> plus:
<br>
1. Easy installation via pip: `pip install yolov5`
<br>
2. Full CLI integration with <a href="https://github.com/google/python-fire">fire</a> package
<br>
3. COCO dataset format support (for training)
<br>
4. <a href="https://aws.amazon.com/s3/">S3</a> support (model and dataset upload)
<br>
5. <a href="https://neptune.ai/">NeptuneAI</a> logger support (metric, model and dataset logging)
<br>
6. Classwise AP logging during experiments



## <div align="center">Install</div>

<details open>
<summary>Install yolov5 using pip (for Python >=3.7)</summary>

```console
pip install yolov5
```

</details>

<details closed>
<summary>Install yolov5 using pip `(for Python 3.6)`</summary>

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

</details>

## <div align="center">Use from Python</div>


<details open>
<summary>Basic</summary>

```python
import yolov5

# load model
model = yolov5.load('yolov5s')
  
# set model parameters
model.conf = 0.25  # NMS confidence threshold
model.iou = 0.45  # NMS IoU threshold
model.agnostic = False  # NMS class-agnostic
model.multi_label = False  # NMS multiple labels per box
model.max_det = 1000  # maximum number of detections per image

# 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, y1, x2, 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/')

```

</details>

<details closed>
<summary>Alternative</summary>

```python
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, y1, x2, 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/')
```

</details>

<details closed>
<summary>Train/Detect/Test/Export</summary>

- You can directly use these functions by importing them:

```python
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:

```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)

```

</details>

## <div align="center">Use from CLI</div>

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

<details open>
<summary>Training</summary>

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

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

- Start a training using a COCO formatted dataset:

```yaml
# data.yml
train_json_path: "train.json"
train_image_dir: "train_image_dir/"
val_json_path: "val.json"
val_image_dir: "val_image_dir/"
```

```bash
$ yolov5 train --data data.yaml --weights yolov5s.pt
```

- Visualize your experiments via [Neptune.AI](https://neptune.ai/) (neptune-client>=0.10.10 required):

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

- Automatically upload weights and datasets to AWS S3 (with Neptune.AI artifact tracking integration):

```bash
export AWS_ACCESS_KEY_ID=YOUR_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_KEY
```

```bash
$ 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.

```yaml
# 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/
```

</details>

<details open>
<summary>Inference</summary>

yolov5 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`.

```bash
$ 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
```

</details>

<details open>
<summary>Export</summary>

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

```bash
$ yolov5 export --weights yolov5s.pt --include 'torchscript,onnx,coreml,pb,tfjs'
```

</details>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SethWen/yolov5-pip.git",
    "name": "yolov5-thin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "machine-learning,deep-learning,ml,pytorch,YOLO,object-detection,vision,YOLOv3,YOLOv4,YOLOv5",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/0c/b6/a4adad40c65f447c9d428b85f76f41901d7d24020a3fd86599db59a7e443/yolov5-thin-6.1.5.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n  packaged ultralytics/yolov5\n</h1>\n\n<h4 align=\"center\">\n  pip install yolov5\n</h4>\n\n<div align=\"center\">\n  <a href=\"https://pepy.tech/project/yolov5\"><img src=\"https://pepy.tech/badge/yolov5\" alt=\"total downloads\"></a>\n  <a href=\"https://pepy.tech/project/yolov5\"><img src=\"https://pepy.tech/badge/yolov5/month\" alt=\"monthly downloads\"></a>\n  <a href=\"https://twitter.com/fcakyon\"><img src=\"https://img.shields.io/twitter/follow/fcakyon?color=blue&logo=twitter&style=flat\" alt=\"fcakyon twitter\"></a>\n  <br>\n  <a href=\"https://badge.fury.io/py/yolov5\"><img src=\"https://badge.fury.io/py/yolov5.svg\" alt=\"pypi version\"></a>\n  <a href=\"https://github.com/fcakyon/yolov5-pip/actions/workflows/ci.yml\"><img src=\"https://github.com/fcakyon/yolov5-pip/actions/workflows/ci.yml/badge.svg\" alt=\"ci testing\"></a>\n  <a href=\"https://github.com/fcakyon/yolov5-pip/actions/workflows/package_testing.yml\"><img src=\"https://github.com/fcakyon/yolov5-pip/actions/workflows/package_testing.yml/badge.svg\" alt=\"package testing\"></a>\n</div>\n\n## <div align=\"center\">Overview</div>\n\n<div align=\"center\">\nYou can finally install <a href=\"https://github.com/ultralytics/yolov5\">YOLOv5 object detector</a> using <a href=\"https://pypi.org/project/yolov5/\">pip</a> and integrate into your project easily.\n\n<img src=\"https://user-images.githubusercontent.com/26833433/136901921-abcfcd9d-f978-4942-9b97-0e3f202907df.png\" width=\"1000\">\n</div>\n\n<br>\nThis yolov5 package contains everything from ultralytics/yolov5 <a href=\"https://github.com/ultralytics/yolov5/tree/177da7f348181abdf4820ad26707eb8b3dd4fdc9\">at this commit</a> plus:\n<br>\n1. Easy installation via pip: `pip install yolov5`\n<br>\n2. Full CLI integration with <a href=\"https://github.com/google/python-fire\">fire</a> package\n<br>\n3. COCO dataset format support (for training)\n<br>\n4. <a href=\"https://aws.amazon.com/s3/\">S3</a> support (model and dataset upload)\n<br>\n5. <a href=\"https://neptune.ai/\">NeptuneAI</a> logger support (metric, model and dataset logging)\n<br>\n6. Classwise AP logging during experiments\n\n\n\n## <div align=\"center\">Install</div>\n\n<details open>\n<summary>Install yolov5 using pip (for Python >=3.7)</summary>\n\n```console\npip install yolov5\n```\n\n</details>\n\n<details closed>\n<summary>Install yolov5 using pip `(for Python 3.6)`</summary>\n\n```console\npip install \"numpy>=1.18.5,<1.20\" \"matplotlib>=3.2.2,<4\"\npip install yolov5\n```\n\n</details>\n\n## <div align=\"center\">Use from Python</div>\n\n\n<details open>\n<summary>Basic</summary>\n\n```python\nimport yolov5\n\n# load model\nmodel = yolov5.load('yolov5s')\n  \n# set model parameters\nmodel.conf = 0.25  # NMS confidence threshold\nmodel.iou = 0.45  # NMS IoU threshold\nmodel.agnostic = False  # NMS class-agnostic\nmodel.multi_label = False  # NMS multiple labels per box\nmodel.max_det = 1000  # maximum number of detections per image\n\n# set image\nimg = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'\n\n# perform inference\nresults = model(img)\n\n# inference with larger input size\nresults = model(img, size=1280)\n\n# inference with test time augmentation\nresults = model(img, augment=True)\n\n# parse results\npredictions = results.pred[0]\nboxes = predictions[:, :4] # x1, y1, x2, y2\nscores = predictions[:, 4]\ncategories = predictions[:, 5]\n\n# show detection bounding boxes on image\nresults.show()\n\n# save results into \"results/\" folder\nresults.save(save_dir='results/')\n\n```\n\n</details>\n\n<details closed>\n<summary>Alternative</summary>\n\n```python\nfrom yolov5 import YOLOv5\n\n# set model params\nmodel_path = \"yolov5/weights/yolov5s.pt\"\ndevice = \"cuda:0\" # or \"cpu\"\n\n# init yolov5 model\nyolov5 = YOLOv5(model_path, device)\n\n# load images\nimage1 = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'\nimage2 = 'https://github.com/ultralytics/yolov5/blob/master/data/images/bus.jpg'\n\n# perform inference\nresults = yolov5.predict(image1)\n\n# perform inference with larger input size\nresults = yolov5.predict(image1, size=1280)\n\n# perform inference with test time augmentation\nresults = yolov5.predict(image1, augment=True)\n\n# perform inference on multiple images\nresults = yolov5.predict([image1, image2], size=1280, augment=True)\n\n# parse results\npredictions = results.pred[0]\nboxes = predictions[:, :4] # x1, y1, x2, y2\nscores = predictions[:, 4]\ncategories = predictions[:, 5]\n\n# show detection bounding boxes on image\nresults.show()\n\n# save results into \"results/\" folder\nresults.save(save_dir='results/')\n```\n\n</details>\n\n<details closed>\n<summary>Train/Detect/Test/Export</summary>\n\n- You can directly use these functions by importing them:\n\n```python\nfrom yolov5 import train, val, detect, export\n\ntrain.run(imgsz=640, data='coco128.yaml')\nval.run(imgsz=640, data='coco128.yaml', weights='yolov5s.pt')\ndetect.run(imgsz=640)\nexport.run(imgsz=640, weights='yolov5s.pt')\n```\n\n- You can pass any argument as input:\n\n```python\nfrom yolov5 import detect\n\nimg_url = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'\n\ndetect.run(source=img_url, weights=\"yolov5s6.pt\", conf_thres=0.25, imgsz=640)\n\n```\n\n</details>\n\n## <div align=\"center\">Use from CLI</div>\n\nYou can call `yolov5 train`, `yolov5 detect`, `yolov5 val` and `yolov5 export` commands after installing the package via `pip`:\n\n<details open>\n<summary>Training</summary>\n\n- Finetune one of the pretrained YOLOv5 models using your custom `data.yaml`:\n\n```bash\n$ yolov5 train --data data.yaml --weights yolov5s.pt --batch-size 16 --img 640\n                                          yolov5m.pt              8\n                                          yolov5l.pt              4\n                                          yolov5x.pt              2\n```\n\n- Start a training using a COCO formatted dataset:\n\n```yaml\n# data.yml\ntrain_json_path: \"train.json\"\ntrain_image_dir: \"train_image_dir/\"\nval_json_path: \"val.json\"\nval_image_dir: \"val_image_dir/\"\n```\n\n```bash\n$ yolov5 train --data data.yaml --weights yolov5s.pt\n```\n\n- Visualize your experiments via [Neptune.AI](https://neptune.ai/) (neptune-client>=0.10.10 required):\n\n```bash\n$ yolov5 train --data data.yaml --weights yolov5s.pt --neptune_project NAMESPACE/PROJECT_NAME --neptune_token YOUR_NEPTUNE_TOKEN\n```\n\n- Automatically upload weights and datasets to AWS S3 (with Neptune.AI artifact tracking integration):\n\n```bash\nexport AWS_ACCESS_KEY_ID=YOUR_KEY\nexport AWS_SECRET_ACCESS_KEY=YOUR_KEY\n```\n\n```bash\n$ yolov5 train --data data.yaml --weights yolov5s.pt --s3_upload_dir YOUR_S3_FOLDER_DIRECTORY --upload_dataset\n```\n\n- Add `yolo_s3_data_dir` into `data.yaml` to match Neptune dataset with a present dataset in S3.\n\n```yaml\n# data.yml\ntrain_json_path: \"train.json\"\ntrain_image_dir: \"train_image_dir/\"\nval_json_path: \"val.json\"\nval_image_dir: \"val_image_dir/\"\nyolo_s3_data_dir: s3://bucket_name/data_dir/\n```\n\n</details>\n\n<details open>\n<summary>Inference</summary>\n\nyolov5 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`.\n\n```bash\n$ yolov5 detect --source 0  # webcam\n                         file.jpg  # image\n                         file.mp4  # video\n                         path/  # directory\n                         path/*.jpg  # glob\n                         rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa  # rtsp stream\n                         rtmp://192.168.1.105/live/test  # rtmp stream\n                         http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8  # http stream\n```\n\n</details>\n\n<details open>\n<summary>Export</summary>\n\nYou can export your fine-tuned YOLOv5 weights to any format such as `torchscript`, `onnx`, `coreml`, `pb`, `tflite`, `tfjs`:\n\n```bash\n$ yolov5 export --weights yolov5s.pt --include 'torchscript,onnx,coreml,pb,tfjs'\n```\n\n</details>\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "Packaged version of the Yolov5 object detector",
    "version": "6.1.5",
    "split_keywords": [
        "machine-learning",
        "deep-learning",
        "ml",
        "pytorch",
        "yolo",
        "object-detection",
        "vision",
        "yolov3",
        "yolov4",
        "yolov5"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1762856fcabb274db8c5d95bdd23da469b97211b3f4d73f334b7ba70843aeed2",
                "md5": "9b0d846a88ed4cf1a7faa6794003a7b3",
                "sha256": "0bd082b175fcc2f23c5cc450a6dc5a25b8c6057d01f53ff062dae05e92280c41"
            },
            "downloads": -1,
            "filename": "yolov5_thin-6.1.5-py36.py37.py38-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b0d846a88ed4cf1a7faa6794003a7b3",
            "packagetype": "bdist_wheel",
            "python_version": "py36.py37.py38",
            "requires_python": ">=3.6",
            "size": 810579,
            "upload_time": "2023-04-23T09:03:45",
            "upload_time_iso_8601": "2023-04-23T09:03:45.935006Z",
            "url": "https://files.pythonhosted.org/packages/17/62/856fcabb274db8c5d95bdd23da469b97211b3f4d73f334b7ba70843aeed2/yolov5_thin-6.1.5-py36.py37.py38-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cb6a4adad40c65f447c9d428b85f76f41901d7d24020a3fd86599db59a7e443",
                "md5": "2b918e8a8ee04549875ba6906811f782",
                "sha256": "cc86caa733229428afa6ba8fc9210d89ebd809edb82a4de545ffa1a840b1ecfa"
            },
            "downloads": -1,
            "filename": "yolov5-thin-6.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "2b918e8a8ee04549875ba6906811f782",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 754559,
            "upload_time": "2023-04-23T09:05:20",
            "upload_time_iso_8601": "2023-04-23T09:05:20.271797Z",
            "url": "https://files.pythonhosted.org/packages/0c/b6/a4adad40c65f447c9d428b85f76f41901d7d24020a3fd86599db59a7e443/yolov5-thin-6.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-23 09:05:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "SethWen",
    "github_project": "yolov5-pip.git",
    "lcname": "yolov5-thin"
}
        
Elapsed time: 0.06688s