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
SLIC_new_cityscapes_training_server_parallel.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录