Skip to content

Update Autonomous driving application - Car detection - v1.ipynb#4

Open
aissam-out wants to merge 1 commit intoenggen:masterfrom
aissam-out:patch-2
Open

Update Autonomous driving application - Car detection - v1.ipynb#4
aissam-out wants to merge 1 commit intoenggen:masterfrom
aissam-out:patch-2

Conversation

@aissam-out
Copy link
Copy Markdown

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.

@enggen enggen self-requested a review August 10, 2019 15:18
@enggen enggen assigned enggen and unassigned enggen Aug 10, 2019
@pradumna-gautam
Copy link
Copy Markdown

Correct Code -

Calculate the (yi1, xi1, yi2, xi2) coordinates of the intersection of box1 and box2. Calculate its Area.

### START CODE HERE ### (≈ 7 lines)
yi1 = max(box1[1], box2[1])
xi1 = max(box1[0], box2[0])
yi1 = max(box1[1], box2[1])
xi2 = min(box1[2], box2[2])
yi2 = min(box1[3], box2[3])
inter_area = (xi2 - xi1)*(yi2 - yi1)
inter_area = max((xi2 - xi1), 0)*max((yi2 - yi1), 0)
### END CODE HERE ###    

It will give you following results :

iou for intersecting boxes = 0.14285714285714285
iou for non-intersecting boxes = 0.0
iou for boxes that only touch at vertices = 0.0
iou for boxes that only touch at edges = 0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants