Implementation:NVIDIA DALI EfficientDet HParams
| Knowledge Sources | |
|---|---|
| Domains | Object_Detection, TensorFlow |
| Last Updated | 2026-02-08 16:00 GMT |
Overview
Provides a hierarchical configuration utility class and default hyperparameter definitions for EfficientDet model variants (D0 through D7x).
Description
This module implements a `Config` class that serves as a nested, dictionary-like configuration container supporting attribute-style access, recursive updates, YAML serialization/deserialization, and string-based overrides (e.g., `"x.y=1,x.z=2"`). The `Config` class supports deep copy semantics and can be updated either permissively (allowing new keys) or strictly (raising errors for unknown keys via `override()`). It provides methods to parse configuration from YAML files, save to YAML, and parse from comma-separated key=value strings with nested dot notation.
The module also defines `default_detection_configs()` which returns a `Config` instance pre-populated with all default hyperparameters for EfficientDet training, including: model architecture parameters (FPN levels, anchor scales, aspect ratios), optimization settings (learning rate, momentum, optimizer type, gradient clipping), loss function parameters (focal loss alpha/gamma, box loss weight, label smoothing), regularization (weight decay, survival probability for stochastic depth), and post-processing settings (NMS configuration). A companion dictionary `efficientdet_model_param_dict` maps model names (efficientdet-d0 through efficientdet-d7x) to their specific parameter overrides.
The `get_efficientdet_config()` function retrieves the complete configuration for a named model variant by starting with the defaults and applying the variant-specific overrides.
Usage
Use this module to obtain and customize hyperparameter configurations when setting up EfficientDet training. Create a config with `get_efficientdet_config("efficientdet-d1")`, then override specific parameters as needed using `config.override("learning_rate=0.01,batch_size=8")` or by passing a dictionary.
Code Reference
Source Location
- Repository: NVIDIA_DALI
- File: docs/examples/use_cases/tensorflow/efficientdet/hparams_config.py
- Lines: 1-366
Signature
class Config(object):
def __init__(self, config_dict=None): ...
def update(self, config_dict): ...
def override(self, config_dict_or_str, allow_new_keys=False): ...
def parse_from_yaml(self, yaml_file_path: Text) -> Dict[Any, Any]: ...
def save_to_yaml(self, yaml_file_path): ...
def parse_from_str(self, config_str: Text) -> Dict[Any, Any]: ...
def as_dict(self) -> dict: ...
def get(self, k, default_value=None): ...
def keys(self): ...
def default_detection_configs() -> Config: ...
def get_efficientdet_config(model_name="efficientdet-d1") -> Config: ...
Import
import hparams_config
config = hparams_config.get_efficientdet_config("efficientdet-d1")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| model_name | str | No | EfficientDet variant name (e.g., 'efficientdet-d0' through 'efficientdet-d7x'); default: 'efficientdet-d1' |
| config_dict | dict | No | Dictionary of configuration parameters to initialize or update a Config |
| config_dict_or_str | dict or str | No | Override values as a dict, YAML file path, or comma-separated key=value string |
Outputs
| Name | Type | Description |
|---|---|---|
| Config | Config | Hierarchical configuration object with all EfficientDet hyperparameters |
Usage Examples
Load and Override Configuration
import hparams_config
# Get default config for EfficientDet-D1
config = hparams_config.get_efficientdet_config("efficientdet-d1")
# Override specific parameters
config.override("learning_rate=0.01,batch_size=16")
# Access parameters
print(config.image_size) # 640
print(config.backbone_name) # 'efficientnet-b1'
print(config.fpn_num_filters) # 88
# Save to YAML
config.save_to_yaml("/tmp/config.yaml")
# Convert to dictionary
config_dict = config.as_dict()