A Python library for sign language video and pose segmentation.
Project description
signlang-segmenter
A Python library for segmenting and clipping sign language videos into meaningful units. It provides dual capabilities: intelligent segmentation based on motion analysis, and fast, precise video clipping based on timestamp annotations. Includes tools for visualizing motion curves and exporting segmented video clips.
Optical Flow
Installation
Option 1: Install the library to use it
pip install signlang-segmenter
Or install it directly from GitHub:
python -m pip install "git+https://github.com/24-mohamedyehia/signlang-segmenter.git"
Option 2: Install the project for development
If you want to modify the code and contribute, use an isolated environment and editable install:
- Install Miniconda if needed.
- Run:
git clone https://github.com/24-mohamedyehia/signlang-segmenter.git
cd signlang-segmenter
conda create -n signlang-segmenter python=3.11 -y
conda activate signlang-segmenter
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
Quick Import Check
import signlang_segmenter
import signlang_segmenter.video
import signlang_segmenter.pose
Timecode Clipping API
Fast snippet extraction based on manual annotation tools or generated timecodes:
from signlang_segmenter.video import split_video_with_timecode
output = split_video_with_timecode(
annotations_dir="./annotations",
videos_dir="./videos",
output_dir="./clips",
csv_file="./annotations.csv",
)
Motion Segmentation API
from signlang_segmenter.video import VideoSegmenter, SegmentExporter
segmenter = VideoSegmenter(
roi_mode="full",
smooth_window=11,
min_len_sec=0.30,
merge_gap_sec=0.45,
pad_before_frames=10,
pad_after_frames=12,
)
segments, info = segmenter.segment(VIDEO_PATH)
print(f"Found {len(segments)} segments: {segments}")
exporter = SegmentExporter(out_dir="../output/segments_out")
exporter.export(VIDEO_PATH, segments)
Visualization
from signlang_segmenter.video import plot_motion_segments
plot_motion_segments(segments, info)
The plot includes:
- motion raw curve
- motion smooth curve
- adaptive high/low thresholds
- shaded spans for detected segments
The info dict returned by VideoSegmenter.segment must include:
motion_rawmotion_smoothfpsframe_idxth_high_arrth_low_arr
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
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 signlang_segmenter-0.2.0.tar.gz.
File metadata
- Download URL: signlang_segmenter-0.2.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df65fbf7fbb2eb66518dea79db64ca943d096c8d0f5a9caeeb74e61a28c1ab9c
|
|
| MD5 |
48853bfc43deb36bbb09aedd2d6de464
|
|
| BLAKE2b-256 |
bc0303cc12929df8a19169dfa08f0fc0ebc06c3d35529fc447083953bdf0e084
|
File details
Details for the file signlang_segmenter-0.2.0-py3-none-any.whl.
File metadata
- Download URL: signlang_segmenter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5b057e6acb7e38252efb103ce209a083a76299e494e6c23846ea59b5f945d3b
|
|
| MD5 |
52f34199dfdde48df019d8f10e03dd9c
|
|
| BLAKE2b-256 |
d0edc05671b3697c11df8715e30a750d963c533294f0880ee55b0f8fcc9c8cd2
|