Download utils/build.py from InPeerReview/RemoteSensingChangeDetection-RSCD.CTTF: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/InPeerReview/RemoteSensingChangeDetection-RSCD.CTTF/resolve/main/utils/build.py
- Command line
-
hf download hf://InPeerReview/RemoteSensingChangeDetection-RSCD.CTTF/utils/build.py
-
curl -L -o build.py https://huggingface.co/InPeerReview/RemoteSensingChangeDetection-RSCD.CTTF/resolve/main/utils/build.py
570 Bytes
| from utils.config import Config, ConfigDict | |
| from rscd.models.backbones import * | |
| from rscd.models.decoderheads import * | |
| from rscd.losses import * | |
| def build_from_cfg(cfg): | |
| if not isinstance(cfg, (dict, ConfigDict, Config)): | |
| raise TypeError( | |
| f'cfg should be a dict, ConfigDict or Config, but got {type(cfg)}') | |
| if 'type' not in cfg: | |
| raise KeyError( | |
| '`cfg` must contain the key "type", ' | |
| f'but got {cfg}') | |
| obj_type = cfg.pop('type') | |
| obj_cls = eval(obj_type) | |
| obj = obj_cls(**cfg) | |
| return obj |