Load CelebA dataset Return a list of image path. Parameters ----------- path : str The path that the data is downloaded to, defaults is ``data/celebA/``.
(path='data')
| 1317 | |
| 1318 | |
| 1319 | def load_celebA_dataset(path='data'): |
| 1320 | """Load CelebA dataset |
| 1321 | |
| 1322 | Return a list of image path. |
| 1323 | |
| 1324 | Parameters |
| 1325 | ----------- |
| 1326 | path : str |
| 1327 | The path that the data is downloaded to, defaults is ``data/celebA/``. |
| 1328 | |
| 1329 | """ |
| 1330 | data_dir = 'celebA' |
| 1331 | filename, drive_id = "img_align_celeba.zip", "0B7EVK8r0v71pZjFTYXZWM3FlRnM" |
| 1332 | save_path = os.path.join(path, filename) |
| 1333 | image_path = os.path.join(path, data_dir) |
| 1334 | if os.path.exists(image_path): |
| 1335 | logging.info('[*] {} already exists'.format(save_path)) |
| 1336 | else: |
| 1337 | exists_or_mkdir(path) |
| 1338 | download_file_from_google_drive(drive_id, save_path) |
| 1339 | zip_dir = '' |
| 1340 | with zipfile.ZipFile(save_path) as zf: |
| 1341 | zip_dir = zf.namelist()[0] |
| 1342 | zf.extractall(path) |
| 1343 | os.remove(save_path) |
| 1344 | os.rename(os.path.join(path, zip_dir), image_path) |
| 1345 | |
| 1346 | data_files = load_file_list(path=image_path, regx='\\.jpg', printable=False) |
| 1347 | for i, _v in enumerate(data_files): |
| 1348 | data_files[i] = os.path.join(image_path, data_files[i]) |
| 1349 | return data_files |
| 1350 | |
| 1351 | |
| 1352 | def load_voc_dataset(path='data', dataset='2012', contain_classes_in_person=False): |
nothing calls this directly
no test coverage detected
searching dependent graphs…