Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions build_label_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def build_single_label_map(
We may want many label_maps w/ same value of n_labeled.
This allows us to disambiguate.
dataset_name: A string representing the name of the dataset.
One of 'cifar10', 'svhn', 'imagenet', or 'cifar_unnormalized'.
One of 'cifar10', 'svhn', 'imagenet'.
imagenet_path: A string that encodes the location of the raw imagenet
data.
fkeys_path: A string that encodes where to read fkeys from and write
Expand Down Expand Up @@ -143,7 +143,7 @@ def build_single_label_map(
result_dict["values"] += random.sample(
unique_ids, n_labeled_per_class
)
elif dataset_name in {"cifar10", "svhn", "cifar_unnormalized"}:
elif dataset_name in {"cifar10", "svhn"}:
path = os.path.join(fkeys_path, dataset_name, "label_to_fkeys_train")
with gfile.GFile(path, "r") as f:
label_to_fkeys = json.load(f)
Expand Down
8 changes: 0 additions & 8 deletions build_tfrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@
"valid": 50050,
"extra": 0,
},
"cifar_unnormalized": {
"train": 50000,
"test": 10000,
"valid": 5000,
"extra": 0,
},
}

URLS = {
Expand Down Expand Up @@ -192,8 +186,6 @@ def main(_):
train_set, test_set, extra_set = _load_svhn()
elif FLAGS.dataset_name == "cifar10":
train_set, test_set = _load_cifar10(normalize=True)
elif FLAGS.dataset_name == "cifar_unnormalized":
train_set, test_set = _load_cifar10(normalize=False)
elif FLAGS.dataset_name == "imagenet_32":
train_set, test_set = _load_imagenet_32()
else:
Expand Down
9 changes: 0 additions & 9 deletions lib/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,36 @@

DATASET_SHAPE = {
"cifar10": (None, 32, 32, 3),
"cifar_unnormalized": (None, 32, 32, 3),
"svhn": (None, 32, 32, 3),
"svhn_extra": (None, 32, 32, 3),
"imagenet_32": (None, 32, 32, 3),
}
DATASET_DTYPE = {
"cifar10": tf.float32,
"cifar_unnormalized": tf.uint8,
"svhn": tf.uint8,
"svhn_extra": tf.uint8,
"imagenet_32": tf.uint8,
}
DATASET_CLASS_COUNT = {
"cifar10": 10,
"cifar_unnormalized": 10,
"svhn": 10,
"svhn_extra": 10,
"imagenet_32": 1000,
}
DATASET_EXAMPLE_COUNT = {
"train": {
"cifar10": 50000 - 5000,
"cifar_unnormalized": 50000 - 5000,
"svhn": 73257 - 7326,
"svhn_extra": 531131,
"imagenet_32": 1281167 - 50050,
},
"test": {
"cifar10": 10000,
"cifar_unnormalized": 10000,
"svhn": 26032,
"imagenet_32": 50000,
},
"valid": {
"cifar10": 5000,
"cifar_unnormalized": 5000,
"svhn": 7326,
"imagenet_32": 50050,
},
Expand Down Expand Up @@ -309,7 +303,6 @@ def get_filenames(dataset_name, split):
if dataset_name in [
"cifar10",
"svhn",
"cifar_unnormalized",
"imagenet_32",
]:
filenames = [os.path.join(paths.TRAIN_DIR, dataset_name, FILES[split])]
Expand All @@ -332,8 +325,6 @@ def are_datasets_compatible(labeled_dataset_name, unlabeled_dataset_name):
Boolean
"""
valid_combos = [
("cifar_unnormalized", "svhn"),
("svhn", "cifar_unnormalized"),
("svhn", "svhn_extra"),
]
return (labeled_dataset_name == unlabeled_dataset_name) or (
Expand Down
2 changes: 0 additions & 2 deletions lib/hparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def merge_dicts(x, y):

# HParam overrides for different datasets
cifar10_overrides = dict(horizontal_flip=True)
cifar_unnormalized_overrides = cifar10_overrides

imagenet_overrides = dict(
horizontal_flip=True,
Expand All @@ -86,7 +85,6 @@ def merge_dicts(x, y):
svhn_overrides = dict(gaussian_noise=False, vat_epsilon=1.0)
dataset_overrides = dict(
cifar10=cifar10_overrides,
cifar_unnormalized=cifar_unnormalized_overrides,
imagenet=imagenet_overrides,
imagenet_32=imagenet_overrides,
imagenet_64=imagenet_overrides,
Expand Down