Skip to main content

LazyLabel

Python License

LazyLabel Logo LazyLabel Cursive

AI-Assisted Image Segmentation for Machine Learning Dataset Preparation

LazyLabel combines Meta's Segment Anything Model (SAM) with comprehensive manual annotation tools to accelerate the creation of pixel-perfect segmentation masks for computer vision applications.

LazyLabel Screenshot

Quick Start

pip install lazylabel-gui
lazylabel-gui

From source:

git clone https://github.com/dnzckn/LazyLabel.git
cd LazyLabel
pip install -e .
lazylabel-gui

Requirements: Python 3.10+, 8GB RAM, ~2.5GB disk space (for model weights)


Core Features

Annotation Tools

  • AI (SAM): Single-click segmentation with point-based refinement (SAM 1.0 & 2.1, GPU/CPU). Use negative points to subtract regions from the prediction.
  • Polygon: Vertex-level drawing and editing for precise boundaries
  • Box: Bounding box annotations for object detection. Hold Shift on release to erase with the box instead of adding.
  • Select: Click to select existing masks for editing, reclassing, or deletion. Hold Shift+Space to erase the overlap of a drawn segment from the selected mask.

Annotation Modes

  • Single View: Fine-tune individual masks with maximum precision
  • Multi View: Annotate up to 2 images simultaneously, ideal for objects in similar positions with slight variations
  • Sequence: Propagate a refined mask across thousands of frames using SAM 2's video predictor

Image Processing

  • FFT filtering: Remove noise and enhance edges
  • Channel thresholding: Isolate objects by color
  • Border cropping: Zero out pixels outside defined regions in saved outputs
  • View adjustments: Brightness, contrast, gamma correction, color saturation

Export Formats

Select one or more formats from Settings. All formats can be loaded back into LazyLabel.

NPZ - One-hot encoded mask tensors (.npz)

import numpy as np

data = np.load('image.npz')
mask = data['mask']  # Shape: (height, width, num_classes)

# Each channel represents one class
sky = mask[:, :, 0]
boats = mask[:, :, 1]
cats = mask[:, :, 2]
dogs = mask[:, :, 3]

Standard Formats

Format Output File Description
YOLO Detection image.txt Bounding boxes: class_id cx cy w h (normalized)
YOLO Segmentation image_seg.txt Polygon vertices: class_id x1 y1 x2 y2 ... (normalized)
COCO JSON image_coco.json Per-image COCO format with polygon segmentation, bounding boxes, and area
Pascal VOC image.xml XML bounding box annotations
CreateML image_createml.json Apple CreateML JSON with center-based bounding boxes

COCO supercategories: Set a class alias to name.supercategory (e.g. dog.animal) to populate the supercategory field in COCO JSON output.


Model Setup

SAM 1.0 models are downloaded automatically on first use.

If the automatic download doesn't work, you can manually download and place the model:

SAM 1.0

SAM 1.0 only requires the model weights file, no additional package installation needed.

  1. Download sam_vit_h_4b8939.pth from the SAM repository
  2. Place in LazyLabel's models folder:
    • Via pip: <site-packages>/lazylabel/models/ (run python -c "import lazylabel; print(lazylabel.__path__[0])" to find it)
    • From source: src/lazylabel/models/

SAM 2.1 (improved accuracy, required for Sequence mode)

SAM 2.1 requires both the sam2 package installed and the model weights file, since it relies on config files bundled with the package.

  1. Install SAM 2: pip install git+https://github.com/facebookresearch/sam2.git
  2. Download a model (e.g., sam2.1_hiera_large.pt) from the SAM 2 repository
  3. Place in LazyLabel's models folder:
    • Via pip: <site-packages>/lazylabel/models/ (run python -c "import lazylabel; print(lazylabel.__path__[0])" to find it)
    • From source: src/lazylabel/models/

Select the model from the dropdown in settings.


Building Windows Executable

Create a standalone Windows executable with bundled models for offline use:

Requirements:

  • Windows (native, not WSL)
  • Python 3.10+
  • PyInstaller: pip install pyinstaller

Build steps:

git clone https://github.com/dnzckn/LazyLabel.git
cd LazyLabel
python build_system/windows/build_windows.py

The executable will be created in dist/LazyLabel/. The entire folder (~7-8GB) can be moved anywhere and runs offline.


Documentation


Metadata

Release files for lazylabel-gui 1.7.0

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

Source distribution (sdist)

Source distribution for lazylabel-gui 1.7.0
File Size Uploaded
lazylabel_gui-1.7.0.tar.gz 249.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lazylabel-gui 1.7.0
File Interpreter ABI Platform
lazylabel_gui-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 542.1 kB

Release files / lazylabel_gui-1.7.0.tar.gz

Download URL lazylabel_gui-1.7.0.tar.gz
Size 249.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3c33d1cd30b65a8519add0da0a006ec9f8e1f56af434200a2ab95e722c2ad482
BLAKE2b-256 checksum
How to use checksums
78a71b61cf398e51791c83fbda44674eb364cc9bb86fc58fa030fc517e4d4781
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / lazylabel_gui-1.7.0-py3-none-any.whl

Download URL lazylabel_gui-1.7.0-py3-none-any.whl
Size 292.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3fac084d411a185a6c466baa3e97005304a38ffe328db422164b26bff93b829
BLAKE2b-256 checksum
How to use checksums
ea86d56ad234d5058d6cfe16a56ddf068a67668942b6a63542b486be2b8f2701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.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