(cfg, input_shape)
| 4 | |
| 5 | |
| 6 | def build_pixel_decoder(cfg, input_shape): |
| 7 | name = cfg.MODEL.SEM_SEG_HEAD.PIXEL_DECODER_NAME |
| 8 | model = SEM_SEG_HEADS_REGISTRY.get(name)(cfg, input_shape) |
| 9 | forward_features = getattr(model, "forward_features", None) |
| 10 | if not callable(forward_features): |
| 11 | raise ValueError( |
| 12 | "Only SEM_SEG_HEADS with forward_features method can be used as pixel decoder. " |
| 13 | f"Please implement forward_features for {name} to only return mask features." |
| 14 | ) |
| 15 | return model |