
Xiaomi Research (Apache 2.0)
Share this post:
Xiaomi Lens 0: Open Source Prompt Segmentation AI
Xiaomi-Lens-0 (xiaomi-research/xiaomi-lens-0) is a 4B parameter Apache 2.0 grounded multimodal model released by Xiaomi Research in October 2026 that turns natural language instructions into pixel accurate segmentation masks and bounding boxes. Built on Qwen3.5-4B with a lightweight mask decoder, it handles referring expression segmentation, multi instance grounding, and reasoning based object isolation inside one compact model. You can test Xiaomi-Lens-0 free right now in the embedded browser demo below with zero login.
Studio availability. Try the public Hugging Face demo below; Xiaomi-Lens-0 is not part of a paid AI FILMS Studio plan (use BEN2 Background Remover in the image workspace for example instead).
Try Xiaomi-Lens-0 Live in Your Browser
Upload a frame or pick one of the example images in the public Hugging Face Space below. Type a natural language referring instruction such as "Locate all instances that match the description and report bbox coordinates and masks" to preview the composited segmentation overlay immediately.
Architecture and Technical Design
Traditional rotoscoping tools isolate either a single foreground subject or require manual point clicks on every prop. Xiaomi-Lens-0 (arXiv:2610.23279) takes a grounded multimodal approach by extending the Qwen3.5-4B vision language backbone with a compact pixel mask decoder trained under joint language and mask supervision.
When you ask the model to locate or reason about objects in a frame, it emits structured text tokens (<bbox>[x1, y1, x2, y2]</bbox><mask><|mask|></mask>). Every generated <|mask|> hidden state routes directly into the mask decoder, which projects that semantic region into a pixel level alpha matte aligned to the source image. Because the language model reasons before decoding masks, it can isolate complex targets such as "the glass bottle farthest to the left" or "the actor wearing the dark coat behind the table".
Demo segmentation test plate from Xiaomi-Lens-0 Space
Colorists and compositors routinely need secondary isolation mattes for individual props, wardrobe pieces, or background signage rather than whole foreground cutouts.
At 4 billion parameters, Xiaomi-Lens-0 runs comfortably on a single 12 GB consumer GPU, letting small VFX teams script batch prop masks across hundreds of dailies frames.
Multi instance grounding separates overlapping props cleanly when you describe spatial relationships. Instead of clicking 15 separate objects in a cluttered tabletop shot, one text prompt isolates every matching glass bottle or practical lamp in a single pass.
Plain visual question answering works alongside grounding because the model decides automatically when mask tokens are needed.
Multi instance grounding test plate from Xiaomi-Lens-0 Space
Hardware, VRAM, and License Matrix
Xiaomi-Lens-0 ships under the Apache 2.0 license, clearing it for commercial VFX pipelines, editorial asset tagging, and internal studio automation.
| Precision | Estimated VRAM | Recommended GPU | Typical Use Case | License |
|---|---|---|---|---|
| BF16 / FP16 | 10 GB to 12 GB | RTX 3060 12GB / RTX 4070 | Single frame prompt matting and dailies QA | Apache 2.0 |
| BF16 (Batched) | 16 GB to 24 GB | RTX 4080 / RTX 4090 | Fast batch plate segmentation for VFX prep | Apache 2.0 |
| INT8 / 4 bit | 6 GB to 8 GB | RTX 4060 / Laptop GPUs | Lightweight on set DIT look development | Apache 2.0 |
Parameter Reference
These prompt formatting and generation parameters control mask recall and coordinate precision.
| Parameter | Recommended Setting | Production Effect |
|---|---|---|
| Prompt suffix | "Report bbox coordinates and masks." |
Explicitly triggers <bbox> and `< |
max_new_tokens |
512 to 1024 |
Leaves enough budget for multi instance scenes with 10+ objects |
do_sample |
False (greedy) |
Produces repeatable bounding boxes and stable mask edges across runs |
mask_threshold |
0.5 |
Controls binary matte cutoff before optional morphological feathering |
Local Python and CLI Setup
Clone the official Xiaomi Research repository and install transformers with PyTorch CUDA support to load xiaomi-research/xiaomi-lens-0.
git clone https://github.com/xiaomi-research/xiaomi-lens-0.git
cd xiaomi-lens-0
pip install torch torchvision transformers accelerate pillow opencv-python
Run grounded referring segmentation in Python to save a binary alpha mask for compositing or color grading.
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModel
model_id = "xiaomi-research/xiaomi-lens-0"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
).eval()
image = Image.open("tabletop_plate.jpg").convert("RGB")
prompt = "Locate all glass bottles on the left half of the table. Report bbox coordinates and masks."
inputs = processor(images=image, text=prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(processor.batch_decode(outputs, skip_special_tokens=False)[0])
Filmmaker Production Playbook
- Automated color grading power windows. Generate prompt targeted alpha mattes for specific wardrobe pieces, vehicles, or practical signs and import them as external matte nodes in DaVinci Resolve.
- Inpainting and object removal prep. Use Xiaomi-Lens-0 to isolate boom mics, modern signage, or crew reflections by plain English description, then pass those masks straight into a video inpainting model.
- Rapid foreground isolation in the cloud. When you need instant cloud background cutouts inside AI FILMS Studio without running local Python scripts, use BEN2 Background Remover in the image workspace and chain edits inside the Nodes Graph Editor.
Known Limitations and FAQ
Does Xiaomi-Lens-0 track masks natively across video frames? The 4B checkpoint operates per image frame. For video clips, run Xiaomi-Lens-0 on the hero keyframe to generate the initial prompt mask, then propagate that mask temporally with a dedicated video object tracker.
Why did the model answer in text without returning a mask?
Xiaomi-Lens-0 decides whether masks are needed based on phrasing. Append "Report bbox coordinates and masks." to your prompt whenever you want pixel masks returned.
Can I run it commercially on client projects? Yes. Both the model weights and official GitHub repository are distributed under Apache 2.0.
Related Reading
- BEN3: Open Source Image and Video Background Removal
- BRIA RMBG 3.0: Open Source VFX Background Removal
- Apple Depth Pro 2: Open Source Metric Depth for VFX
- Explore cloud tools on the AI image generator page
Sources
Continue Reading
Video & LipSync
- Video Generator
- Text to Video
- Image to Video
- Start-End Frame to Video
- Draw to Video
- Motion Control
- Video Enhancer
- Video Upscaler
- Video Extend
- Video to Video LipSync
- Audio to Video LipSync
- Image to Video LipSync
- Video FaceSwap
- Seedance 2.5
- WAN 3.0
- Seedance 2
- FLUX 3
- Minimax H3
- Vidu Q3 Pro
- Grok Imagine Video 1.5
- Gemini Omni
- Google Veo 3.1
- Kling 3.0 Pro
- Luma Ray 3.2
- LTX 2.3
- Happy Horse 1.1
- Kling 3.0 Motion
- ByteDance Upscaler
- InfiniteTalk
- InsightFace
Image & Edit
- AI Character
- AI Actor
- Art Generator
- Text to Image
- Image to Image
- LoRA Image to Image
- Draw to Edit
- Image LoRA Training
- Remove Background
- Image Enhancer
- MidJourney 8.0
- Krea 2
- OpenAI GPT Image 2.0
- Nano Banana Pro Ultra
- Nano Banana 2 Lite
- Nano Banana Pro
- Minimax Image
- Clarity Pro
- Z-Image Turbo LoRA
- Krea 2 Turbo LoRA
- Z-Image LoRA Trainer
- Qwen Image LoRA Trainer
- Background Erase Network 2 (BEN2)



