Update app.py
Browse files
app.py
CHANGED
@@ -85,10 +85,12 @@ def detect(img,thr=0.2):
|
|
85 |
lab = labels[i][scr > thrh]
|
86 |
box = boxes[i][scr > thrh]
|
87 |
|
88 |
-
|
|
|
89 |
for idx,b in enumerate(box):
|
90 |
-
|
91 |
-
draw.
|
|
|
92 |
|
93 |
#save_path = Path('./output') / img_path.name
|
94 |
return img
|
|
|
85 |
lab = labels[i][scr > thrh]
|
86 |
box = boxes[i][scr > thrh]
|
87 |
|
88 |
+
label_dict = {7:'person',6:'vehicle',5:'swimming-pool',4:'ship',3:'storage-tank',2:'bridge',1:'airplane'} #AITOD labels
|
89 |
+
label_color_dict = {7:'red',6:'blue',5:'green',4:'yellow',3:'cyan',2:'magenta',1:'white'}
|
90 |
for idx,b in enumerate(box):
|
91 |
+
label_i = lab[idx].item()
|
92 |
+
draw.rectangle(list(b), outline=label_color_dict[label_i], )
|
93 |
+
draw.text((b[0], b[1]), text=label_dict[label_i], fill='blue', )
|
94 |
|
95 |
#save_path = Path('./output') / img_path.name
|
96 |
return img
|