Skip to content

Commit dff4a5d

Browse files
committed
Optimisation
1 parent 94a6c97 commit dff4a5d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

segmentation/app.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def update(self):
5252
continue
5353

5454
depth_image = np.asanyarray(aligned_depth_frame.get_data())
55-
depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.1), cv2.COLORMAP_RAINBOW)
55+
depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.06), cv2.COLORMAP_RAINBOW)
5656
depth_colormap = cv2.resize(depth_colormap, (320,180))
5757
depth_colormap = cv2.flip(depth_colormap, 1)
5858

@@ -117,15 +117,15 @@ class InferenceConfig(coco.CocoConfig):
117117
'bus', 'train', 'truck', 'boat', 'traffic light',
118118
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird',
119119
'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear',
120-
'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie',
121-
'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball',
120+
'zebra', 'giraffe', 'bag', 'umbrella', 'bag', 'tie',
121+
'suitcase', 'frisbee', 'skis', 'snowboard', 'ball',
122122
'kite', 'baseball bat', 'baseball glove', 'skateboard',
123123
'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup',
124124
'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
125125
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza',
126126
'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed',
127-
'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote',
128-
'keyboard', 'cell phone', 'microwave', 'oven', 'toaster',
127+
'table', 'toilet', 'monitor', 'laptop', 'mouse', 'remote',
128+
'keyboard', 'phone', 'microwave', 'oven', 'toaster',
129129
'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors',
130130
'teddy bear', 'hair drier', 'toothbrush']
131131

@@ -140,7 +140,7 @@ class InferenceConfig(coco.CocoConfig):
140140
cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
141141
cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
142142

143-
N = 20
143+
N = 12
144144
hsv = [(i / N, 1, 1.0) for i in range(N)]
145145
colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))
146146

@@ -172,7 +172,7 @@ def render_masks(image, boxes, masks, class_ids, N):
172172
(1 - alpha) + alpha * color[2] * 255,
173173
image[:, :, 2])
174174

175-
cv2.putText(image,caption,(cent_x, cent_y), font, 0.8,(255,255,255), 1, cv2.LINE_AA)
175+
cv2.putText(image,caption,(cent_x, cent_y), font, 0.8,(60,60,255), 2, cv2.LINE_AA)
176176

177177
return image
178178

@@ -187,6 +187,8 @@ def render_masks(image, boxes, masks, class_ids, N):
187187
boxes, masks = r["rois"], r["masks"]
188188
class_ids = r["class_ids"]
189189
N = boxes.shape[0]
190+
if N>12:
191+
N=12
190192

191193
if not N:
192194
masked_image = color_image_f

0 commit comments

Comments
 (0)