Download clean/image/effort/DeepfakeBench/training/networks/base_backbone.py from deepsafe/model-code: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/deepsafe/model-code/resolve/main/clean/image/effort/DeepfakeBench/training/networks/base_backbone.py
- Command line
-
hf download hf://deepsafe/model-code/clean/image/effort/DeepfakeBench/training/networks/base_backbone.py
-
curl -L -o base_backbone.py https://huggingface.co/deepsafe/model-code/resolve/main/clean/image/effort/DeepfakeBench/training/networks/base_backbone.py
873 Bytes
| import abc | |
| import torch | |
| from typing import Union | |
| class AbstractBackbone(abc.ABC): | |
| """ | |
| All backbones for detectors should subclass this class. | |
| """ | |
| def __init__(self, config, load_param: Union[bool, str] = False): | |
| """ | |
| config: (dict) | |
| configurations for the model | |
| load_param: (False | True | Path(str)) | |
| False Do not read; True Read the default path; Path Read the required path | |
| """ | |
| pass | |
| def features(self, data_dict: dict) -> torch.tensor: | |
| """ | |
| """ | |
| def classifier(self, features: torch.tensor) -> torch.tensor: | |
| """ | |
| """ | |
| def init_weights(self, pretrained_path: Union[bool, str]): | |
| """ | |
| This method can be optionally implemented by subclasses. | |
| """ | |
| pass |