Python util.util.tensor2label() Examples

The following are 6 code examples of util.util.tensor2label(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module util.util , or try the search function .
Example #1
Source File: ui_model.py    From everybody_dance_now_pytorch with GNU Affero General Public License v3.0 5 votes vote down vote up
def get_current_visuals(self, getLabel=False):                              
        mask = self.mask     
        if self.mask is not None:
            mask = np.transpose(self.mask[0].cpu().float().numpy(), (1,2,0)).astype(np.uint8)        

        dict_list = [('fake_image', self.fake_image), ('mask', mask)]

        if getLabel: # only output label map if needed to save bandwidth
            label = util.tensor2label(self.net_input.data[0], self.opt.label_nc)                    
            dict_list += [('label', label)]

        return OrderedDict(dict_list) 
Example #2
Source File: ui_model.py    From EverybodyDanceNow_reproduce_pytorch with MIT License 5 votes vote down vote up
def get_current_visuals(self, getLabel=False):                              
        mask = self.mask     
        if self.mask is not None:
            mask = np.transpose(self.mask[0].cpu().float().numpy(), (1,2,0)).astype(np.uint8)        

        dict_list = [('fake_image', self.fake_image), ('mask', mask)]

        if getLabel: # only output label map if needed to save bandwidth
            label = util.tensor2label(self.net_input.data[0], self.opt.label_nc)                    
            dict_list += [('label', label)]

        return OrderedDict(dict_list) 
Example #3
Source File: ui_model.py    From EverybodyDanceNow-Temporal-FaceGAN with MIT License 5 votes vote down vote up
def get_current_visuals(self, getLabel=False):                              
        mask = self.mask     
        if self.mask is not None:
            mask = np.transpose(self.mask[0].cpu().float().numpy(), (1,2,0)).astype(np.uint8)        

        dict_list = [('fake_image', self.fake_image), ('mask', mask)]

        if getLabel: # only output label map if needed to save bandwidth
            label = util.tensor2label(self.net_input.data[0], self.opt.label_nc)                    
            dict_list += [('label', label)]

        return OrderedDict(dict_list) 
Example #4
Source File: ui_model.py    From deep-learning-for-document-dewarping with MIT License 5 votes vote down vote up
def get_current_visuals(self, getLabel=False):
        mask = self.mask
        if self.mask is not None:
            mask = np.transpose(self.mask[0].cpu().float().numpy(), (1,2,0)).astype(np.uint8)

        dict_list = [('fake_image', self.fake_image), ('mask', mask)]

        if getLabel: # only output label map if needed to save bandwidth
            label = util.tensor2label(self.net_input.data[0], self.opt.label_nc)
            dict_list += [('label', label)]

        return OrderedDict(dict_list) 
Example #5
Source File: pix2pixHD_condImgColor_model.py    From neurips18_hierchical_image_manipulation with MIT License 5 votes vote down vote up
def get_current_visuals(self):
        return OrderedDict([
            ('input_label', util.tensor2label(self.input_label, self.opt.label_nc)),
            ('input_image', util.tensor2im(self.input_image)),
            ('real_image', util.tensor2im(self.real_image)),
            ('synthesized_image', util.tensor2im(self.fake_image))
            ]) 
Example #6
Source File: pix2pixHD_condImg_model.py    From neurips18_hierchical_image_manipulation with MIT License 5 votes vote down vote up
def get_current_visuals(self):
        return OrderedDict([
            ('input_label', util.tensor2label(self.input_label, self.opt.label_nc)),
            ('input_image', util.tensor2im(self.input_image)),
            ('real_image', util.tensor2im(self.real_image)),
            ('synthesized_image', util.tensor2im(self.fake_image))
            ])