CoolFace
Apppublic

Zitti123/size-anything

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿ“ 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. 1.Upload an Image: Choose any photo containing objects you want to measure
  2. 2.Select Camera Type: Pick your device from presets or use custom focal length values
  3. 3.Process Image: Click "Process Image" to detect objects (they'll be numbered and colored)
  4. 4.Set Reference: Select an object you know the size of and enter its dimensions
  5. 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. 1.Upload all files to a new HF Space
  2. 2.Ensure the model weights are properly downloaded
  3. 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