davanstrien's picture
davanstrien HF Staff
add model metadata (#1)
a3f75c5 verified
metadata
title: SAM3 Detection Browser
emoji: πŸ”
colorFrom: blue
colorTo: green
sdk: static
pinned: false
models:
  - facebook/sam3

πŸ” SAM3 Object Detection Browser

A simple, interactive web application for browsing and exploring object detection results from Meta's SAM3 (Segment Anything Model 3).

Features

  • Visual Detection Display: View images with bounding boxes overlaid on detected objects
  • Confidence Filtering: Adjust confidence threshold with a slider to filter detections
  • Statistics Dashboard: See overall detection statistics including:
    • Total filtered images
    • Images with detections
    • Total detections
    • Average detections per image
  • Flexible Navigation: Browse through datasets with pagination
  • Real-time Updates: Filters update visualization instantly
  • Color-coded Confidence: Bounding boxes and scores are color-coded:
    • 🟒 Green: High confidence (β‰₯70%)
    • 🟠 Orange: Medium confidence (40-70%)
    • πŸ”΄ Red: Low confidence (<40%)

How to Use

  1. Enter a Dataset ID: Input any HuggingFace dataset that contains object detection results from SAM3

    • Default: davanstrien/newspapers-image-predictions
    • Format: username/dataset-name
  2. Select Split: Choose which dataset split to view (train/validation/test)

  3. Adjust Filters:

    • Move the confidence slider to filter detections by minimum confidence score
    • Check "Show only images with detections" to hide images without any detected objects
  4. Browse: Navigate through pages using Previous/Next buttons

Dataset Requirements

This browser works with any HuggingFace dataset that has:

  • An image column containing images
  • An objects column with the structure:
    {
        "bbox": [[x, y, width, height], ...],    # Bounding box coordinates
        "category": [0, 0, ...],                  # Category indices
        "score": [0.8, 0.6, ...]                  # Confidence scores
    }
    

This matches the output format from the detect-objects.py script.

Example Datasets

Creating Your Own Detection Dataset

Use the SAM3 detection script to create your own datasets:

# Detect objects in your images
uv run https://huggingface.co/datasets/uv-scripts/sam3/raw/main/detect-objects.py \
    your-dataset \
    your-output-dataset \
    --class-name "photograph" \
    --confidence-threshold 0.5

Then view the results by entering your-output-dataset in this browser!

Technical Details

  • Technology: Pure HTML/CSS/JavaScript (no backend required)
  • Data Source: HuggingFace Datasets API (parquet endpoint)
  • Rendering: HTML5 Canvas for bounding box overlays
  • Performance: Loads 12 images per page for optimal performance

Related Projects

License

MIT License - Feel free to use and modify for your own projects!