The Ear Segmentation AI command-line interface provides easy access to all features.
After installing the package, the earsegmentationai
command will be available:
earsegmentationai --help
Display version information.
earsegmentationai version
Output:
Ear Segmentation AI v2.0.0
Python: 3.8.0
PyTorch: 1.13.0
Device: cuda (NVIDIA GeForce RTX 3080)
Model: earsegmentation_model_v1_46.pth
Process static images for ear segmentation.
earsegmentationai process-image [OPTIONS] PATH
Arguments:
PATH
: Path to image file or directoryOptions:
--output, -o PATH
: Output directory for results--device, -d TEXT
: Processing device (cpu, cuda:0) [default: cpu]--threshold, -t FLOAT
: Binary threshold [0.0-1.0] [default: 0.5]--save-mask
: Save segmentation mask--save-viz
: Save visualization image--batch-size, -b INTEGER
: Batch size for multiple images [default: 1]Examples:
# Process single image
earsegmentationai process-image image.jpg --save-viz
# Process directory with GPU
earsegmentationai process-image ./images --device cuda:0 --save-mask --save-viz
# Custom threshold
earsegmentationai process-image image.jpg --threshold 0.7 --output results/
Real-time camera/webcam processing.
earsegmentationai process-camera [OPTIONS]
Options:
--device-id, -i INTEGER
: Camera device ID [default: 0]--device, -d TEXT
: Processing device [default: cpu]--threshold, -t FLOAT
: Binary threshold [default: 0.5]--save-video PATH
: Save output video--fps INTEGER
: Output video FPS [default: 30]--skip-frames INTEGER
: Frames to skip [default: 0]--display/--no-display
: Show preview [default: display]Examples:
# Basic webcam processing
earsegmentationai process-camera
# Save video with GPU processing
earsegmentationai process-camera --device cuda:0 --save-video output.mp4
# Process alternate frames for performance
earsegmentationai process-camera --skip-frames 1
Process video files.
earsegmentationai process-video [OPTIONS] PATH
Arguments:
PATH
: Path to video fileOptions:
--output, -o PATH
: Output video path--device, -d TEXT
: Processing device [default: cpu]--threshold, -t FLOAT
: Binary threshold [default: 0.5]--skip-frames INTEGER
: Frames to skip [default: 0]--display/--no-display
: Show preview [default: no-display]--save-masks PATH
: Directory to save frame masksExamples:
# Basic video processing
earsegmentationai process-video input.mp4 -o output.mp4
# Process with preview
earsegmentationai process-video input.mp4 --display
# Save individual masks
earsegmentationai process-video input.mp4 --save-masks masks/
Run performance benchmarks.
earsegmentationai benchmark [OPTIONS] PATH
Arguments:
PATH
: Path to test imageOptions:
--device, -d TEXT
: Processing device [default: cpu]--iterations, -n INTEGER
: Number of iterations [default: 100]--warmup INTEGER
: Warmup iterations [default: 10]Examples:
# CPU benchmark
earsegmentationai benchmark test.jpg
# GPU benchmark with more iterations
earsegmentationai benchmark test.jpg --device cuda:0 --iterations 1000
Download the ear segmentation model.
earsegmentationai download-model [OPTIONS]
Options:
--force
: Force re-download even if exists--model-dir PATH
: Custom model directoryExamples:
# Download model
earsegmentationai download-model
# Force re-download
earsegmentationai download-model --force
These options work with all commands:
--help
: Show help message--quiet, -q
: Suppress info messages--verbose, -v
: Show debug messagesSet defaults using environment variables:
export EARSEGMENTATIONAI_DEVICE="cuda:0"
export EARSEGMENTATIONAI_THRESHOLD="0.6"
export EARSEGMENTATIONAI_MODEL_DIR="/custom/models/"
Or using a config file at ~/.earsegmentationai/config.yaml
:
processing:
device: cuda:0
threshold: 0.6
batch_size: 4
video:
fps: 30
skip_frames: 1
paths:
model_dir: /custom/models/
cache_dir: /custom/cache/
0
: Success1
: General error2
: Invalid arguments3
: File not found4
: Model download error5
: Processing errorDuring camera/video preview:
q
: Quits
: Save screenshotr
: Start/stop recordingSPACE
: Pause/resume+/-
: Adjust threshold