You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/12/12 22:16:13 UTC

[GitHub] piiswrong closed pull request #8547: Revised validating process of a bounding box in ImageDetIter

piiswrong closed pull request #8547: Revised validating process of a bounding box in ImageDetIter
URL: https://github.com/apache/incubator-mxnet/pull/8547
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nnvm b/nnvm
index 8d79cfd0b4..c86afa8f17 160000
--- a/nnvm
+++ b/nnvm
@@ -1 +1 @@
-Subproject commit 8d79cfd0b42fbe9f6ad75886d495065d5500b9dd
+Subproject commit c86afa8f17a44bcd4e6eec41cd49ba87e4f7a635
diff --git a/python/mxnet/image/detection.py b/python/mxnet/image/detection.py
index 6ed9c3a974..44dcfe5ed8 100644
--- a/python/mxnet/image/detection.py
+++ b/python/mxnet/image/detection.py
@@ -726,10 +726,23 @@ def _parse_label(self, label):
                 %(str(raw.shape), obj_width)
             raise RuntimeError(msg)
         out = np.reshape(raw[header_width:], (-1, obj_width))
-        # remove bad ground-truths
-        valid = np.where(np.logical_and(out[:, 3] > out[:, 1], out[:, 4] > out[:, 2]))[0]
+
+        # remove invalid ground-truths
+        if ((obj_width - 1) / 4) == 1:
+            # x1 > x0 and y1 > y0
+            valid = np.where(np.logical_and(out[:, 3] > out[:, 1], out[:, 4] > out[:, 2]))[0]
+        elif ((obj_width - 1) / 4) == 2:
+            # x1 > x0 and x2 > x3
+            check_x = np.logical_and(out[:, 3] > out[:, 1], out[:, 5] > out[:, 7])
+            # y2 > y1 and y3 > y0
+            check_y = np.logical_and(out[:, 6] > out[:, 4], out[:, 8] > out[:, 2])
+            valid = np.where(np.logical_and(check_x, check_y))[0]
+        else:
+            raise RuntimeError('Object width is not valid.')
+
         if valid.size < 1:
             raise RuntimeError('Encounter sample with no valid label.')
+
         return out[valid, :]
 
     def reshape(self, data_shape=None, label_shape=None):


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services