From bb8c68d099f82deb6356b37edeb8c0030ce06a7b Mon Sep 17 00:00:00 2001 From: himalayanZephyr <42401082+himalayanZephyr@users.noreply.github.com> Date: Fri, 6 Dec 2019 11:53:29 +0000 Subject: [PATCH 1/2] Check for bounding box coordinates for Yolo Suggested fix for https://github.com/opencv/cvat/issues/896 --- utils/open_model_zoo/yolov3/interp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/open_model_zoo/yolov3/interp.py b/utils/open_model_zoo/yolov3/interp.py index 025438535e4..4be203dfd0c 100644 --- a/utils/open_model_zoo/yolov3/interp.py +++ b/utils/open_model_zoo/yolov3/interp.py @@ -150,5 +150,11 @@ def parse_yolo_region(self, blob: 'np.ndarray', original_shape: list, params: di xmax = obj['xmax'] ymin = obj['ymin'] ymax = obj['ymax'] + + # Enforcing checks + 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) From 632c8815bfdad530b7f68a4b8f2dab6100ad5a9d Mon Sep 17 00:00:00 2001 From: himalayanZephyr <42401082+himalayanZephyr@users.noreply.github.com> Date: Fri, 6 Dec 2019 11:56:35 +0000 Subject: [PATCH 2/2] Changing index starting from 0 instead of 1 This issue was detected in the following way: On running auto annotation by mapping a custom label to 'Person', it was detecting 'bicycle' --- utils/open_model_zoo/yolov3/mapping.json | 160 +++++++++++------------ 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/utils/open_model_zoo/yolov3/mapping.json b/utils/open_model_zoo/yolov3/mapping.json index 15e7420b8d0..bfb65a24cf0 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" } }