Instructions to use zeromodels/efficientdet_d7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/efficientdet_d7 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_d7") - Notebooks
- Google Colab
- Kaggle
| pipeline_tag: object-detection | |
| license: apache-2.0 | |
| library_name: zeromodels | |
| tags: | |
| - keras | |
| - zeromodels | |
| - efficientdet | |
| - object-detection | |
| - arxiv:1911.09070 | |
| - pytorch | |
| - jax | |
| - tf | |
| ## ***See [our collection](https://hf.co/collections/zeromodels/efficientdet) for all versions of EfficientDet.*** | |
| # Run EfficientDet with Keras 3: JAX, PyTorch, or TensorFlow | |
| [](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/efficientdet/) [](https://hf.co/collections/zeromodels/efficientdet) | |
| # zeromodels/efficientdet_d7 | |
| Paper: [EfficientDet: Scalable and Efficient Object Detection (arXiv:1911.09070)](https://arxiv.org/abs/1911.09070) · [HF Papers](https://huggingface.co/papers/1911.09070) | |
| 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 1536x1536 over the 90 COCO categories. | |
| For more details on the model, see Google's original [AutoML EfficientDet repository](https://github.com/google/automl/tree/master/efficientdet). | |
| Pure-**Keras 3** conversion of Google AutoML's [EfficientDet](https://github.com/google/automl/tree/master/efficientdet) (`efficientdet-d7`) for [zeromodels](https://github.com/IMvision12/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 | |
| ```python | |
| 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_d7") | |
| processor = EfficientDetImageProcessor.from_weights("zeromodels/efficientdet_d7") | |
| 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`](https://huggingface.co/zeromodels/efficientdet_d0) | EfficientNet-B0 | 512 | | |
| | `efficientdet_d1` | [`zeromodels/efficientdet_d1`](https://huggingface.co/zeromodels/efficientdet_d1) | EfficientNet-B1 | 640 | | |
| | `efficientdet_d2` | [`zeromodels/efficientdet_d2`](https://huggingface.co/zeromodels/efficientdet_d2) | EfficientNet-B2 | 768 | | |
| | `efficientdet_d3` | [`zeromodels/efficientdet_d3`](https://huggingface.co/zeromodels/efficientdet_d3) | EfficientNet-B3 | 896 | | |
| | `efficientdet_d4` | [`zeromodels/efficientdet_d4`](https://huggingface.co/zeromodels/efficientdet_d4) | EfficientNet-B4 | 1024 | | |
| | `efficientdet_d5` | [`zeromodels/efficientdet_d5`](https://huggingface.co/zeromodels/efficientdet_d5) | EfficientNet-B5 | 1280 | | |
| | `efficientdet_d6` | [`zeromodels/efficientdet_d6`](https://huggingface.co/zeromodels/efficientdet_d6) | EfficientNet-B6 | 1280 | | |
| | `efficientdet_d7` | [`zeromodels/efficientdet_d7`](https://huggingface.co/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](https://imvision12.github.io/ZeroModels/efficientdet/) and [Loading Weights](https://imvision12.github.io/ZeroModels/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. | |