Update README.md
Browse files32 unmodified lines333435363637383940414243444546474849505152535455565758596061626364656667686970717273747576777832 unmodified lines booktitle = {Advances in {{Neural Information Processing Systems}}}, year = {2026}}``````
## Usage
Here is an example of how to load the ImageNet-1K checkpoint. See further below for how to load the other datasets.
Download the weights for ImageNet-1K:
```shhf download dtu-pcas/parabolic-positional-encoding --include imagenet1k* --local-dir weights```
Next load the weights like this:
```pyimport jsonfrom pathlib import Path
import torch
from pape.configs import Configfrom pape.nn.image_classifier import ImageClassifier
dataset = "imagenet1k"checkpoint_dir = Path("weights") / datasetconfig_path = checkpoint_dir / "config.json"config = Config.from_dict(json.loads(config_path.read_text()))model = ImageClassifier(config)state_dict = torch.load(checkpoint_dir / "model.pt")model.load_state_dict(state_dict)```
The other models can be loaded as above, but make sure to substitute the dataset download path and model class `ImageClassifier` to match the dataset:
| Dataset | Path | Network || ----------- | ---------------------------------------- | ------------------------------------------ || COCO | coco | `pape.nn.image_detector.ImageDetector` || DvsGesture | dvsgesture | `pape.nn.event_classifier.EventClassifier` || GEN1 | gen1 | `pape.nn.event_detector.EventDetector` || ImageNet-1K | imagenet1k | `pape.nn.image_classifier.ImageClassifier` || UCF101 | ucf101_fold1, ucf101_fold2, ucf101_fold3 | `pape.nn.video_classifier.VideoClassifier` |
NB. UCF101 is evaluated using cross-validation. We provide weights for each of the three folds.README.md+43-1