logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

Updated 1 year ago

object-detection

Object Detection with Yolov5

author: shiyu22


Description

Object Detection is a computer vision technique that locates and identifies people, items, or other objects in an image. Object detection has applications in many areas of computer vision, including image retrieval, image annotation, vehicle counting, object tracking, etc.

This operator uses PyTorch.yolov5 to detect the object.


Code Example

Load an image from path './test.png' and use yolov5 model to detect objects in the image.

Write a same pipeline with explicit inputs/outputs name specifications:

from towhee import pipe, ops, DataCollection

p = (
    pipe.input('path')
        .map('path', 'img', ops.image_decode())
        .map('img', ('box', 'class', 'score'), ops.object_detection.yolov5())
        .map(('img', 'box'), 'object', ops.image_crop(clamp=True))
        .output('img', 'object', 'class')
)

DataCollection(p('./test.png')).show()
result


Factory Constructor

Create the operator via the following factory method:

object_detection.yolov5()


Interface

The operator takes an image as input. It first detects the objects appeared in the image, and generates a bounding box around each object.

Parameters:

img: numpy.ndarray

​ Image data in ndarray format.

Return: List[List[(int, int, int, int)], ...], List[str], List[float]

The return value is a tuple of (boxes, classes, scores). The boxes is a list of bounding boxes. Each bounding box is represented by the top-left and the bottom right points, i.e. (x1, y1, x2, y2). The classes is a list of prediction labels. The scores is a list of confidence scores.

shiyu22 4a9bf27bc0 Add ultralytics 25 Commits
folder-icon models Add models 2 years ago
file-icon .gitattributes
1.1 KiB
download-icon
Initial commit 3 years ago
file-icon README.md
1.8 KiB
download-icon
remove dc2 2 years ago
file-icon __init__.py
61 B
download-icon
Update yolov5 README 3 years ago
file-icon requirements.txt
104 B
download-icon
Add ultralytics 1 year ago
file-icon result.png
270 KiB
download-icon
Update for new pipe 2 years ago
file-icon test.png
257 KiB
download-icon
Update yolov5 README 3 years ago
file-icon yolov5.py
1.0 KiB
download-icon
Update the custom path 2 years ago