MoonLabel
An object-detection and image-caption dataset tool.
Powered by Multimodal LLMs (OpenAI, Gemini, Claude, Ollama, OpenRouter, vLLM) & Moondream VLM
Overview
MoonLabel is both a Python library and a lightweight web UI to generate object-detection and image-caption datasets quickly.
- Use the library to auto-label folders of images and export YOLO, COCO, VOC, or Captions.
- Or launch the UI, switch between Detection/Caption, and export with one click.
Supported backends:
- Multimodal LLMs (zero extra dependencies): the OpenAI, Google Gemini, and Anthropic APIs, plus Ollama, OpenRouter, and any OpenAI-compatible endpoint (vLLM, LM Studio, Groq, Together, and similar). You pass the model id that API serves; MoonLabel does not pin a model.
- Moondream VLM: Moondream Cloud, Moondream Station, or fully local (Hugging Face).
- Custom backends: Implement
VisionBackendto plug in any custom vision model.
Demo
https://github.com/user-attachments/assets/a2dfc6b6-c83d-4296-986b-ac221e10fc3b
Features
- 🤖 Multimodal LLM support — OpenAI, Google Gemini, and Anthropic APIs, plus Ollama, OpenRouter, and any OpenAI-compatible vision API.
- 📦 Library + UI —
moonlabelpackage with an optional web UI. - 🌐 FastAPI server — Served by a single
moonlabel-uicommand. - ⚛️ Modern frontend — React, TypeScript, TailwindCSS, Vite.
- 🖼️ Object detection — Single-pass multi-class detection with Multimodal LLMs, plus Moondream Cloud / Station / Local HF.
- 📝 Image caption datasets — Export captions as
captions.jsonlalongside images, with length presets or custom prompts. - ⚡ GPU-accelerated & offline — Local Ollama, vLLM, Moondream Station, and Hugging Face modes run fully offline.
Install
- Library only (Multimodal LLMs + Moondream Cloud/Station):
pip install moonlabel
- Library + UI server:
pip install "moonlabel[ui]"
- Local Moondream (Hugging Face) extras:
pip install "moonlabel[local]"
- Both UI and local Hugging Face inference:
pip install "moonlabel[ui,local]"
Quick Start (UI)
pip install "moonlabel[ui]"
moonlabel-ui # opens http://localhost:8342
Choose a provider in Settings:
- Multimodal LLMs: OpenAI, Google Gemini, Anthropic Claude, Ollama (Local), OpenRouter, or OpenAI-Compatible (vLLM / LM Studio / custom
base_url) - Moondream: Cloud (API key), Station (
http://localhost:2020/v1), or Local (Hugging Face)
In the Home page:
- Use the top toggle to select Detection or Caption dataset.
- For Caption, choose length (
short/normal/long) or enter an optional custom prompt, then generate and export.
Quick Start (Library)
Using Multimodal LLMs
Pass provider for the API you are calling and model as the id that API serves. MoonLabel does not bundle or recommend a model. API keys can be passed via api_key=... or read from OPENAI_API_KEY, GEMINI_API_KEY / GOOGLE_API_KEY, ANTHROPIC_API_KEY, or OPENROUTER_API_KEY.
from moonlabel import create_dataset
# OpenAI, Gemini, or Anthropic API
create_dataset(
"/path/to/images",
objects=["person", "car"],
provider="openai", # "gemini" or "anthropic"
model="MODEL_ID",
api_key="YOUR_API_KEY",
)
# OpenRouter
create_dataset(
"/path/to/images",
objects=["car", "traffic light"],
provider="openrouter",
model="MODEL_ID",
api_key="YOUR_API_KEY",
)
# Ollama, or any OpenAI-compatible server (vLLM, LM Studio, Groq, Together, ...)
create_dataset(
"/path/to/images",
objects=["laptop", "cup"],
provider="ollama", # or "openai-compatible"
model="MODEL_ID",
base_url="http://localhost:11434/v1",
)
Using Moondream (Cloud / Station / Local)
from moonlabel import create_dataset
# Cloud
create_dataset("/path/to/images", objects=["person"], api_key="YOUR_API_KEY")
# Station
create_dataset("/path/to/images", objects=["car"], station_endpoint="http://localhost:2020/v1")
# Local (after: pip install "moonlabel[local]")
create_dataset("/path/to/images", objects=["bottle"]) # no key needed
Export Formats
By default create_dataset exports YOLO. Choose formats via export_format:
# YOLO (default)
create_dataset("/path/to/images", objects=["person"], export_format="yolo", provider="gemini")
# COCO
create_dataset("/path/to/images", objects=["person", "car"], export_format="coco", provider="openai")
# Pascal VOC
create_dataset("/path/to/images", objects=["cat", "dog"], export_format="voc", provider="anthropic")
# Image Captioning (short | normal | long)
create_dataset("/path/to/images", export_format="caption", caption_length="normal", provider="openai")
# Image Captioning with a custom prompt
create_dataset(
"/path/to/images",
export_format="caption",
caption_prompt="Describe the product and any visible surface defects in one sentence.",
provider="gemini",
)
Output layouts:
- YOLO:
images/,labels/,classes.txt - COCO:
images/,annotations/instances.json,classes.txt - VOC:
images/,annotations/*.xml,classes.txt - Caption:
images/,annotations/captions.jsonl
Direct Inference & Custom Backends
You can also run inference directly on single images or implement a custom VisionBackend:
from moonlabel import MultimodalInference, VisionBackend, create_dataset
client = MultimodalInference(provider="gemini", model="MODEL_ID")
image, detections = client.detect("photo.jpg", ["person", "car"])
image, caption = client.caption("photo.jpg", length="normal")
# Or pass a pre-configured / custom VisionBackend directly
create_dataset("/path/to/images", objects=["person"], backend=client)
Moondream Station Mode
The backend can connect to a running Moondream Station instance for fast, native, on-device inference.
- Download, install, and run Moondream Station.
- Ensure the endpoint matches your Station configuration (default:
http://localhost:2020/v1).
Local Mode (Hugging Face)
The backend can run fully offline using the open-source Moondream checkpoint on Hugging Face.
pip install "moonlabel[local]"- In the UI, select Moondream Local (HF) (no API key required).
The first detection will trigger a one-off model download to ~/.cache/huggingface/; subsequent runs reuse the cached weights.
GPU / Device selection
The backend chooses the best device automatically in the following order: CUDA → Apple Silicon (MPS) → CPU.
Override via environment variable before launching the backend:
# Force GPU
export MOONDREAM_DEVICE=cuda
# Force Apple Silicon
export MOONDREAM_DEVICE=mps
# CPU only
export MOONDREAM_DEVICE=cpu
Project Structure
moonlabel/
├── src/moonlabel/ # Python package (library + server)
│ ├── backends.py # Multimodal LLM backends (OpenAI, Gemini, Anthropic, Ollama, OpenRouter, Custom)
│ ├── dataset.py # create_dataset API
│ ├── infer.py # Moondream wrapper (cloud/station/local) + re-exports
│ ├── types.py # shared types
│ ├── utils.py # helpers
│ ├── yolo.py # YOLO label writer
│ ├── coco.py # COCO writer
│ ├── voc.py # Pascal VOC XML writer
│ └── server/ # FastAPI app + static assets
│ ├── api.py
│ ├── cli.py # moonlabel-ui entrypoint (port 8342)
│ └── static/ # embedded UI build (no npm for users)
├── ui/ # Frontend source (for maintainers)
│ └── dist/ # Built files to embed
├── scripts/embed_ui.py # Copies ui/dist → src/moonlabel/server/static
├── Makefile # make ui-build, ui-embed, release
└── pyproject.toml
Roadmap / TODOs
Below are planned enhancements and upcoming features. Contributions welcome!
- Multimodal LLM support – OpenAI, Google Gemini, and Anthropic APIs, plus Ollama, OpenRouter, and OpenAI-compatible endpoints.
- Local Hugging Face model support – Offline inference with optional GPU acceleration.
- Moondream Station integration – Native Mac/Linux app support for on-device inference.
- Batch uploads – Label multiple images in one go, with progress tracking.
- Additional export formats – COCO JSON and Pascal VOC alongside YOLO.
License
This project is licensed under the terms of the Apache License 2.0. See LICENSE for details.
Metadata
Release files for moonlabel 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moonlabel-0.2.2.tar.gz | 160.1 kB | Without provenance | Details for moonlabel-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moonlabel-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for moonlabel-0.2.2-py3-none-any.whl |
Total release size: 316.1 kB
Release files / moonlabel-0.2.2.tar.gz
| Download URL | moonlabel-0.2.2.tar.gz |
|---|---|
| Size | 160.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1149bd1841e05ee7975dbea9ef0720572d063b5ebe8684ce59ef4dd5dce55bb4
|
|
BLAKE2b-256 checksum How to use checksums |
0fe5b6986101157232a602d63fc37c6fba4e8fb8a2f1665137a24577877d89fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / moonlabel-0.2.2-py3-none-any.whl
| Download URL | moonlabel-0.2.2-py3-none-any.whl |
|---|---|
| Size | 156.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41b2faac01554ee5141cfdb04ff27f16cf6a1e2518a9e5a0eef4ebdcd5eee887
|
|
BLAKE2b-256 checksum How to use checksums |
b4879cf8c034148f598197123fb7810fca7eb68d096efee9426030863489270a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for moonlabel 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.