diff --git a/VHR/segmentation.py b/VHR/segmentation.py index ec8069cf64b50bc84f91cd0b34935e43ef0d5dc2..b3c7142ccbb2e12a9f8efd26f227744813da6586 100644 --- a/VHR/segmentation.py +++ b/VHR/segmentation.py @@ -232,12 +232,21 @@ def tiled_vectorization(input_segm, nominal_tile_size, output_template): tx, ty = int(arr.shape[1] / nominal_tile_size[0]) + 1, int(arr.shape[0] / nominal_tile_size[1]) + 1 - obj_to_tile = dict.fromkeys(range(tx*ty), []) + obj_to_tile = dict.fromkeys(range(tx*ty)) + for i in range(tx*ty): + obj_to_tile[i] = [] for o in rp: - idx = int(o.bbox[1] / nominal_tile_size[0]) * ty + int(o.bbox[0] / nominal_tile_size[1]) + ix, iy = int(o.bbox[1] / nominal_tile_size[0]), int(o.bbox[0] / nominal_tile_size[1]) + idx = ix * ty + iy obj_to_tile[idx].append(o.label) + import matplotlib.pyplot as plt + for i in range(tx*ty): + test = np.isin(arr, np.array(obj_to_tile[i])) + plt.figure() + plt.imshow(test) + return obj_to_tile def get_bounding_boxes(input_segm):