Skip to content

Instantly share code, notes, and snippets.

@chitraa
Created September 10, 2019 09:34
Show Gist options
  • Save chitraa/69bf9e4de66940bfb17aca94f391a5e4 to your computer and use it in GitHub Desktop.
Save chitraa/69bf9e4de66940bfb17aca94f391a5e4 to your computer and use it in GitHub Desktop.
From 18c9f5621c7b0f20deec6b2c9ceb1e4b71f7771a Mon Sep 17 00:00:00 2001
From: chitraa <chits.26@gmail.com>
Date: Mon, 2 Sep 2019 16:37:29 +0200
Subject: [PATCH] 2295005: fix polygon bug: catch exception & change default polygon params
---
backend/webserver/util/coco_util.py | 6 +++++-
client/src/components/annotator/panels/PolygonPanel.vue | 2 +-
client/src/components/annotator/tools/PolygonTool.vue | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/backend/webserver/util/coco_util.py b/backend/webserver/util/coco_util.py
index 0a43e5d..eeba9cf 100644
--- a/backend/webserver/util/coco_util.py
+++ b/backend/webserver/util/coco_util.py
@@ -79,7 +79,11 @@ def paperjs_to_coco(image_width, image_height, paperjs):
def get_segmentation_area_and_bbox(segmentation, image_height, image_width):
# Convert into rle
- rles = mask.frPyObjects(segmentation, image_height, image_width)
+ try:
+ rles = mask.frPyObjects(segmentation, image_height, image_width)
+ except Exception:
+ print("Exception: input type is not supported.")
+ print(segmentation)
rle = mask.merge(rles)
return mask.area(rle), mask.toBbox(rle)
diff --git a/client/src/components/annotator/panels/PolygonPanel.vue b/client/src/components/annotator/panels/PolygonPanel.vue
index 951d876..2403453 100644
--- a/client/src/components/annotator/panels/PolygonPanel.vue
+++ b/client/src/components/annotator/panels/PolygonPanel.vue
@@ -17,7 +17,7 @@
name="Auto Complete Distance"
min="0"
max="1000"
- step="5"
+ step="1"
v-model="polygon.polygon.completeDistance"
/>
<PanelInputNumber
diff --git a/client/src/components/annotator/tools/PolygonTool.vue b/client/src/components/annotator/tools/PolygonTool.vue
index e9afa98..f6e06b3 100644
--- a/client/src/components/annotator/tools/PolygonTool.vue
+++ b/client/src/components/annotator/tools/PolygonTool.vue
@@ -26,8 +26,8 @@ export default {
scaleFactor: 3,
cursor: "copy",
polygon: {
- completeDistance: 5,
- minDistance: 2,
+ completeDistance: 1,
+ minDistance: 1,
path: null,
guidance: true,
simplify: 1,
--
2.20.1.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment