Constructs a backbone given a backbone config object (see config.py).
(cfg)
| 231 | |
| 232 | |
| 233 | def construct_backbone(cfg): |
| 234 | """ Constructs a backbone given a backbone config object (see config.py). """ |
| 235 | backbone = cfg.type(*cfg.args) |
| 236 | |
| 237 | # Add downsampling layers until we reach the number we need |
| 238 | num_layers = max(cfg.selected_layers) + 1 |
| 239 | |
| 240 | while len(backbone.layers) < num_layers: |
| 241 | backbone.add_layer() |
| 242 | |
| 243 | return backbone |