-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from argoai/use-config-for-constants
Increase readability by placing global constants in a config
- Loading branch information
Showing
4 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
SensorDatasetConfig: | ||
_target_: argoverse.sensor_dataset_config.SensorDatasetConfig | ||
dataset_name: argoverse1.1 | ||
ring_cam_fps: 30 | ||
stereo_cam_fps: 5 | ||
|
||
# all ring cameras are `landscape` aspect ratio | ||
sensors: | ||
_target_: argoverse.sensor_dataset_config.SensorSuiteConfig | ||
|
||
ring_front_center: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_front_left: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_front_right: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_side_left: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_side_right: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_rear_left: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
ring_rear_right: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 1200 | ||
img_width: 1920 | ||
|
||
stereo_front_right: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 2056 | ||
img_width: 2464 | ||
|
||
stereo_front_left: | ||
_target_: argoverse.sensor_dataset_config.SensorConfig | ||
img_height: 2056 | ||
img_width: 2464 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import NamedTuple, Optional | ||
|
||
import hydra | ||
from hydra.utils import instantiate | ||
|
||
|
||
class SensorConfig(NamedTuple): | ||
"""Image dimensions for each sensor are provided in pixels.""" | ||
|
||
img_height: int | ||
img_width: int | ||
|
||
|
||
class SensorSuiteConfig(NamedTuple): | ||
"""Contains information about image dimensions for each sensor.""" | ||
|
||
ring_front_center: SensorConfig | ||
ring_front_left: SensorConfig | ||
ring_front_right: SensorConfig | ||
ring_side_left: SensorConfig | ||
ring_side_right: SensorConfig | ||
ring_rear_left: SensorConfig | ||
ring_rear_right: SensorConfig | ||
stereo_front_right: Optional[SensorConfig] | ||
stereo_front_left: Optional[SensorConfig] | ||
|
||
|
||
class SensorDatasetConfig(NamedTuple): | ||
"""Global constants regarding frame rate and image dimensions.""" | ||
|
||
dataset_name: str | ||
ring_cam_fps: int | ||
stereo_cam_fps: int | ||
sensors: SensorSuiteConfig | ||
|
||
|
||
DATASET_NAME = "argoverse1.1" | ||
|
||
with hydra.initialize_config_module(config_module="argoverse.config"): | ||
cfg = hydra.compose(config_name=f"{DATASET_NAME}.yaml") | ||
ArgoverseConfig: SensorDatasetConfig = instantiate(cfg.SensorDatasetConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters