Skip to main content

Image Polygonal Annotation with Python - V2 with 45x Faster Performance

Project description

LabelMe V2

Image Annotation Tool with Advanced Features & Performance Optimizations

PyPI Python Version Code style: ruff License Tests

Enhanced fork of wkentaro/labelme with 45x faster loading & productivity features


🎯 What's New in This Fork

This enhanced version adds powerful polygon editing features, 45x faster image loading, and improved defaults to speed up your annotation workflow:

Breakthrough Performance: 45x Faster Loading

The biggest improvement in this fork - optimized TIFF/JPG/PNG loading for massive images:

Image Size Before After Speedup
6050×12300 TIFF (71MB) 10 seconds 220ms 45x faster
Large JPG/PNG 2-3 seconds 200-400ms 10x faster
Cached images N/A <200ms Instant navigation

How it works:

  • ✅ Skip slow PIL conversion - load directly with Qt
  • ✅ Skip JSON base64 decode - load from file when possible
  • ✅ Smart image caching (3-image LRU cache)
  • ✅ Automatic downsampling for huge images

Perfect for: Industrial inspection, PCB analysis, medical imaging, aerial photography


✨ New Features

1. Performance Optimizations

Smooth annotation even with massive images and many polygons.

  • Viewport Culling: 5-10x faster rendering with 100+ polygons
  • Adaptive Downsampling: 4x less memory for large images (16000×8000)
  • Optimized Loading: 45x faster for large TIFF files
  • Configurable thresholds and quality settings
  • Works automatically - no manual intervention

Example: Annotate 16000×8000 PCB images with 500 polygons smoothly on 4GB RAM.

2. Enhanced Zoom (Up to 5000%)

Maximum zoom increased from 1000% to 5000% (50x magnification) for tiny defect annotation.

  • Configurable maximum zoom level
  • Adjustable zoom increment for smooth control
  • Perfect for PCB defects, microscopy, surface inspection
  • Mouse wheel zooms centered on cursor position

Example: Annotate hairline cracks or solder bridges with pixel-level precision.

3. Multiple Point Addition (Ctrl+M)

Quickly refine polygon boundaries by adding multiple evenly-spaced points along edges.

  • Hover over any polygon edge in edit mode
  • Press Ctrl+M and enter number of points (1-100)
  • Points are automatically distributed evenly
  • Perfect for curved edges or complex boundaries

Example: Add 10 points to a curved car windshield edge in one action instead of clicking 10 times.

4. Polygon Merge (Ctrl+Shift+M)

Merge multiple polygons into one or batch-apply labels to disconnected objects.

  • Select 2+ polygons (hold Ctrl while clicking)
  • Press Ctrl+Shift+M to merge
  • Smart handling:
    • Connected/overlapping → Single merged polygon
    • Disconnected objects → Multiple polygons with same label
    • Mixed → Intelligent separation based on connectivity

Example: Annotate 20 cars by drawing rough boxes, select all, merge once - all labeled "car" instantly.

5. Dark Mode (View → Dark Mode)

Eye-friendly dark theme inspired by VS Code.

  • Toggle instantly via View menu
  • Persistent setting saved in config
  • Reduces eye strain during long sessions
  • Professional color scheme

6. Improved Default Settings

Better defaults for faster annotation workflow:

Setting Old Default New Default Why?
auto_save false true Never lose work
store_data true false Smaller JSON files
keep_prev_brightness_contrast false true Consistent visuals
dark_mode N/A true Eye comfort
canvas.fill_drawing true false See through shapes
canvas.num_backups 10 20 More undo history
max_zoom 1000% 5000% 5x more zoom

7. Better Keyboard Shortcuts

More intuitive shortcuts that don't conflict:

Action Old Shortcut New Shortcut
Create Polygon Ctrl+N Ctrl+Shift+C
Create Rectangle Ctrl+R Ctrl+Shift+X
Edit Polygon Ctrl+J Ctrl+Shift+V

📦 Installation

From PyPI (Recommended)

pip install labelmev2

From Source

# Clone this enhanced version
git clone https://github.com/jakhon37/LabelMeV2.git
cd LabelMeV2

# Install with pip
pip install -e .

# Or use uv (faster)
uv pip install -e .

🚀 Quick Start

# Launch labelme
labelme

# Enable dark mode (if not already on)
View  Dark Mode

# Try the new features:
# 1. Draw a polygon
# 2. Press Ctrl+Shift+V to enter edit mode
# 3. Hover over an edge and press Ctrl+M
# 4. Enter "5" to add 5 points
# 5. Adjust the points as needed

New Feature Quick Reference

Feature Shortcut Usage
High Zoom (5000%) Mouse wheel Scroll on image to zoom up to 50x magnification
Add Multiple Points Ctrl+M Edit mode → Hover edge → Ctrl+M → Enter count
Merge Polygons Ctrl+Shift+M Select multiple → Ctrl+Shift+M
Dark Mode View menu View → Dark Mode (toggles instantly)
Edit Mode Ctrl+Shift+V Enter polygon editing mode

📚 Documentation

  • New Features Guide: docs/NEW_FEATURES.md
  • Contributing: CONTRIBUTING.md
  • Original Documentation: See wkentaro/labelme for:
    • Basic usage and examples
    • Export formats (VOC, COCO)
    • AI-assisted annotation
    • Command-line tools
    • Video annotation
    • Classification/segmentation workflows

🎬 Examples

Polygon Refinement Workflow

1. Draw rough polygon around object
2. Ctrl+Shift+V (edit mode)
3. Hover over curved edge
4. Ctrl+M → Enter "8" → OK
5. Adjust 8 new points to match boundary perfectly

Batch Labeling Workflow

1. Draw boxes around 15 cars (quick rough boxes)
2. Ctrl+Click each box to select all
3. Ctrl+Shift+M (merge)
4. Result: 15 separate polygons all labeled "car"

🔧 Configuration

Enhanced defaults in ~/.labelmerc:

# New/modified defaults
auto_save: true
dark_mode: true
store_data: false
keep_prev_brightness_contrast: true

# Zoom settings
zoom_increment: 1.45  # 45% per step (ultra fast for quick navigation)
max_zoom: 5000        # 5000% = 50x magnification

# New features config
default_num_points_to_add: 1

shortcuts:
  add_multiple_points: Ctrl+M
  merge_polygons: Ctrl+Shift+M
  create_polygon: Ctrl+Shift+C
  create_rectangle: Ctrl+Shift+X
  edit_polygon: Ctrl+Shift+V

🤝 Contributing

Contributions welcome! See CONTRIBUTING.md for:

  • Development setup
  • Code style guidelines
  • Testing procedures
  • Feature implementation details

📄 License

GPL-3.0-only - Same as original wkentaro/labelme


🙏 Acknowledgments & Credits

This project is based on wkentaro/labelme

This enhanced version builds upon the excellent foundation of the original labelme, adding:

Performance Enhancements by Jakhongir Nodirov:

  • ⚡ 45x faster image loading for large TIFF/JPG/PNG files
  • 🖼️ Smart image caching with LRU eviction
  • 🎨 Viewport culling for smooth rendering with hundreds of polygons
  • 📊 Optimized memory usage for massive images

New Features:

  • 🔍 Enhanced zoom up to 5000% for tiny defect inspection
  • ➕ Multiple point addition (Ctrl+M) for quick polygon refinement
  • 🔗 Polygon merge (Ctrl+Shift+M) for batch labeling
  • 🌙 Dark mode for comfortable annotation sessions
  • ⚙️ Improved default settings for faster workflows

Maintained by: Jakhongir Nodirov (jakhon37@gmail.com)

For the complete original labelme documentation and features, please visit the official repository.


⭐ Support

If you find these enhancements useful:

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

labelmev2-2.0.3.tar.gz (11.7 MB view details)

Uploaded Source

Built Distribution

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

labelmev2-2.0.3-py3-none-any.whl (512.3 kB view details)

Uploaded Python 3

File details

Details for the file labelmev2-2.0.3.tar.gz.

File metadata

  • Download URL: labelmev2-2.0.3.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for labelmev2-2.0.3.tar.gz
Algorithm Hash digest
SHA256 ad04bff0369560242727ae7cdb97adbc52af687f383aa0f8e9a9718fe6152603
MD5 f446e186ee03b104383ddffc36c5b1ed
BLAKE2b-256 f71f4e1f393f8e419633cd77232a2cb91a16357aedeeb202b15415f19baf25d5

See more details on using hashes here.

File details

Details for the file labelmev2-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: labelmev2-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 512.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for labelmev2-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 24c594330da85a47d33004b2eeb2bbbb103d794eba52e949b06f060e75f01e1d
MD5 c5f70f106a4a10aad09f85df347c33f6
BLAKE2b-256 1901372afca6a0b69a9420b810fb94701f144616b1f6ffc095871bcedda7a75c

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