My Model Card
usage example.
replace model name and model_id according to the referring repository weights.
1from torchvision import models
2from huggingface_hub import PyTorchModelHubMixin
3import torch.nn as nn
4
5class HF_Wrapper(nn.Module, PyTorchModelHubMixin):
6 def __init__(self, model_name="resnet18", num_classes=10000):
7 super().__init__()
8 self.model = getattr(models, model_name)(num_classes=num_classes)
9 def forward(self, x):
10 return self.model(x)
11
12model_id = "totti0223/resnet18_fractaldb_10000"
13model_name = "resnet18"
14num_classes = 10000
15model = HF_Wrapper(model_name, num_classes=num_classes).from_pretrained(model_id)
16model.eval()
17
18# normalization
19from torchvision import transforms
20normalize = transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
21val_transform = transforms.Compose([transforms.Resize((224,224), interpolation=2),transforms.ToTensor(), normalize])
22
23
FractalDB Pretrained Models for PyTorch via PyTorchModelHubMixin
The original work is done by Hirokatsu Kataoka et al.
License: MIT
Citation:
@article{KataokaIJCV2022,
author = {Kataoka, Hirokatsu and Okayasu, Kazushige and Matsumoto, Asato and Yamagata, Eisuke and Yamada, Ryosuke and Inoue, Nakamasa and Nakamura, Akio and Satoh, Yutaka},
title = {Pre-training without Natural Images},
journal = {International Journal of Computer Vision (IJCV)},
year = {2022}
}
@inproceedings{KataokaACCV2020,
author = {Kataoka, Hirokatsu and Okayasu, Kazushige and Matsumoto, Asato and Yamagata, Eisuke and Yamada, Ryosuke and Inoue, Nakamasa and Nakamura, Akio and Satoh, Yutaka},
title = {Pre-training without Natural Images},
booktitle = {Asian Conference on Computer Vision (ACCV)},
year = {2020}
}
I, Yosuke Toda, the uploader of this repo do not appeal any rights against this model.
Yosuke Toda
yosuke@phytometrics.jp