// directly load mask offline
// TODO: make masks variant each image in a batch
self.mask_global = input["M"].to(self.device).byte()
self.mask_global = self.mask_global.narrow(0,0,1).narrow(1,0,1)
// create mask online
if not self.opt.offline_loading_mask:
After Change
self.mask_global = self.create_random_mask().type_as(self.mask_global).view(1, *self.mask_global.size()[-3:])
// As generating random masks online are computation-heavy
// So just generate one ranodm mask for a batch images.
self.mask_global = self.mask_global.expand(self.opt.batchSize, *self.mask_global.size()[-3:])
else:
raise ValueError("Mask_type [%s] not recognized." % self.opt.mask_type)
// For loading mask offline, we also need to change "opt.mask_type" and "opt.mask_sub_type"