basic_model.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:sea-lion-counter 作者: rdinse 项目源码 文件源码
def generateCountMaps(self, coords):
    '''Generates a count map for the provided list of coordinates.  It can
    count at most 256 object within the receptive field.  Beyond that it
    overflows.
    '''

    s = self.config['receptive_field_size']
    pad = s // 2
    unpadded_size = self.config['tile_size']
    target_size = 1 + unpadded_size + 2 * pad
    countMaps = np.zeros((self.config['cls_nb'], target_size, target_size), dtype=np.int16)

    y_min = 0
    y_max = unpadded_size
    x_min = 0
    x_max = unpadded_size
    for coord in coords:
      if coord[1] >= y_min and coord[1] < y_max and coord[2] >= x_min and coord[2] < x_max:
        self.inc_region(countMaps[coord[0]], coord[1] + pad, coord[2] + pad, s, s)

    return np.moveaxis(countMaps, 0, -1).astype(np.float32)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号