Bluesignal Vision AI project
Project description
Table of Contents
Installation
pip install bluevision
Usage
Simple video demo
from bluevision.demo import video_demo
video_demo(
weights="yolov8s-coco.safetensors",
video_path="sample.mp4",
model_size="s",
track=True,
show=True,
save_path="output.mp4",
)
Video Inference Process
import cv2
import supervision as sv
import bluevision as bv
from bluevision.utils import to_supervision_detections, make_labels
# Initialize
detector = bv.solutions.Detector(model=bv.solutions.detector.models.Yolov8(size='s'),
nms=bv.utils.nms.soft_nms,
weights="yolov8s.safetensors")
tracker = bv.utils.tracker.BYTETracker(track_thresh=0.15, match_thresh=0.9,
track_buffer=60, frame_rate=30)
box_annotator = sv.BoundingBoxAnnotator(thickness=2)
label_annotator = sv.LabelAnnotator(text_scale=0.5, text_padding=2)
# Load sample video
vid = cv2.VideoCapture('sample.mp4')
# Start
while True:
ret, original_image = vid.read()
if not ret:
break
detections = detector(original_image)
detections = tracker.update(detections)
# Draw bboxes using supervision
sv_detections = to_supervision_detections(detections)
annotated_frame = box_annotator.annotate(
scene=original_image,
detections=sv_detections,
)
annotated_frame = label_annotator.annotate(
scene=annotated_frame,
detections=sv_detections,
labels=make_labels(sv_detections)
)
cv2.imshow('annotated image', annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
BlueVision
Solution
Utils
Test
$ python test_with_time.py
Using device: mps
preprocess: 0.00225s, infer: 0.015508s, postprocess: 0.01313s, track: 0.00108s, draw: 0.000670s, total: 0.03462s, t-avg: 0.03576s
total frame : 1050
total elapsed time: 56.25610s
total inference time: 37.55273s
License
bluevision
is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
bluevision-0.0.6-py3-none-any.whl
(23.4 kB
view hashes)
Close
Hashes for bluevision-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cfd0b361a175175cba2be691eae8c5d6ca149a4de81a2144aa09a1110733b57 |
|
MD5 | a4c8a0b9984d4aca8e8414710334dc05 |
|
BLAKE2b-256 | 5457ef8a68b900f148c37a6e08247323ca07604da776a72e674eac17f86fa238 |