add dataset.py

This commit is contained in:
chun 2023-12-24 13:17:52 +08:00
parent 5ab9422ce6
commit 579d2b0d8e

View File

@ -16,6 +16,7 @@ def main():
os.makedirs(path, exist_ok=True) os.makedirs(path, exist_ok=True)
print('tar -xf ./Dataset/ILSVRC2012_img_{}.tar -C {}'.format(phase, path)) print('tar -xf ./Dataset/ILSVRC2012_img_{}.tar -C {}'.format(phase, path))
os.system('tar -xf ./Dataset/ILSVRC2012_img_{}.tar -C {}'.format(phase, path)) os.system('tar -xf ./Dataset/ILSVRC2012_img_{}.tar -C {}'.format(phase, path))
if phase == 'train':
for tar in os.listdir(path): for tar in os.listdir(path):
print('tar -xf {}/{} -C {}/{}'.format(path, tar, path, tar.split('.')[0])) print('tar -xf {}/{} -C {}/{}'.format(path, tar, path, tar.split('.')[0]))
os.makedirs('{}/{}'.format(path, tar.split('.')[0]), exist_ok=True) os.makedirs('{}/{}'.format(path, tar.split('.')[0]), exist_ok=True)