Spaces:
Running
Running
File size: 2,890 Bytes
8380820 1924502 8380820 1924502 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
---
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
1. **Upload an Image**: Choose any photo containing objects you want to measure
2. **Select Camera Type**: Pick your device from presets or use custom focal length values
3. **Process Image**: Click "Process Image" to detect objects (they'll be numbered and colored)
4. **Set Reference**: Select an object you know the size of and enter its dimensions
5. **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:
1. Upload all files to a new HF Space
2. Ensure the model weights are properly downloaded
3. 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
|