Skip to main content

A Python library for sign language video and pose segmentation.

Project description

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

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

signlang_segmenter-0.2.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

signlang_segmenter-0.2.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file signlang_segmenter-0.2.1.tar.gz.

File metadata

  • Download URL: signlang_segmenter-0.2.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for signlang_segmenter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f20d750311de530f883233b46bff666158ae5ca1273b4666a8055dae36103128
MD5 d7565f716a7a8a7a5fc6fc8a15f510ff
BLAKE2b-256 648a612629d8d12ae30300453dcb33243cf89e20e7a2e81aa1f6f68474051cc9

See more details on using hashes here.

File details

Details for the file signlang_segmenter-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for signlang_segmenter-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec6f17ef1470b2948fb4b401f08ed67df11969b4a54ede1cf2c7b8d3697b8faf
MD5 bff932933fe58da4e98111cf0466e247
BLAKE2b-256 c61081a7b9d96bb5ac9a95eed11bb5b3ae4df0aea7fb04a90c025a4914912a2b

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