Skip to content

Commit

Permalink
Added names for classifiers. Added comment about celeb-hq
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Pidhorskyi committed Apr 23, 2020
1 parent ac6f049 commit 71eeb13
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dataset_preparation/prepare_celeba_hq_tfrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def prepare_celeba(cfg, logger, train=True):
os.makedirs(directory, exist_ok=True)

images = []
# The official way of generating CelebA-HQ can be challenging.
# Please refer to this page: https://github.com/suvojit-0x55aa/celebA-HQ-dataset-download
# You can get pre-generated dataset from: https://drive.google.com/drive/folders/11Vz0fqHS2rXDb5pprgTjpD7S2BAJhi1P
source_path = '/data/datasets/celeba-hq/data1024x1024'
for filename in tqdm.tqdm(os.listdir(source_path)):
images.append((int(filename[:-4]), filename))
Expand Down
43 changes: 43 additions & 0 deletions principal_directions/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,49 @@ def load_pkl(file_or_url):
'https://drive.google.com/uc?id=1SF_mJIdyGINXoV-I6IAxHB_k5dxiF6M-', # celebahq-classifier-39-wearing-necktie.pkl
]

classifier_id_name = {
0: "gender",
1: "smiling",
2: "attractive",
3: "wavy-hair",
4: "young",
5: "5-o-clock-shadow",
6: "arched-eyebrows",
7: "bags-under-eyes",
8: "bald",
9: "bangs",
10: "big-lips",
11: "big-nose",
12: "black-hair",
13: "blond-hair",
14: "blurry",
15: "brown-hair",
16: "bushy-eyebrows",
17: "chubby",
18: "double-chin",
19: "eyeglasses",
20: "goatee",
21: "gray-hair",
22: "heavy-makeup",
23: "high-cheekbones",
24: "mouth-slightly-open",
25: "mustache",
26: "narrow-eyes",
27: "no-beard",
28: "oval-face",
29: "pale-skin",
30: "pointy-nose",
31: "receding-hairline",
32: "rosy-cheeks",
33: "sideburns",
34: "straight-hair",
35: "wearing-earrings",
36: "wearing-hat",
37: "wearing-lipstick",
38: "wearing-necklace",
39: "wearing-necktie",
}


def make_classifier(attrib_idx):
classifier = load_pkl(classifier_urls[attrib_idx])
Expand Down

0 comments on commit 71eeb13

Please sign in to comment.