-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.py
37 lines (28 loc) · 1.53 KB
/
push.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
import json
import re
import sys
BUCKET_NAME = "image-rec-512"
def push_output():
lst = ["zebra", "wine glass", "vase", "umbrella", "tv", "truck", "train", "traffic light", "toothbrush", "toilet",
"toaster", "tie", "tennis racket", "teddy bear", "surfboard", "suitcase", "stop sign", "sports ball",
"spoon", "snowboard", "skis", "skateboard", "sink", "sheep", "scissors", "sandwich", "remote",
"refrigerator", "potted plant", "pizza", "person", "parking meter", "oven", "orange", "mouse", "motorcycle",
"microwave", "laptop", "knife", "kite", "keyboard", "hot dog", "horse", "handbag", "hair drier", "giraffe",
"frisbee", "fork", "fire hydrant", "elephant", "donut", "dog", "dining table", "cup", "cow", "couch",
"clock", "chair", "cell phone", "cat", "carrot", "car", "cake", "bus", "broccoli", "bowl", "bottle", "book",
"boat", "bird", "bicycle", "bench", "bed", "bear", "baseball glove", "baseball bat", "banana", "backpack",
"apple", "airplane"]
items_found = []
for item in lst:
with open('/home/ubuntu/darknet/output.txt') as f:
for line in f:
if re.search("{0}".format(item+":"), line):
print(line)
items_found.append(item)
if len(items_found) == 0:
items_found.append("No object detected")
mylist = list(set(items_found))
f = open("/home/ubuntu/darknet/output_processed.txt", "w")
f.write(json.dumps(mylist))
f.close()
push_output()