See our collection for all versions of EfficientDet.

Run EfficientDet with Keras 3: JAX, PyTorch, or TensorFlow

GitHub Docs Collection

zeromodels/efficientdet_d4

Paper: EfficientDet: Scalable and Efficient Object Detection (arXiv:1911.09070) · HF Papers

EfficientDet is a family of single-shot, anchor-based detectors built for a clean accuracy/compute trade-off. An EfficientNet-B4 backbone feeds a weighted bi-directional feature pyramid (BiFPN) that fuses multi-scale features with learnable per-input weights, and one shared class head and box head run over every pyramid level. This checkpoint runs at 1024x1024 over the 90 COCO categories.

For more details on the model, see Google's original AutoML EfficientDet repository.

Pure-Keras 3 conversion of Google AutoML's EfficientDet (efficientdet-d4) for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.

This is an object detection checkpoint (EfficientDetDetect): the backbone, BiFPN and shared heads emit per-anchor boxes that are decoded against anchors and NMS-filtered into detections.

✨ Quick start

import os
os.environ["KERAS_BACKEND"] = "torch"  # or "jax" / "tensorflow"

from PIL import Image
from zeromodels.models.efficientdet import EfficientDetDetect, EfficientDetImageProcessor

model = EfficientDetDetect.from_weights("zeromodels/efficientdet_d4")
processor = EfficientDetImageProcessor.from_weights("zeromodels/efficientdet_d4")

image = Image.open("your_image.jpg").convert("RGB")
inputs = processor(image)
output = model(inputs["pixel_values"], training=False)
results = processor.post_process_object_detection(
    output, threshold=0.3, target_sizes=inputs["original_sizes"]
)[0]
for score, name, box in zip(
    results["scores"], results["label_names"], results["boxes"]
):
    print(f"{name}: {float(score):.3f} {[round(float(v)) for v in box]}")

Load any EfficientDet variant the same way with from_weights("zeromodels/<variant>") (use EfficientDetDetect for detection, EfficientDetModel for the raw head outputs):

Variant Hub Backbone Input
efficientdet_d0 zeromodels/efficientdet_d0 EfficientNet-B0 512
efficientdet_d1 zeromodels/efficientdet_d1 EfficientNet-B1 640
efficientdet_d2 zeromodels/efficientdet_d2 EfficientNet-B2 768
efficientdet_d3 zeromodels/efficientdet_d3 EfficientNet-B3 896
efficientdet_d4 zeromodels/efficientdet_d4 EfficientNet-B4 1024
efficientdet_d5 zeromodels/efficientdet_d5 EfficientNet-B5 1280
efficientdet_d6 zeromodels/efficientdet_d6 EfficientNet-B6 1280
efficientdet_d7 zeromodels/efficientdet_d7 EfficientNet-B6 1536

Tips

  • Set KERAS_BACKEND before importing Keras / zeromodels.
  • Detection: EfficientDetDetect + post_process_object_detection (try threshold=0.3-0.4).
  • NMS is class-agnostic by default (one box per object); pass class_agnostic=False for per-class NMS.
  • EfficientDetModel.from_weights(...) loads the same weights without the decode head, returning raw per-level class_outputs / box_outputs.
  • Larger variants take a bigger input (D0 512 up to D7 1536); each side must be divisible by 128.
  • Community / fine-tuned repos hosted in the zeromodels format load with from_weights("<org>/<repo>").
  • Weights are resolution-independent: pass image_size=N (a multiple of 128) to from_weights to run at a custom size.
  • See EfficientDet docs and Loading Weights.

Special Thanks

A huge thank you to the Google Brain / AutoML authors (Mingxing Tan, Ruoming Pang, Quoc V. Le) for creating and releasing EfficientDet.

License: Apache 2.0.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including zeromodels/efficientdet_d4

Paper for zeromodels/efficientdet_d4