Instructions to use zeromodels/efficientdet_d6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/efficientdet_d6 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/efficientdet_d6") - Notebooks
- Google Colab
- Kaggle
See our collection for all versions of EfficientDet.
Run EfficientDet with Keras 3: JAX, PyTorch, or TensorFlow
zeromodels/efficientdet_d6
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-B6 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 1280x1280 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-d6) 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_d6")
processor = EfficientDetImageProcessor.from_weights("zeromodels/efficientdet_d6")
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_BACKENDbefore importing Keras / zeromodels. - Detection:
EfficientDetDetect+post_process_object_detection(trythreshold=0.3-0.4). - NMS is class-agnostic by default (one box per object); pass
class_agnostic=Falsefor per-class NMS. EfficientDetModel.from_weights(...)loads the same weights without the decode head, returning raw per-levelclass_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) tofrom_weightsto 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.
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/efficientdet_d6")