-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.py
117 lines (113 loc) · 2.78 KB
/
output.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
map_dict = {
1: "pink primrose",
2: "hard-leaved pocket orchid",
3: "canterbury bells",
4: "sweet pea",
5: "english marigold",
6: "tiger lily",
7: "moon orchid",
8: "bird of paradise",
9: "monkshood",
10: "globe thistle",
11: "snapdragon",
12: "colt's foot",
13: "king protea",
14: "spear thistle",
15: "yellow iris",
16: "globe-flower",
17: "purple coneflower",
18: "peruvian lily",
19: "balloon flower",
20: "giant white arum lily",
21: "fire lily",
22: "pincushion flower",
23: "fritillary",
24: "red ginger",
25: "grape hyacinth",
26: "corn poppy",
27: "prince of wales feathers",
28: "stemless gentian",
29: "artichoke",
30: "sweet william",
31: "carnation",
32: "garden phlox",
33: "love in the mist",
34: "mexican aster",
35: "alpine sea holly",
36: "ruby-lipped cattleya",
37: "cape flower",
38: "great masterwort",
39: "siam tulip",
40: "lenten rose",
41: "barbeton daisy",
42: "daffodil",
43: "sword lily",
44: "poinsettia",
45: "bolero deep blue",
46: "wallflower",
47: "marigold",
48: "buttercup",
49: "oxeye daisy",
50: "common dandelion",
51: "petunia",
52: "wild pansy",
53: "primula",
54: "sunflower",
55: "pelargonium",
56: "bishop of llandaff",
57: "gaura",
58: "geranium",
59: "orange dahlia",
60: "pink-yellow dahlia",
61: "cautleya spicata",
62: "japanese anemone",
63: "black-eyed susan",
64: "silverbush",
65: "californian poppy",
66: "osteospermum",
67: "spring crocus",
68: "bearded iris",
69: "windflower",
70: "tree poppy",
71: "gazania",
72: "azalea",
73: "water lily",
74: "rose",
75: "thorn apple",
76: "morning glory",
77: "passion flower",
78: "lotus lotus",
79: "toad lily",
80: "anthurium",
81: "frangipani",
82: "clematis",
83: "hibiscus",
84: "columbine",
85: "desert-rose",
86: "tree mallow",
87: "magnolia",
88: "cyclamen",
89: "watercress",
90: "canna lily",
91: "hippeastrum",
92: "bee balm",
93: "ball moss",
94: "foxglove",
95: "bougainvillea",
96: "camellia",
97: "mallow",
98: "mexican petunia",
99: "bromelia",
100: "blanket flower",
101: "trumpet creeper",
102: "blackberry lily",
}
def resolve_class_name(class_id):
return map_dict[class_id + 1]
def print_predictions(probabilities, classes_ids):
for prediction in zip(
probabilities.numpy().squeeze(), classes_ids.numpy().squeeze()
):
class_name = resolve_class_name(prediction[1])
confidence = round(prediction[0] * 100, 2)
print(f"{class_name}{'.' * (35 - len(class_name))}{confidence}%")