| 61 | |
| 62 | |
| 63 | class Encoder(ABC, nn.Module): |
| 64 | def __init__(self, *args, **kwargs): |
| 65 | nn.Module.__init__(self) |
| 66 | self.setup(*args, **kwargs) |
| 67 | self.name = "encoder" |
| 68 | |
| 69 | @abstractmethod |
| 70 | def setup(self, *args, **kwargs): |
| 71 | pass |
| 72 | |
| 73 | @abstractmethod |
| 74 | def transform(self, x): |
| 75 | """Converts a PIL Image to an input for the model""" |
| 76 | pass |
| 77 | |
| 78 | def forward(self, *args, **kwargs): |
| 79 | return self.model(*args, **kwargs) |
| 80 | |
| 81 | |
| 82 | class DINOv2Encoder(Encoder): |
nothing calls this directly
no outgoing calls
no test coverage detected