-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_data.py
33 lines (24 loc) · 998 Bytes
/
get_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def get_images_and_labels(img_dict):
"""
Given an img_dict, creates two lists img_labels and img_list
Generally img_dict is modelled as to contain label as key
and the key's value contains a list which has all the
images present in the category.
Parameters:
img_dict - dictionary with keys containing label category
and corresponding values containing images
in that category.
Returns:
(img_list, img_labels)
img_labels: contains labels of all the images.
img_list: contains list of all images.
"""
img_labels = []
img_list = []
for key in img_dict.keys():
for img in img_dict[key]:
img_labels.append(key)
img_list.append(img)
return (img_list, img_labels)
# TODO: Changes for imporovement:
# Do something instead of 2 loops.