when your input patch size are not equal in three axis, the current scale method in datasets/bbox_reader.py will go wrong because of it's padding size are not equal in x, y, z direction.
2. Possible fix solution
Origin solution:
if isScale:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
crop = zoom(crop,[1,scale,scale,scale],order=1)
newpad = self.crop_size[0]-crop.shape[1:][0]
if newpad<0:
crop = crop[:,:-newpad,:-newpad,:-newpad]
elif newpad>0:
pad2 = [[0,0],[0,newpad],[0,newpad],[0,newpad]]
crop = np.pad(crop,pad2,'constant',constant_values =self.pad_value)
for i in range(4):
target[i] = target[i]*scale
for i in range(len(bboxes)):
for j in range(4):
bboxes[i][j] = bboxes[i][j]*scale
My fix:
if isScale:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
crop = zoom(crop,[1,scale,scale,scale],order=1)
newpad = np.array(self.crop_size)-np.array(crop.shape[1:])
if newpad[0] < 0 or newpad[1] < 0 or newpad[2] < 0:
crop = crop[:,:-newpad[0],:-newpad[1],:-newpad[2]]
elif newpad[0] > 0 or newpad[1] > 0 or newpad[2] > 0:
pad2 = [[0,0],[0,newpad[0]],[0,newpad[1]],[0,newpad[2]]]
crop = np.pad(crop, pad2,'constant', constant_values = self.pad_value)
for i in range(4):
target[i] = target[i]*scale
for i in range(len(bboxes)):
for j in range(4):
bboxes[i][j] = bboxes[i][j]*scale
1. Bug description
when your input patch size are not equal in three axis, the current scale method in datasets/bbox_reader.py will go wrong because of it's padding size are not equal in x, y, z direction.
2. Possible fix solution
Origin solution:
My fix: