From d6dfe85b23c930c7c9f49c729a48bd36afdee7b2 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Sun, 7 Apr 2019 12:05:57 +0530 Subject: [PATCH 1/3] Update Autonomous driving application - Car detection - v1.ipynb Fix iou() function. The previous code doesn't pass through the grader and scores 0 for the particular graded function. Implemented the code as suggested in the exercises by using max() function instead of np.max() and returning 0 if the height or width are negative. --- ...mous driving application - Car detection - v1.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Autonomous driving application - Car detection - v1.ipynb b/Autonomous driving application - Car detection - v1.ipynb index 413c973..afc8891 100644 --- a/Autonomous driving application - Car detection - v1.ipynb +++ b/Autonomous driving application - Car detection - v1.ipynb @@ -396,11 +396,11 @@ "\n", " # Calculate the (y1, x1, y2, x2) coordinates of the intersection of box1 and box2. Calculate its Area.\n", " ### START CODE HERE ### (≈ 5 lines)\n", - " xi1 = np.max([box1[0], box2[0]])\n", - " yi1 = np.max([box1[1], box2[1]])\n", - " xi2 = np.min([box1[2], box2[2]])\n", - " yi2 = np.min([box1[3], box2[3]])\n", - " inter_area = (yi2 - yi1) * (xi2 - xi1)\n", + " xi1 = max(box1[0], box2[0])\n", + " yi1 = max(box1[1], box2[1])\n", + " xi2 = min(box1[2], box2[2])\n", + " yi2 = min(box1[3], box2[3])\n", + " inter_area = max((yi2 - yi1), 0) * max((xi2 - xi1), 0)\n", " ### END CODE HERE ### \n", "\n", " # Calculate the Union area by using Formula: Union(A,B) = A + B - Inter(A,B)\n", From b6f87c9c85e65c542af7f77a886f55288cb482b7 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Sun, 7 Apr 2019 12:15:32 +0530 Subject: [PATCH 2/3] Update io() exercise with latest version --- Autonomous driving application - Car detection - v1.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/Autonomous driving application - Car detection - v1.ipynb b/Autonomous driving application - Car detection - v1.ipynb index afc8891..53be679 100644 --- a/Autonomous driving application - Car detection - v1.ipynb +++ b/Autonomous driving application - Car detection - v1.ipynb @@ -373,6 +373,7 @@ " - xi2 = minimum of the x2 coordinates of the two boxes\n", " - yi2 = minimum of the y2 coordinates of the two boxes\n", " \n", + "- In order to compute the intersection area, you need to make sure the height and width of the intersection are positive, otherwise the intersection area should be zero. Use max(height, 0) and max(width, 0).", "In this code, we use the convention that (0,0) is the top-left corner of an image, (1,0) is the upper-right corner, and (1,1) the lower-right corner. " ] }, From d19a93ec5b7b88f9031bf22ea93aa148bc1e0eb9 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Sun, 7 Apr 2019 12:18:46 +0530 Subject: [PATCH 3/3] Fix formatting in iou() --- Autonomous driving application - Car detection - v1.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Autonomous driving application - Car detection - v1.ipynb b/Autonomous driving application - Car detection - v1.ipynb index 53be679..62f128e 100644 --- a/Autonomous driving application - Car detection - v1.ipynb +++ b/Autonomous driving application - Car detection - v1.ipynb @@ -373,7 +373,7 @@ " - xi2 = minimum of the x2 coordinates of the two boxes\n", " - yi2 = minimum of the y2 coordinates of the two boxes\n", " \n", - "- In order to compute the intersection area, you need to make sure the height and width of the intersection are positive, otherwise the intersection area should be zero. Use max(height, 0) and max(width, 0).", + "- In order to compute the intersection area, you need to make sure the height and width of the intersection are positive, otherwise the intersection area should be zero. Use max(height, 0) and max(width, 0).\n\n", "In this code, we use the convention that (0,0) is the top-left corner of an image, (1,0) is the upper-right corner, and (1,1) the lower-right corner. " ] },