Skip to content

Instantly share code, notes, and snippets.

View markub3327's full-sized avatar
🐢
Slowly but surely to the goals.

Martin Kubovčík markub3327

🐢
Slowly but surely to the goals.
  • University of Ss. Cyril and Methodius in Trnava
  • Slovakia
  • X @markub3327
View GitHub Profile
@markub3327
markub3327 / iou.py
Created June 9, 2023 18:42 — forked from meyerjo/iou.py
Python code to compute the intersection of two boundingboxes
def bb_intersection_over_union(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of intersection rectangle
interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0))
if interArea == 0:
@markub3327
markub3327 / k-pia-z-pisn-ka-time_series.ipynb
Created March 8, 2023 20:54
k-pia-z-pisn-ka-time_series.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@markub3327
markub3327 / get_dataset_partitions_tf.py
Last active May 14, 2022 18:26 — forked from angeligareta/get_dataset_partitions_tf.py
Method to split a tensorflow dataset (tf.data.Dataset) into train, validation and test splits
def get_dataset_partitions_tf(ds, ds_size, train_split=0.7, val_split=0.15, test_split=0.15, shuffle=True, shuffle_size=10000, batch_size=32):
assert (train_split + test_split + val_split) == 1
if shuffle:
# Specify seed to always have the same split distribution between runs
ds = ds.shuffle(shuffle_size, seed=12, reshuffle_each_iteration=False)
train_size = int(train_split * ds_size)
val_size = int(val_split * ds_size)