Spaces:
Runtime error
Runtime error
Commit
•
de76c3a
1
Parent(s):
e989fd9
manually add class labels for application
Browse files
utils.py
CHANGED
@@ -8,14 +8,26 @@ import torchvision.transforms as T
|
|
8 |
from torchvision.utils import make_grid
|
9 |
|
10 |
|
|
|
11 |
img_path = '/home/alan/Projects/gen_dnd_art/filtered_images/im128/*pkl'
|
12 |
img_files = glob.glob(img_path)
|
13 |
|
14 |
-
# determine class names
|
|
|
15 |
labels = np.array([i.split('/')[-1].split('_')[:3] for i in img_files])
|
16 |
species = np.unique(labels[:, 0]).tolist()
|
17 |
classes = np.unique(labels[:, 1]).tolist()
|
18 |
genders = np.unique(labels[:, 2]).tolist()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
class ImSet(Dataset):
|
21 |
def __init__(self, img_path=img_path):
|
|
|
8 |
from torchvision.utils import make_grid
|
9 |
|
10 |
|
11 |
+
# default image directory (training only)
|
12 |
img_path = '/home/alan/Projects/gen_dnd_art/filtered_images/im128/*pkl'
|
13 |
img_files = glob.glob(img_path)
|
14 |
|
15 |
+
# determine class names from image directory (training only)
|
16 |
+
'''
|
17 |
labels = np.array([i.split('/')[-1].split('_')[:3] for i in img_files])
|
18 |
species = np.unique(labels[:, 0]).tolist()
|
19 |
classes = np.unique(labels[:, 1]).tolist()
|
20 |
genders = np.unique(labels[:, 2]).tolist()
|
21 |
+
'''
|
22 |
+
|
23 |
+
# hard code class labels (for application)
|
24 |
+
species = ['dragonborn', 'dwarf', 'elf', 'gnome', 'halfling', 'human', 'orc', 'tiefling']
|
25 |
+
classes = [
|
26 |
+
'barbarian', 'bard', 'cleric', 'druid', 'fighter', 'monk',
|
27 |
+
'paladin','ranger', 'rogue', 'sorcerer', 'warlock', 'wizard'
|
28 |
+
]
|
29 |
+
genders = ['', 'female', 'male']
|
30 |
+
|
31 |
|
32 |
class ImSet(Dataset):
|
33 |
def __init__(self, img_path=img_path):
|