Skip to main content
signlang-segmenter Banner

PyPI Version Python Versions License

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

motion curve with segments

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:

  1. Install Miniconda if needed.
  2. 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_raw
  • motion_smooth
  • fps
  • frame_idx
  • th_high_arr
  • th_low_arr

Metadata

Release files for signlang-segmenter 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for signlang-segmenter 0.2.1
File Size Uploaded
signlang_segmenter-0.2.1.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for signlang-segmenter 0.2.1
File Interpreter ABI Platform
signlang_segmenter-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / signlang_segmenter-0.2.1.tar.gz

Download URL signlang_segmenter-0.2.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f20d750311de530f883233b46bff666158ae5ca1273b4666a8055dae36103128
BLAKE2b-256 checksum
How to use checksums
648a612629d8d12ae30300453dcb33243cf89e20e7a2e81aa1f6f68474051cc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / signlang_segmenter-0.2.1-py3-none-any.whl

Download URL signlang_segmenter-0.2.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec6f17ef1470b2948fb4b401f08ed67df11969b4a54ede1cf2c7b8d3697b8faf
BLAKE2b-256 checksum
How to use checksums
c61081a7b9d96bb5ac9a95eed11bb5b3ae4df0aea7fb04a90c025a4914912a2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page