Skip to main content

YOLO segmentation utilities for video streams

Project description

mini_vision

Simple Python library for object segmentation in video streams using YOLO models.

The goal of this library is to provide a modular pipeline to:

  • consume video streams
  • perform object segmentation
  • render contours or masks

The library follows data-oriented design and low coupling principles, allowing easy replacement of computer vision models.


Installation

pip install mini-vision

Usage

Example showing how to use vision-seg to consume a video stream, run YOLO segmentation, and render object contours.

Import the library

from vision_seg import (
    YoloSegmenter,
    SegmentationRenderer,
    WSFrameClient
)

Components:

Component Description
YoloSegmenter Runs object segmentation using a YOLO segmentation model
SegmentationRenderer Draws segmentation contours on the frame
WSFrameClient Connects to a WebSocket video stream and yields frames

YoloSegmenter

Runs object segmentation using a YOLO segmentation model.

segmenter = YoloSegmenter("yolov8n-seg.pt")
detections = segmenter.segment(frame)

SegmentationRenderer

Responsible for rendering segmentation contours on frames.

renderer = SegmentationRenderer()
frame = renderer.draw(
    frame,
    detections,
    mode="contour",
    detect_object=["car","person","dog"],
    detect_color=["gold","neon_pink","lime"],
    thickness=2
)

WSFrameClient

Connects to a WebSocket video stream and yields frames.

client = WSFrameClient("ws://127.0.0.1:8000/ws/frames")
async for frame in client.frames():

descricao

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mini_vision-0.2.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mini_vision-0.2.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file mini_vision-0.2.3.tar.gz.

File metadata

  • Download URL: mini_vision-0.2.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for mini_vision-0.2.3.tar.gz
Algorithm Hash digest
SHA256 cc7975daf232e1a2950d34c784fbbfe57371fcb82e00c08c3623025dc1331628
MD5 474dd35522ee8857973a4cf020f60ac3
BLAKE2b-256 015dc4cb88ff39f13f8e5c8c4fb37051cf7187bcc1a0cea27ed59c98638fafe3

See more details on using hashes here.

File details

Details for the file mini_vision-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: mini_vision-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for mini_vision-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6cd7eb2d36025fc974c5a54fe2e2823a6eab472b20499a27fe31f139d258f902
MD5 0cf63767290b2a8083760faede243596
BLAKE2b-256 1662c76d134709640a4389833ee6ee78125d8bfc3b939b98f6a55526b58c463d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page