File size: 764 Bytes
1834bc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
from typing import List, Tuple

from anomalib.data import MVTec, MVTecAD
from anomalib.data.datasets.image import MVTecDataset
"""Loading logic :

   Download MVTech AD dataset from the website and place it in data folder (Anomalib installation doesnt work, sorry you have to donwload manually)



"""


def load_mvtec(category: str, root: str = "./datasets/MVTec",) :
    train_ds = MVTecDataset(
        root=root,
        category=category,
        split="train"
    )

    test_ds = MVTecDataset(
        root=root,
        category=category,
        split="test"
    )
    
    train_paths = train_ds.samples["image_path"].tolist()
    test_paths = test_ds.samples["image_path"].tolist()

    return train_paths, test_paths