MCPcopy
hub / github.com/richzhang/PerceptualSimilarity / make_dataset

Function make_dataset

data/image_folder.py:27–41  ·  view source on GitHub ↗
(dirs, mode='img')

Source from the content-addressed store, hash-verified

25 return any(filename.endswith(extension) for extension in NP_EXTENSIONS)
26
27def make_dataset(dirs, mode='img'):
28 if(not isinstance(dirs,list)):
29 dirs = [dirs,]
30
31 images = []
32 for dir in dirs:
33 assert os.path.isdir(dir), '%s is not a valid directory' % dir
34 for root, _, fnames in sorted(os.walk(dir)):
35 for fname in fnames:
36 if is_image_file(fname, mode=mode):
37 path = os.path.join(root, fname)
38 images.append(path)
39
40 # print("Found %i images in %s"%(len(images),root))
41 return images
42
43def default_loader(path):
44 return Image.open(path).convert('RGB')

Callers 3

initializeMethod · 0.90
initializeMethod · 0.90
__init__Method · 0.85

Calls 1

is_image_fileFunction · 0.85

Tested by

no test coverage detected