Lucrare 7 AI
Lucrare 7 AI
def getWidth(bounds):
try:
(xmin, ymin, xmax, ymax) = bounds
return np.abs(xmax - xmin)
except:
return np.nan
def getHeight(bounds):
try:
(xmin, ymin, xmax, ymax) = bounds
return np.abs(ymax - ymin)
except:
return np.nan
TILE_WIDTH = 512
TILE_HEIGHT = 512
TILE_OVERLAP = 64
TRUNCATED_PERCENT = 0.3
_overwriteFiles = True
if (x_min > width) or (x_max < 0.0) or (y_min > height) or (y_max <
0.0):
return None
for x in range(X_TILES):
for y in range(Y_TILES):
found_tags = [
tag_is_inside_tile(bounds, x_start, y_start, TILE_WIDTH,
TILE_HEIGHT, TRUNCATED_PERCENT)
for i, bounds in enumerate(img_labels['bounds'])]
found_tags = [el for el in found_tags if el is not None]