Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated common/preprocess.py #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions common/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,16 @@ def save_cifar(args):
LABELS.append('/'.join(j))
LABELS_LIST = CIFAR100_LABELS_LIST
COARSE_LABELS_LIST = CIFAR100_SUPERCLASS_LABELS_LIST


if not os.path.exists(output):
os.mkdir("{}".format(output))

for mode in ['train', 'test']:
dirpath = os.path.join(output, mode)
os.mkdir("{}".format(dirpath))
for label in LABELS:
dirpath = os.path.join(output, mode, label)
os.system("mkdir -p {}".format(dirpath))
os.mkdir("{}".format(dirpath))

features, labels , coarse_labels, batch_names = parse_cifar(dataset, mode)

Expand All @@ -273,4 +278,5 @@ def save_cifar(args):
filepath = os.path.join(output, mode, LABELS_LIST[label], filename)
image = Image.fromarray(feature)
image = image.convert('RGB')
#with open(filepath, 'w+b') as f:
image.save(filepath)