Spaces:
Sleeping
Sleeping
nicer
Browse files- Dockerfile +2 -2
- app.py +1 -3
- maskrcnn_benchmark/engine/predictor_glip.py +6 -5
Dockerfile
CHANGED
@@ -40,6 +40,6 @@ WORKDIR $HOME/app
|
|
40 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
41 |
COPY --chown=user . $HOME/app
|
42 |
|
43 |
-
|
|
|
44 |
CMD ["python", "app.py"]
|
45 |
-
#RUN main.py
|
|
|
40 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
41 |
COPY --chown=user . $HOME/app
|
42 |
|
43 |
+
CMD ["python", "setup.py build develop --user"]
|
44 |
+
|
45 |
CMD ["python", "app.py"]
|
|
app.py
CHANGED
@@ -12,8 +12,6 @@ import warnings
|
|
12 |
|
13 |
warnings.filterwarnings("ignore")
|
14 |
|
15 |
-
os.system("python setup.py build develop --user")
|
16 |
-
|
17 |
from maskrcnn_benchmark.config import cfg
|
18 |
from maskrcnn_benchmark.engine.predictor_glip import GLIPDemo
|
19 |
|
@@ -51,7 +49,7 @@ fiber_demo = GLIPDemo(
|
|
51 |
|
52 |
athetics_params = {
|
53 |
"skip_name": False, # whether we overlay the phrase over the box
|
54 |
-
"override_color": (0,
|
55 |
"text_size": 1.0,
|
56 |
"text_pixel": 3,
|
57 |
"box_alpha": 1.0,
|
|
|
12 |
|
13 |
warnings.filterwarnings("ignore")
|
14 |
|
|
|
|
|
15 |
from maskrcnn_benchmark.config import cfg
|
16 |
from maskrcnn_benchmark.engine.predictor_glip import GLIPDemo
|
17 |
|
|
|
49 |
|
50 |
athetics_params = {
|
51 |
"skip_name": False, # whether we overlay the phrase over the box
|
52 |
+
"override_color": (0, 90, 190),
|
53 |
"text_size": 1.0,
|
54 |
"text_pixel": 3,
|
55 |
"box_alpha": 1.0,
|
maskrcnn_benchmark/engine/predictor_glip.py
CHANGED
@@ -153,7 +153,7 @@ class GLIPDemo(object):
|
|
153 |
new_width = int(new_height * aspect_ratio)
|
154 |
resized_image = cv2.resize(image, (new_width, new_height))
|
155 |
return resized_image
|
156 |
-
result = resize_image_by_height(result)
|
157 |
if self.show_mask_heatmaps:
|
158 |
return self.create_mask_montage(result, top_predictions)
|
159 |
|
@@ -269,7 +269,7 @@ class GLIPDemo(object):
|
|
269 |
for box, color in zip(boxes, colors):
|
270 |
box = box.to(torch.int64)
|
271 |
top_left, bottom_right = box[:2].tolist(), box[2:].tolist()
|
272 |
-
new_image = cv2.rectangle(new_image, tuple(top_left), tuple(bottom_right), tuple((255, 255, 255)), box_pixel+
|
273 |
new_image = cv2.rectangle(new_image, tuple(top_left), tuple(bottom_right), tuple(color) if override_color is None else tuple(override_color), box_pixel)
|
274 |
|
275 |
image = cv2.addWeighted(new_image, box_alpha, image, 1 - box_alpha, 0)
|
@@ -338,9 +338,10 @@ class GLIPDemo(object):
|
|
338 |
if int(y) - text_offset_original < 20:
|
339 |
y += 50
|
340 |
text_box_size = cv2.getTextSize(s, cv2.FONT_HERSHEY_SIMPLEX, text_size, text_pixel)[0]
|
341 |
-
position = (int(x), int(y)-text_offset_original)
|
342 |
-
|
343 |
-
|
|
|
344 |
|
345 |
image[position[1]:bottom_left_corner_of_text[1], position[0]:top_right_corner[0]] = (255, 255, 255)
|
346 |
cv2.putText(
|
|
|
153 |
new_width = int(new_height * aspect_ratio)
|
154 |
resized_image = cv2.resize(image, (new_width, new_height))
|
155 |
return resized_image
|
156 |
+
#result = resize_image_by_height(result)
|
157 |
if self.show_mask_heatmaps:
|
158 |
return self.create_mask_montage(result, top_predictions)
|
159 |
|
|
|
269 |
for box, color in zip(boxes, colors):
|
270 |
box = box.to(torch.int64)
|
271 |
top_left, bottom_right = box[:2].tolist(), box[2:].tolist()
|
272 |
+
new_image = cv2.rectangle(new_image, tuple(top_left), tuple(bottom_right), tuple((255, 255, 255)), box_pixel+5)
|
273 |
new_image = cv2.rectangle(new_image, tuple(top_left), tuple(bottom_right), tuple(color) if override_color is None else tuple(override_color), box_pixel)
|
274 |
|
275 |
image = cv2.addWeighted(new_image, box_alpha, image, 1 - box_alpha, 0)
|
|
|
338 |
if int(y) - text_offset_original < 20:
|
339 |
y += 50
|
340 |
text_box_size = cv2.getTextSize(s, cv2.FONT_HERSHEY_SIMPLEX, text_size, text_pixel)[0]
|
341 |
+
position = (int(x), int(y)-text_offset_original-text_box_size[1])
|
342 |
+
offset = 5
|
343 |
+
bottom_left_corner_of_text = (position[0]-offset, position[1] + text_box_size[1]+offset)
|
344 |
+
top_right_corner = (position[0] + text_box_size[0]+offset, position[1]-offset)
|
345 |
|
346 |
image[position[1]:bottom_left_corner_of_text[1], position[0]:top_right_corner[0]] = (255, 255, 255)
|
347 |
cv2.putText(
|