Skip to main content

An image segmentation GUI for generating ML ready mask tensors and annotations.

Project description

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)
  • Polygon: Vertex-level drawing and editing for precise boundaries
  • Box: Bounding box annotations for object detection
  • Subtract: Remove regions from existing masks

Annotation Modes

  • Single View: Fine-tune individual masks with maximum precision
  • Multi View: Annotate up to 4 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

One-hot encoded 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]

Bounding boxes (.txt)

0 0.456 0.312 0.128 0.095
1 0.623 0.478 0.204 0.167

Each line: class x_center y_center width height — all values normalized to 0–1 relative to image dimensions

Class Aliases (.json)

{
  "0": "background",
  "1": "person",
  "2": "vehicle"
}

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: ~/.local/share/lazylabel/models/
    • 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: ~/.local/share/lazylabel/models/
    • 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


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

lazylabel_gui-1.6.17.tar.gz (243.1 kB view details)

Uploaded Source

Built Distribution

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

lazylabel_gui-1.6.17-py3-none-any.whl (281.4 kB view details)

Uploaded Python 3

File details

Details for the file lazylabel_gui-1.6.17.tar.gz.

File metadata

  • Download URL: lazylabel_gui-1.6.17.tar.gz
  • Upload date:
  • Size: 243.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for lazylabel_gui-1.6.17.tar.gz
Algorithm Hash digest
SHA256 f6b29eaaa47a54bbbb73ce32175ac8a7ab265c6d7bb771a6d838e88a22ce638b
MD5 19d2cb3a08b239395f69c7bbeb608f41
BLAKE2b-256 261af5546a525f3aed437c654856cb1c6b842054c2b3b786caf1dc60b17db073

See more details on using hashes here.

File details

Details for the file lazylabel_gui-1.6.17-py3-none-any.whl.

File metadata

  • Download URL: lazylabel_gui-1.6.17-py3-none-any.whl
  • Upload date:
  • Size: 281.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for lazylabel_gui-1.6.17-py3-none-any.whl
Algorithm Hash digest
SHA256 46723a84093ddb7ba8b6cadf9727e0a7dfe240b8fad2e4311bcb42b53d7a9156
MD5 a6b21ebad6a0ce981afe3a71abfc17c1
BLAKE2b-256 8defbba7bac33a5fef48247570cb7de2fca31d949a7fc454c96a0668b6edc7cc

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