(self, imagedata, activations, unit=None,
            level=None, percent_level=None)
return result_image
Visualizes the given activations, thresholded at a specified level,
        overlaid on the given image, as a pytorch byte tensor (channel first).
Visualizes the given activations, thresholded at a specified level,
        overlaid on the given image, as a pytorch byte tensor (channel first).
Visualizes the given activations thresholded at a specified level overlaid on the given image as a pytorch byte tensor ( channel first ) .
def pytorch_masked_image(self, imagedata, activations, unit=None,
            level=None, percent_level=None):
        '''
        Visualizes the given activations, thresholded at a specified level,
        overlaid on the given image, as a pytorch byte tensor (channel first).
        '''
        scaled_image = self.scaled_image(imagedata).float().cpu()
        mask = self.pytorch_mask(activations, unit, level=level,
                percent_level=percent_level).cpu()
        border = border_from_mask(mask)
        inside = (mask & (~border))
        outside = (~mask & (~border))
        inside, outside, border = [d.float() for d in [inside, outside, border]]
        yellow = torch.tensor([255.0, 255.0, 0],
                dtype=border.dtype, device=border.device)[:,None,None]
        result_image = (
                scaled_image * inside +
                yellow * border +
                0.5 * scaled_image * outside).clamp(0, 255).byte()
        return result_image
def pytorch_masked_image ( self , imagedata , activations , unit = None , level = None , percent_level = None ) : scaled_image = self . scaled_image ( imagedata ) . float ( ) . cpu ( ) mask = self . pytorch_mask ( activations , unit , level = level , percent_level = percent_level ) . cpu ( ) border = border_from_mask ( mask ) inside = ( mask & ( ~ border ) ) outside = ( ~ mask & ( ~ border ) ) inside , outside , border = [ d . float ( ) for d in [ inside , outside , border ] ] yellow = torch . tensor ( [ 255.0 , 255.0 , 0 ] , dtype = border . dtype , device = border . device ) [ : , None , None ] result_image = ( scaled_image * inside + yellow * border + 0.5 * scaled_image * outside ) . clamp ( 0 , 255 ) . byte ( ) return result_image