Skip to content

Commit 8af03d7

Browse files
committed
initial commit with Jupyter Notebooks, python functions folders and images
0 parents  commit 8af03d7

File tree

495 files changed

+15766
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+15766
-0
lines changed

EDA.ipynb

+1,926
Large diffs are not rendered by default.

KOIOS_Project.ipynb

+1,499
Large diffs are not rendered by default.

calculate_iou.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
################################################################################################################################
2+
3+
import numpy as np
4+
5+
################################################################################################################################
6+
7+
# Straightforward IoU calculation that is not concerned with tensorflow formatting.
8+
9+
def calculate_iou(y_true, y_pred):
10+
# input must be as [x1, y1, x2, y2]
11+
12+
y_true = y_true.astype(np.float32)
13+
y_pred = y_pred.astype(np.float32)
14+
15+
# AOG = Area of Groundtruth box
16+
AoG = np.abs(y_true[2] - y_true[0]) * np.abs(y_true[3] - y_true[1])
17+
18+
# AOP = Area of Predicted box
19+
AoP = np.abs(y_pred[2] - y_pred[0]) * np.abs(y_pred[3] - y_pred[1])
20+
21+
# overlaps are the co-ordinates of intersection box
22+
overlap_0 = np.maximum(y_true[0], y_pred[0])
23+
overlap_1 = np.maximum(y_true[1], y_pred[1])
24+
overlap_2 = np.minimum(y_true[2], y_pred[2])
25+
overlap_3 = np.minimum(y_true[3], y_pred[3])
26+
27+
# intersection area
28+
intersection = np.abs(overlap_2 - overlap_0) * np.abs(overlap_3 - overlap_1)
29+
30+
# area of union of both boxes
31+
union = AoG + AoP - intersection
32+
33+
# iou calculation
34+
iou = intersection / union
35+
36+
# return the mean IoU score for the batch
37+
return iou
38+
39+
################################################################################################################################

cimalab/dataframe/bbox.csv

+640
Large diffs are not rendered by default.

cimalab/dataframe/bbox2.csv

+3,235
Large diffs are not rendered by default.

cimalab/dataframe/cases.csv

+491
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)