def generateLargeCountMaps(self, coords):
'''Generates a count map for the provided list of coordinates.
'''
c = self.config['target_context_pad']
target_size = 3 + self.config['output_size'] + 2 * c
count_maps = np.zeros((self.config['cls_nb'], target_size, target_size), dtype=np.int16)
# We want coordinates relative to the fully padded large size. For that we
# first get coordinates wrt the unpadded tile and then set the upper left
# corner of the large size as the origin.
pad = self.config['large_contextual_pad']
shift = - self.config['contextual_pad'] + pad
r = self.config['receptive_field_size']
tile_size = self.config['tile_size']
size = tile_size + 2 * pad
for coord in coords:
y = coord[1] + shift
x = coord[2] + shift
if (not (y >= pad and y < pad + tile_size and \
x >= pad and x < pad + tile_size)) and \
y >= r and y < size - r and \
x >= r and x < size - r:
self.inc_region(count_maps[coord[0]], *self.target_sizes_large[y - r, x - r])
# t = np.concatenate(count_maps)
# data_preparation.imshow(t, normalize=True, save=True, title='large')
return np.moveaxis(count_maps, 0, -1).astype(np.float32)
contextual_inception_model.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录