Ejemplo n.º 1
0
    def _get_patch(self, hr, filename):
        patch_size = self.args.patch_size

        if self.train:
            scale = self.scale[0]
            if self.args.task_type == 'denoising':
                lr, hr = common.get_patch_noise(
                    hr, patch_size, scale
                )
            if self.args.task_type == 'SISR':
                lr, hr = common.get_patch_bic(
                    hr, patch_size, scale
                )
            if self.args.task_type == 'JIAR':
                lr, hr = common.get_patch_compress(
                    hr, patch_size, scale
                )

            lr, hr = common.augment([lr, hr])
            return lr, hr, scale
        else:
            scale = self.scale[0]
            if self.args.task_type == 'denoising':
                lr, hr = common.add_img_noise(
                    hr, scale
                )
            if self.args.task_type == 'SISR':
                lr, hr = self._get_patch_test(
                    hr, patch_size, scale
                )
            if self.args.task_type == 'JIAR':
                lr, hr = common.get_img_compress(
                    hr, patch_size, scale
                )
            return lr, hr, scale
Ejemplo n.º 2
0
 def _get_patch(self, hr, lr):
     import pdb; pdb.set_trace()
     patch_size = self.args.patch_size
     #print(hr.shape)
     if self.train:
         scale = self.scale[0]
         if self.args.task_type == 'denoising':
             lr, hr = lr, hr #common.get_patch_noise( hr, patch_size, scale)
         if self.args.task_type == 'SISR':
             lr, hr = common.get_patch_bic( hr, patch_size, scale)
         if self.args.task_type == 'JIAR':
             lr, hr = common.get_patch_compress( hr, patch_size, scale)
         #lr, hr = common.augment([lr, hr])
         return lr, hr, scale
     else:
         scale = self.scale[0]
         if self.args.task_type == 'denoising':
             lr, hr = lr, hr #common.get_img_noise( hr, patch_size, scale)
         if self.args.task_type == 'SISR':
             lr, hr = self._get_patch_test( hr, patch_size, scale)
         if self.args.task_type == 'JIAR':
             lr, hr = common.get_img_compress( hr, patch_size, scale)
         return lr, hr, scale
Ejemplo n.º 3
0
    def _get_patch(self, hr, filename):
        patch_size = self.args.patch_size

        if self.train:
            scale = self.scale[0]
            #print("GETTING PATCH", hr.shape)
            if self.args.task_type == 'denoising':
                lr, hr = common.get_patch_noise(hr, patch_size, scale)
            if self.args.task_type == 'SISR':
                lr, hr = common.get_patch_bic(hr, patch_size, scale)
            if self.args.task_type == 'JIAR':
                lr, hr = common.get_patch_compress(hr, patch_size, scale)
            if self.args.task_type == 'clip':
                lr, hr = common.get_patch_clip(hr, self.args.ev, 0, 255)
            if self.args.task_type == 'log':
                lr, hr = common.linearize_and_scale(hr,
                                                    scale_to=2.0,
                                                    clip_at=1.0)
            #print("LR", lr[0, :5],"\nHR", hr[0, :5])
            lr, hr = common.augment([lr, hr])
            return lr, hr, scale
        else:
            scale = self.scale[0]
            if self.args.task_type == 'denoising':
                lr, hr = common.get_img_noise(hr, patch_size, scale)
            if self.args.task_type == 'SISR':
                lr, hr = self._get_patch_test(hr, patch_size, scale)
            if self.args.task_type == 'JIAR':
                lr, hr = common.get_img_compress(hr, patch_size, scale)
            if self.args.task_type == 'clip':
                lr, hr = common.get_patch_clip(hr, self.args.ev, 0, 255)
            if self.args.task_type == 'log':
                lr, hr = common.linearize_and_scale(hr,
                                                    scale_to=2.0,
                                                    clip_at=1.0)
            return lr, hr, scale