def get_crop_ix(self,training_size):
rescale_sizes=self.rescale_size
crop_inds=[]
for size_pair in rescale_sizes:
mother_w,mother_h=size_pair
crop_ix=np.zeros([5,4],dtype=np.int16)
w_indices=(0,mother_w-training_size)
h_indices=(0,mother_h-training_size)
w_center=(mother_w-training_size)/2
h_center=(mother_h-training_size)/2
crop_ix[4,:]=[w_center,h_center,training_size+w_center,training_size+h_center]
cnt=0
for i in w_indices:
for j in h_indices:
crop_ix[cnt,:]=[i,j,i+training_size,j+training_size]
cnt+=1
crop_inds.append(crop_ix)
return crop_inds
dataset.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录