From 1af9105bb16924b0d1e6db56583f543685a3d569 Mon Sep 17 00:00:00 2001 From: himalayanZephyr <42401082+himalayanZephyr@users.noreply.github.com> Date: Mon, 9 Dec 2019 10:12:17 +0000 Subject: [PATCH] Yolov3 interpretration script fix for 'Annotation failed' and changes to mapping.json (#896) (#912) --- CHANGELOG.md | 1 + utils/open_model_zoo/yolov3/interp.py | 6 + utils/open_model_zoo/yolov3/mapping.json | 160 +++++++++++------------ 3 files changed, 87 insertions(+), 80 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 431866a2e034..3ffc572aea78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ https://github.com/opencv/cvat/issues/750). ### Changed - page_size parameter for all REST API methods - React & Redux & Antd based dashboard +- Yolov3 interpretation script fix and changes to mapping.json ### Deprecated - diff --git a/utils/open_model_zoo/yolov3/interp.py b/utils/open_model_zoo/yolov3/interp.py index 025438535e4e..4c76c85448d0 100644 --- a/utils/open_model_zoo/yolov3/interp.py +++ b/utils/open_model_zoo/yolov3/interp.py @@ -151,4 +151,10 @@ def parse_yolo_region(self, blob: 'np.ndarray', original_shape: list, params: di ymin = obj['ymin'] ymax = obj['ymax'] + # Enforcing extra checks for bounding box coordinates + xmin = max(0,xmin) + ymin = max(0,ymin) + xmax = min(xmax,width) + ymax = min(ymax,height) + results.add_box(xmin, ymin, xmax, ymax, label, frame_number) diff --git a/utils/open_model_zoo/yolov3/mapping.json b/utils/open_model_zoo/yolov3/mapping.json index 15e7420b8d0a..bfb65a24cf0c 100644 --- a/utils/open_model_zoo/yolov3/mapping.json +++ b/utils/open_model_zoo/yolov3/mapping.json @@ -1,84 +1,84 @@ { "label_map": { - "1": "person", - "2": "bicycle", - "3": "car", - "4": "motorbike", - "5": "aeroplane", - "6": "bus", - "7": "train", - "8": "truck", - "9": "boat", - "10": "traffic light", - "11": "fire hydrant", - "12": "stop sign", - "13": "parking meter", - "14": "bench", - "15": "bird", - "16": "cat", - "17": "dog", - "18": "horse", - "19": "sheep", - "20": "cow", - "21": "elephant", - "22": "bear", - "23": "zebra", - "24": "giraffe", - "25": "backpack", - "26": "umbrella", - "27": "handbag", - "28": "tie", - "29": "suitcase", - "30": "frisbee", - "31": "skis", - "32": "snowboard", - "33": "sports ball", - "34": "kite", - "35": "baseball bat", - "36": "baseball glove", - "37": "skateboard", - "38": "surfboard", - "39": "tennis racket", - "40": "bottle", - "41": "wine glass", - "42": "cup", - "43": "fork", - "44": "knife", - "45": "spoon", - "46": "bowl", - "47": "banana", - "48": "apple", - "49": "sandwich", - "50": "orange", - "51": "broccoli", - "52": "carrot", - "53": "hot dog", - "54": "pizza", - "55": "donut", - "56": "cake", - "57": "chair", - "58": "sofa", - "59": "pottedplant", - "60": "bed", - "61": "diningtable", - "62": "toilet", - "63": "tvmonitor", - "64": "laptop", - "65": "mouse", - "66": "remote", - "67": "keyboard", - "68": "cell phone", - "69": "microwave", - "70": "oven", - "71": "toaster", - "72": "sink", - "73": "refrigerator", - "74": "book", - "75": "clock", - "76": "vase", - "77": "scissors", - "78": "teddy bear", - "79": "hair drier", - "80": "toothbrush" + "0": "person", + "1": "bicycle", + "2": "car", + "3": "motorbike", + "4": "aeroplane", + "5": "bus", + "6": "train", + "7": "truck", + "8": "boat", + "9": "traffic light", + "10": "fire hydrant", + "11": "stop sign", + "12": "parking meter", + "13": "bench", + "14": "bird", + "15": "cat", + "16": "dog", + "17": "horse", + "18": "sheep", + "19": "cow", + "20": "elephant", + "21": "bear", + "22": "zebra", + "23": "giraffe", + "24": "backpack", + "25": "umbrella", + "26": "handbag", + "27": "tie", + "28": "suitcase", + "29": "frisbee", + "30": "skis", + "31": "snowboard", + "32": "sports ball", + "33": "kite", + "34": "baseball bat", + "35": "baseball glove", + "36": "skateboard", + "37": "surfboard", + "38": "tennis racket", + "39": "bottle", + "40": "wine glass", + "41": "cup", + "42": "fork", + "43": "knife", + "44": "spoon", + "45": "bowl", + "46": "banana", + "47": "apple", + "48": "sandwich", + "49": "orange", + "50": "broccoli", + "51": "carrot", + "52": "hot dog", + "53": "pizza", + "54": "donut", + "55": "cake", + "56": "chair", + "57": "sofa", + "58": "pottedplant", + "59": "bed", + "60": "diningtable", + "61": "toilet", + "62": "tvmonitor", + "63": "laptop", + "64": "mouse", + "65": "remote", + "66": "keyboard", + "67": "cell phone", + "68": "microwave", + "69": "oven", + "70": "toaster", + "71": "sink", + "72": "refrigerator", + "73": "book", + "74": "clock", + "75": "vase", + "76": "scissors", + "77": "teddy bear", + "78": "hair drier", + "79": "toothbrush" } }