Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
5.42.0
metadata
title: Smart Object Size Estimator
emoji: π
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
π Smart Object Size Estimator
An AI-powered web application that estimates real-world sizes of objects in images using depth estimation and segmentation.
π Features
- AI-Powered Detection: Uses Depth Anything V2 for depth estimation and SAM for object segmentation
- Reference Object System: Click on any detected object and specify its known size to calibrate measurements
- Camera Presets: Pre-configured settings for common smartphones (iPhone, Samsung, Google Pixel)
- Real-time Processing: Interactive interface with immediate feedback
- Robust Scaling: Works with images of any size and format
π οΈ How to Use
- Upload an Image: Choose any photo containing objects you want to measure
- Select Camera Type: Pick your device from presets or use custom focal length values
- Process Image: Click "Process Image" to detect objects (they'll be numbered and colored)
- Set Reference: Select an object you know the size of and enter its dimensions
- Calculate Sizes: Get measurements of all detected objects!
π· Camera Settings
The app includes presets for:
- iPhone 12/13/14 (Main & Ultra Wide cameras)
- Samsung Galaxy S21/S22
- Google Pixel 6/7
- Generic Smartphone
- Custom (manual focal length input)
οΏ½οΏ½ Tips for Best Results
- Use good lighting and avoid harsh shadows
- Ensure objects are clearly visible and well-separated
- Choose a reference object with a known precise dimension
- Take photos perpendicular to objects when possible
- For best accuracy, use camera-specific presets
π§ Technical Details
- Depth Model: Depth Anything V2 (ViT-Small)
- Segmentation: Segment Anything Model (SAM)
- Interface: Gradio web interface
- Processing: Automatic image scaling and robust preprocessing
π Dependencies
All required packages are listed in requirements.txt
. Key dependencies:
- Gradio for web interface
- PyTorch for model inference
- OpenCV for image processing
- Matplotlib for visualizations
π Deployment
This app is designed to run on Hugging Face Spaces. Simply:
- Upload all files to a new HF Space
- Ensure the model weights are properly downloaded
- The app will auto-launch with Gradio
π― Use Cases
- E-commerce: Product dimension verification
- Interior Design: Furniture and room measurements
- Manufacturing: Quality control and inspection
- Education: Physics and measurement exercises
- Daily Life: Measuring objects without a ruler
β οΈ Limitations
- Accuracy depends on camera calibration
- Works best with well-lit, clear images
- Small or very thin objects may not segment well
- Depth estimation quality affects final measurements