torchvision for anomaly detection
Project description
torchvision for Anomaly Detection
You can use the MVTec Anomaly Detection Dataset.
Installation
pip:
$ pip install torchvision4ad
From source:
$ python setup.py install
Usage
You can use one of the MVTec AD Dataset names {'bottle', 'cable', 'capsule', 'carpet', 'grid', 'hazelnut', 'leather', 'metal_nut', 'pill', 'screw', 'tile', 'toothbrush', 'transistor', 'wood', 'zipper'}.
from torchvision4ad.datasets import MVTecAD
root = "mvtec_ad"
dataset_name = "bottle"
mvtec_ad = MVTecAD(root, dataset_name, train=True, download=True)
for (img, target) in mvtec_ad:
...
Of course, you can also give a function/transform takes in an PIL image and returns a transformed version.
import torchvision.transforms as transforms
from torchvision4ad.datasets import MVTecAD
transform = transforms.Compose([transforms.Resize([64, 64]),
transforms.ToTensor()])
mvtec_ad = MVTecAD("mvtec_ad", "bottle", train=True, transform=transform, download=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchvision4ad-0.1.0.tar.gz
(2.3 kB
view hashes)
Built Distributions
Close
Hashes for torchvision4ad-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 710455847c28c251593288b241333286012b1c5bba133ea109d2dfbaaff3bd5b |
|
MD5 | afdc0011df3282a1e73041499ec4fd72 |
|
BLAKE2b-256 | 99fad9630acb33bfd94e423f264d6da4e1b801053bc0e4c1ee244e99770535da |