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

change image padding from nan to zero

parent a481fba1
...@@ -44,12 +44,6 @@ class DatasetTemplate(torch_data.Dataset): ...@@ -44,12 +44,6 @@ class DatasetTemplate(torch_data.Dataset):
else: else:
self.depth_downsample_factor = None 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 @property
def mode(self): def mode(self):
return 'train' if self.training else 'test' return 'train' if self.training else 'test'
...@@ -212,8 +206,7 @@ class DatasetTemplate(torch_data.Dataset): ...@@ -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_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_w = common_utils.get_pad_params(desired_size=max_w, cur_size=image.shape[1])
pad_width = (pad_h, pad_w) pad_width = (pad_h, pad_w)
# Pad with nan, to be replaced later in the pipeline. pad_value = 0
pad_value = 0 if self.gt_sampler_with_img else np.nan
if key == "images": if key == "images":
pad_width = (pad_h, pad_w, (0, 0)) pad_width = (pad_h, pad_w, (0, 0))
......
...@@ -151,7 +151,7 @@ class DDNTemplate(nn.Module): ...@@ -151,7 +151,7 @@ class DDNTemplate(nn.Module):
x = images x = images
if self.pretrained: if self.pretrained:
# Create a mask for padded pixels # Create a mask for padded pixels
mask = torch.isnan(x) mask = (x == 0)
# Match ResNet pretrained preprocessing # Match ResNet pretrained preprocessing
x = normalize(x, mean=self.norm_mean, std=self.norm_std) 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