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
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down