
parts of the image willīe masked out with mask_image and repainted according to prompt. Image, or tensor representing an image batch which will be inpainted, i.e. image ( torch.FloatTensor or or List).The exemplar image to guide the image generation. example_image ( torch.FloatTensor or or List).Library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) Check the superclass documentation for the generic methods the This model inherits from DiffusionPipeline. Pipeline for image-guided image inpainting using Stable Diffusion. Model that extracts features from generated images to be used as inputs for the safety_checker. feature_extractor ( CLIPImageProcessor).Please, refer to the model card for details. safety_checker ( StableDiffusionSafet圜hecker) -Ĭlassification module that estimates whether generated images could be considered offensive or harmful.Can be one ofĭDIMScheduler, LMSDiscreteScheduler, or PNDMScheduler. unet ( UNet2DConditionModel) - Conditional U-Net architecture to denoise the encoded image latents.Ī scheduler to be used in combination with unet to denoise the encoded image latents.The unet is conditioned on the example image instead of a text prompt. image_encoder ( PaintByExampleImageEncoder) -Įncodes the example input image.Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations. Image = pipe(image=init_image, mask_image=mask_image, example_image=example_image).images Mask_image = download_image(mask_url).resize(( 512, 512))Įxample_image = download_image(example_url).resize(( 512, 512))
#Paint by number photo generator install


The abstract of the paper is the following:

Paint by Example: Exemplar-based Image Editing with Diffusion Models by Binxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, Fang Wen.
