INNER CODE UNIT · Python

ESRGAN

KlingAIResearch/ReCamMaster · diffsynth/extensions/ESRGAN/__init__.py:85

class ESRGAN(torch.nn.Module):
    def __init__(self, model):
        super().__init__()
        self.model = model

    @staticmethod
    def from_model_manager(model_manager):
        return ESRGAN(model_manager.fetch_model("esrgan"))

    def process_image(self, image):
        image = torch.Tensor(np.array(image, dtype=np.float32) / 255).permute(2, 0, 1)
        return image
    
    def process_images(self, images):
        images = [self.process_image(image) for image in images]
        images = torch.stack(images)
        return images
    

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…