Commit 16f9c032 authored by Shaoshuai Shi's avatar Shaoshuai Shi
Browse files

change image padding from nan to zero

parent a481fba1
......@@ -43,12 +43,6 @@ class DatasetTemplate(torch_data.Dataset):
self.depth_downsample_factor = self.data_processor.depth_downsample_factor
else:
self.depth_downsample_factor = None
self.gt_sampler_with_img = False
for augmentor in self.data_augmentor.data_augmentor_queue:
if isinstance(augmentor, DataBaseSampler):
if augmentor.aug_with_img:
self.gt_sampler_with_img = True
@property
def mode(self):
......@@ -212,8 +206,7 @@ class DatasetTemplate(torch_data.Dataset):
pad_h = common_utils.get_pad_params(desired_size=max_h, cur_size=image.shape[0])
pad_w = common_utils.get_pad_params(desired_size=max_w, cur_size=image.shape[1])
pad_width = (pad_h, pad_w)
# Pad with nan, to be replaced later in the pipeline.
pad_value = 0 if self.gt_sampler_with_img else np.nan
pad_value = 0
if key == "images":
pad_width = (pad_h, pad_w, (0, 0))
......
......@@ -151,7 +151,7 @@ class DDNTemplate(nn.Module):
x = images
if self.pretrained:
# Create a mask for padded pixels
mask = torch.isnan(x)
mask = (x == 0)
# Match ResNet pretrained preprocessing
x = normalize(x, mean=self.norm_mean, std=self.norm_std)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment