def generateCountMaps(self, coords):
'''Generates a count map for the provided list of coordinates.
'''
s = self.config['projective_field_size']
unpadded_size = self.config['output_size']
target_size = 3 + unpadded_size + 2 * s
countMaps = np.zeros((self.config['cls_nb'], target_size, target_size), dtype=np.int16)
for coord in coords:
y = coord[1] - self.config['contextual_pad']
x = coord[2] - self.config['contextual_pad']
if y >= 0 and y < self.config['tile_size'] and \
x >= 0 and x < self.config['tile_size']:
self.inc_region(countMaps[coord[0]], *self.target_sizes[y, x])
return np.moveaxis(countMaps, 0, -1).astype(np.float32)
评论列表
文章目录