SLIC_new_cityscapes_training_server_parallel.py 文件源码

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

项目:SLIC_cityscapes 作者: wpqmanu 项目源码 文件源码
def calcdistance_mat(self, points, center, spatialmax):
        ## -- L2norm optimized -- ##
        center = scipy.array(center)

        location_center=center[:2]
        color_center=center[2:]

        location_points=points[:,:,:2]
        color_points=points[:,:,2:]

        difs_location=location_points-location_center
        difs_color=1-np.equal(color_points,color_center)
        if len(difs_color.shape)==2:
            difs_color=np.expand_dims(difs_color, axis=2)

        difs=np.concatenate((difs_location,difs_color),axis=2)

        norm = (difs ** 2).astype(float)
        norm[:, :, 0:2] *= (float(self.MM) / (spatialmax * spatialmax))  # color weight on location term
        norm = scipy.sum(norm, 2)
        return norm
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号