Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Autonomous driving application - Car detection - v1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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).\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. "
]
},
Expand All @@ -396,11 +397,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",
Expand Down