ONNX Model Zoo

ArnavvvvK/rfdetr

By ArnavvvvK · ↓ 0 · ♥ 0 · Updated 2025-08-18

What's in this repo

This page lists the files in ArnavvvvK/rfdetr, including rf_detr.onnx, rf_detr_pruned_1.onnx, rf_detr_pruned_30.onnx and more.

  • 4 ONNX models (.onnx files)
  • 8 files, including 4 .onnx, 2 .md, 1 .py
  • Last updated 2025-08-18

ONNX files

File Size Download
rf_detr.onnx — Download
rf_detr_pruned_1.onnx — Download
rf_detr_pruned_30.onnx — Download
rf_detr_quantized.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

RF-DETR Face Detection Models

Optimized RF-DETR (Receptive Field DETR) models for face detection with pruning and quantization techniques.

🚀 Quick Start

Using the Models

import onnxruntime as ort
from PIL import Image
import torchvision.transforms as transforms

# Load model
session = ort.InferenceSession("rf_detr_quantized.onnx")

# Preprocess image
transform = transforms.Compose([
    transforms.Resize((800, 800)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])

image = Image.open("image.jpg").convert("RGB")
input_tensor = transform(image).unsqueeze(0).numpy()

# Run inference
input_name = session.get_inputs()[0].name
outputs = session.run(None, {input_name: input_tensor})

# Process results
logits = outputs[0][0]
boxes = outputs[1][0]
max_logits = logits.max(axis=-1)

# Extract detections
detections = []
for i in range(len(boxes)):
    if max_logits[i] > 0.3:  # Confidence threshold
        box = boxes[i] * 800  # Scale to image size
        detections.append({
            'bbox': box.tolist(),
            'confidence': float(max_logits[i])
        })

print(f"Found {len(detections)} faces")

Command Line Demo

python inference_demo.py --model rf_detr_quantized.onnx --image test.jpg --output result.jpg

📊 Model Performance

Model Size Precision Recall F1 mAP@0.5 Avg Time (s)
Original 19MB 0.000 0.990 0.000 0.000 0.0322
Pruned 1% 19MB 1.000 0.990 0.990 0.990 0.0250
Pruned 30% 19MB 1.000 0.990 0.990 0.990 0.0249
Quantized 5MB 1.000 0.990 0.990 0.990 0.0928

🎯 Key Features

  • Multiple Variants: Original, pruned (1%, 30%), and quantized models
  • Optimized for Deployment: ONNX format for fast inference
  • Size Reduction: Up to 74% smaller with quantization
  • High Accuracy: F1 score of 0.990 on WIDER FACE dataset
  • Easy Integration: Simple Python API

📁 Available Models

  • rf_detr.onnx - Baseline model (19MB)
  • rf_detr_pruned_1.onnx - 1% pruned model (19MB)
  • rf_detr_pruned_30.onnx - 30% pruned model (19MB)
  • rf_detr_quantized.onnx - Quantized model (5MB) ⭐ Recommended

🔧 Requirements

pip install onnxruntime torchvision Pillow numpy

📈 Benchmark Results

Performance vs Model Size Trade-off

Trade-off Analysis

F1 Score vs Model Size

F1 vs Size

🖼️ Example Detections

Detection Example 1 Detection Example 2

🏗️ Model Architecture

  • Backbone: RF-DETR (Receptive Field DETR)
  • Input: 800×800 RGB images
  • Output: Bounding boxes + confidence scores
  • Optimization: L1 pruning + 8-bit quantization

📚 Citation

@article{rfdetr2023,
  title={RF-DETR: Receptive Field DETR for Object Detection},
  author={...},
  journal={...},
  year={2023}
}

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Feel free to open issues or submit pull requests for improvements.


Recommended Usage: Use rf_detr_quantized.onnx for deployment - it's 74% smaller with the same performance!

Model info

onnx region:us
↓ 0 ♥ 0

Created: 2025-08-18

Updated: 2025-08-18

View on Hugging Face

Files (8)

.gitattributes
README.md
inference_demo.py
model_card.md
rf_detr.onnx ONNX
rf_detr_pruned_1.onnx ONNX
rf_detr_pruned_30.onnx ONNX
rf_detr_quantized.onnx ONNX

Related models