SPEK: Simple Python Extraction Kit - Easy YOLOv8 Object Detection
Project description
SPEK - Simple Python Extraction Kit
SPEK is a simple Python library for real-time object detection using YOLOv8 and OpenCV.
It supports webcam, video, or static image detection and is designed for ease of use.
Features
- Live detection from webcam or video files
- Static image detection
- Filter detection by specific class (e.g., person, dog, car)
- Headless mode (no preview window) for servers
- Callbacks on detection for custom behavior
- Quick-start helper functions
Installation
pip install spek
Usage/Examples
1 Live webcam detection (default)
import spek
# model sizes are n, s, m, l, x
# Detect "person" using YOLOv8s model on webcam
# target_class="person" targets a person
spek.run_live_detection(target_class="person", model_name_or_size="s")
2 Detect a specific target class and run a function
from spek import detect_objects
# Define the callback function
def your_function(info):
print("Detected person")
# Run detection for "person"
detect_objects(
target_class="person",
on_detected=your_function,
source=0,
model_size="s"
)
or
from spek import detect_objects
# Define the callback function
def your_function(info):
print("Detected person")
# Run detection for "person"
detect_objects(target_class="person", on_detected=your_function, source=0, model_size="s")
3 Detect objects from a video file
from spek import detect_objects
# Detect objects from a local video file
detect_objects(source="video.mp4", model_size="m")
4 Detect objects from a static image
from spek import detect_objects
# Detect objects in a single image
detect_objects(source="image.jpg", model_size="l")
5 Run in headless mode (no display, useful for servers)
from spek import detect_objects
# Process webcam feed without displaying window
detect_objects(source=0, model_size="s", headless=True)
6 CLI usage After installation, you can run live detection from the command line:
python -m spek --source 0 --target person --model s
7 Static image via CLI
python -m spek --image input.jpg --target dog --model m
Authors
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spek-0.0.4.tar.gz.
File metadata
- Download URL: spek-0.0.4.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a77bdefd883f186095b1de529b4e6a00360f6eaf08a99f79e75122a2d63bd05
|
|
| MD5 |
dcfd5b6f4041a1efc78355a0a4ff9344
|
|
| BLAKE2b-256 |
94ee1b913723a603a98b9809f9c638a8f29a695ea0b72532043e0ea3fd5adcf5
|
File details
Details for the file spek-0.0.4-py3-none-any.whl.
File metadata
- Download URL: spek-0.0.4-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afb3e2f3e0df70cd6839a80d88234c7f785923a81aaa23f6dab4c74e106e0903
|
|
| MD5 |
25160fdcd9614e0ac26b3755ee6e485e
|
|
| BLAKE2b-256 |
243050a028e35038845f1702d8a9fc2e21c25fff2e1f3f1680baf49d2cf1694c
|