0

I have a general camera config yaml, where the only thing that usually changes between specific cameras is the IP address. Some fields (in the following example fps) remain the same.

Can I do something like this in Hydra/OmegaConf?

any_camera.yaml

any_camera:
  stream_url: ???
  fps: 25

all_cameras.yaml

all_cameras:
  cam1:
    @{any_camera}
    stream_url: rtsp://10.0.0.1

  cam2:
    @{any_camera}
    stream_url: rtsp://10.0.0.2

Michael Litvin
  • 3,976
  • 1
  • 34
  • 40

2 Answers2

1

I can see two potential options:

  1. In Hydra you can try: extending configs and select_multiple_configs_from_config_group

Basically you could have cam1 and cam2 both extend from any_camera and have specific overrides. Then in all_cameras.yaml, you can select multiple config groups to have the config list.

  1. You can also look into omegaconf's node interpolation. But that might require you change the cam config's structure.
Jieru Hu
  • 186
  • 2
1

The canonical answer to using the same config more than once is to override the config package.

defaults:
 - server/db@src: mysql
 - server/db@dst: mysql

Will result in the content of server/db/mysql.yaml in two places in the config object, src and dst.

See this section in the packages page.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87