MCPcopy
hub / github.com/SizheAn/PanoHead / open_dataset

Function open_dataset

dataset_tool.py:272–288  ·  view source on GitHub ↗
(source, *, max_images: Optional[int])

Source from the content-addressed store, hash-verified

270#----------------------------------------------------------------------------
271
272def open_dataset(source, *, max_images: Optional[int]):
273 if os.path.isdir(source):
274 if source.rstrip('/').endswith('_lmdb'):
275 return open_lmdb(source, max_images=max_images)
276 else:
277 return open_image_folder(source, max_images=max_images)
278 elif os.path.isfile(source):
279 if os.path.basename(source) == 'cifar-10-python.tar.gz':
280 return open_cifar10(source, max_images=max_images)
281 elif os.path.basename(source) == 'train-images-idx3-ubyte.gz':
282 return open_mnist(source, max_images=max_images)
283 elif file_ext(source) == 'zip':
284 return open_image_zip(source, max_images=max_images)
285 else:
286 assert False, 'unknown archive type'
287 else:
288 error(f'Missing input file or directory: {source}')
289
290#----------------------------------------------------------------------------
291

Callers 1

convert_datasetFunction · 0.85

Calls 7

open_lmdbFunction · 0.85
open_cifar10Function · 0.85
open_mnistFunction · 0.85
open_image_zipFunction · 0.85
open_image_folderFunction · 0.70
file_extFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected