diff --git a/Specialization_Deep_Learning_deeplearning.ai/Course4_Convolutional Neural Networks/week3_Object detection/Autonomous+driving+application+-+Car+detection+-+v1.ipynb b/Specialization_Deep_Learning_deeplearning.ai/Course4_Convolutional Neural Networks/week3_Object detection/Autonomous+driving+application+-+Car+detection+-+v1.ipynb index 2f979e4..44650c0 100644 --- a/Specialization_Deep_Learning_deeplearning.ai/Course4_Convolutional Neural Networks/week3_Object detection/Autonomous+driving+application+-+Car+detection+-+v1.ipynb +++ b/Specialization_Deep_Learning_deeplearning.ai/Course4_Convolutional Neural Networks/week3_Object detection/Autonomous+driving+application+-+Car+detection+-+v1.ipynb @@ -366,7 +366,9 @@ "\n", "**Exercise**: Implement iou(). Some hints:\n", "- In this exercise only, we define a box using its two corners (upper left and lower right): (x1, y1, x2, y2) rather than the midpoint and height/width.\n", - "- To calculate the area of a rectangle you need to multiply its height (y2 - y1) by its width (x2 - x1)\n", + "- To calculate the + + of a rectangle you need to multiply its height (y2 - y1) by its width (x2 - x1)\n", "- You'll also need to find the coordinates (xi1, yi1, xi2, yi2) of the intersection of two boxes. Remember that:\n", " - xi1 = maximum of the x1 coordinates of the two boxes\n", " - yi1 = maximum of the y1 coordinates of the two boxes\n", @@ -400,7 +402,7 @@ " yi1 = np.maximum(box1[1],box2[1])\n", " xi2 = np.minimum(box1[2],box2[2])\n", " yi2 = np.minimum(box1[3],box2[3])\n", - " inter_area = (yi1 - yi2)*(xi1 - xi2)\n", + " inter_area=max(xi2-xi1,0)*max(yi2-yi1,0)", " ### END CODE HERE ### \n", "\n", " # Calculate the Union area by using Formula: Union(A,B) = A + B - Inter(A,B)\n",