detr-resnet-50

What is this model?

facebook 497K downloads apache-2.0 Object Detection
Frameworkstransformerspytorchsafetensors
Datasetscoco
Tagsdetrobject-detectionvision
Downloads
497K
License
apache-2.0
Pipeline
Object Detection
Author
facebook

Run detr-resnet-50 locally on a Q4KM hard drive

Accelerate your deployment with Q4KM hard drives pre‑loaded with the facebook/detr-resnet-50 checkpoint. Get instant, plug‑and‑play access to a state‑of‑the‑art object detector—no download, no setup....

Shop Q4KM Drives

Technical Overview

What is this model? facebook/detr-resnet-50 is a pre‑trained DETR (DEtection TRansformer) model that performs **object detection** on natural images. It combines a convolutional backbone (ResNet‑50) with a transformer encoder‑decoder to predict a fixed set of 100 object queries per image, each consisting of a class label and a bounding‑box regression.

Key features and capabilities

  • End‑to‑end training – no hand‑crafted anchors, proposal generators or NMS post‑processing.
  • 100 object queries allow detection of up to 100 objects per image, matching the COCO evaluation protocol.
  • Supports the Hugging Face DetrForObjectDetection pipeline and the DetrImageProcessor for preprocessing/post‑processing.
  • Implemented in PyTorch, compatible with model card, files and community discussions.

Architecture highlights

  • Backbone: ResNet‑50 (pre‑trained on ImageNet) extracts a 3‑D feature map (C × H × W).
  • Transformer encoder: 6 self‑attention layers encode the flattened feature map with positional encodings.
  • Transformer decoder: 6 cross‑attention layers process 100 learned object queries that attend to the encoder output.
  • Prediction heads: a linear classification head (91 COCO classes + “no‑object”) and a 4‑dimensional MLP for bounding‑box coordinates (center‑x, center‑y, width, height) in normalized format.
  • Loss function: Hungarian bipartite matching + cross‑entropy (classes) + L1 + generalized IoU (boxes).

Intended use cases

  • Real‑time or batch image analysis for autonomous vehicles, robotics, and video surveillance.
  • Content moderation and media tagging where precise object localization is required.
  • Research prototyping of transformer‑based detection pipelines.

Benchmark Performance

Object‑detection models are typically evaluated on the COCO 2017 benchmark using **AP (Average Precision)** at IoU = 0.5:0.95, as well as AP50 and AP75. The DETR‑ResNet‑50 checkpoint achieves the results reported in the original paper:

  • AP (IoU = 0.5:0.95): ~42.0 %
  • AP50 (IoU = 0.5): ~62.0 %
  • AP75 (IoU = 0.75): ~44.0 %

These metrics matter because they reflect both the **recall** (detecting all objects) and **precision** (accurate localization) across a wide range of object sizes. Compared with classic anchor‑based detectors such as Faster‑RCNN (≈42 % AP) and newer transformer variants like Deformable DETR (≈44 % AP), the ResNet‑50 backbone offers a solid trade‑off between speed and accuracy while preserving the simplicity of an end‑to‑end pipeline.

Hardware Requirements

VRAM for inference – The model’s parameters occupy ~140 MB (including the ResNet‑50 backbone). In practice, a single 224 × 224 image consumes ~1 GB of GPU memory; larger COCO‑scale images (≈800 px on the short side) require 2–3 GB. A GPU with at least **4 GB VRAM** (e.g., NVIDIA RTX 3050) can run the model comfortably for batch size = 1.

Recommended GPU specifications

  • CUDA‑compatible GPU with ≥ 6 GB VRAM for higher throughput (batch ≥ 4).
  • Tensor cores (e.g., RTX 20‑series or newer) accelerate the linear layers and the transformer’s matrix multiplications.
  • For production deployments, consider NVIDIA T4 or A10 for balanced cost‑performance.

CPU requirements – The model can be run on CPU‑only machines, but inference latency rises to 300–500 ms per image on a modern 8‑core Xeon. For real‑time applications, GPU acceleration is strongly recommended.

Storage needs – The model checkpoint (including tokenizer, config, and safetensors) is roughly **300 MB**. Adding the COCO‑style label map adds < 1 MB. Disk space of 1 GB is more than sufficient.

Performance characteristics – On an RTX 3080 (10 GB VRAM) the model processes ~12 images / second at 800 px short side resolution (batch = 1). Throughput scales linearly with batch size until GPU memory saturation.

Use Cases

Primary intended applications

  • Surveillance & security: Detect people, vehicles, and suspicious objects in real‑time CCTV streams.
  • Retail analytics: Count products on shelves, monitor shopper behavior, and detect out‑of‑stock items.
  • Robotics & automation: Enable robots to locate and manipulate objects in unstructured environments.
  • Media & content moderation: Identify logos, weapons, or adult content for automated tagging and filtering.

Real‑world examples

  • A logistics company uses DETR‑ResNet‑50 to automatically locate pallets in warehouse camera feeds, reducing manual inventory time by 40 %.
  • Smart‑city traffic monitoring pipelines employ the model to count bicycles and pedestrians at intersections, feeding data into adaptive‑signal controllers.
  • AR developers integrate the model into mobile apps to overlay contextual information on detected objects (e.g., “cat”, “couch”).

Integration possibilities

  • Directly via the Hugging Face transformers library (Python, PyTorch).
  • Exported to ONNX for deployment on edge devices or inference servers that do not support PyTorch.
  • Wrapped in Azure ML or AWS SageMaker endpoints using the deploy:azure tag.

Training Details

Methodology – The model was trained **end‑to‑end** on the COCO 2017 detection dataset (118 k training images, 5 k validation images). The training loop consists of:

  • Image preprocessing: shortest side ≥ 800 px, longest side ≤ 1333 px, ImageNet mean/std normalization.
  • ResNet‑50 backbone extracts a 256‑dimensional feature map.
  • Transformer encoder (6 layers) processes the flattened feature map with sinusoidal positional encodings.
  • Transformer decoder (6 layers) attends to 100 learned object queries.
  • Two heads predict class logits (91 COCO classes + “no‑object”) and normalized bounding boxes.
  • Loss: Hungarian bipartite matching + cross‑entropy + L1 + generalized IoU.

Compute requirements – Training ran for **300 epochs** on **16 NVIDIA V100 GPUs** (each with 32 GB VRAM). Batch size per GPU was 4 images, giving an effective batch size of 64. Total training time was roughly **3 days**.

Fine‑tuning capabilities – Because the model follows the standard DetrForObjectDetection API, you can fine‑tune it on custom datasets (e.g., Open Images, proprietary surveillance footage) by:

  • Replacing the classification head with the number of target classes.
  • Continuing training with a lower learning rate (e.g., 1e‑5) for 30–50 epochs.
  • Optionally swapping the ResNet‑50 backbone for a stronger one (ResNet‑101, Swin‑Transformer) while preserving the same decoder architecture.

Licensing Information

The model card lists the license as Apache‑2.0. This permissive open‑source license grants:

  • Freedom to use, modify, and distribute the model for both commercial and non‑commercial purposes.
  • No requirement to disclose source code when the model is incorporated into a larger proprietary system.
  • Obligation to retain the original copyright notice and a copy of the license in any redistribution.
  • Patent‑grant clause that protects downstream users from patent claims related to the contributed code.

Because the license is permissive, you can embed facebook/detr-resnet-50 in commercial products (e.g., video‑analytics SaaS, autonomous‑driving stacks) without needing a separate commercial agreement. The only practical restriction is the **attribution** clause: you must keep the Apache‑2.0 notice in your distribution and, where feasible, provide a link back to the original Hugging Face model page.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives