0
0
Prompt Engineering / GenAIml~12 mins

Inpainting and outpainting in Prompt Engineering / GenAI - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Inpainting and outpainting

This pipeline shows how a generative AI model fills missing parts inside an image (inpainting) or extends the image beyond its original borders (outpainting). It learns from existing image data to create realistic new pixels.

Data Flow - 5 Stages
1Input Image
1 image x 256 x 256 x 3 channelsOriginal image with missing or extended areas marked1 image x 256 x 256 x 3 channels
A photo of a landscape with a blank square in the center (inpainting) or blank space on the right edge (outpainting)
2Mask Application
1 image x 256 x 256 x 3 channelsApply mask to indicate missing or new areas to fill1 image x 256 x 256 x 4 channels (RGB + mask)
The image now includes a mask channel showing which pixels to generate
3Feature Extraction
1 image x 256 x 256 x 4 channelsUse convolutional layers to extract image features1 tensor x 64 x 64 x 256 features
Features capture edges, colors, and textures from the visible parts
4Generative Model
1 tensor x 64 x 64 x 256 featuresUse a U-Net or transformer-based model to generate missing pixels1 image x 256 x 256 x 3 channels
Model predicts realistic pixels for masked or extended areas
5Output Image
1 image x 256 x 256 x 3 channelsCombine generated pixels with original image1 image x 256 x 256 x 3 channels
Completed image with missing parts filled or extended beyond original edges
Training Trace - Epoch by Epoch
Loss
1.2 |*****
1.0 |****
0.8 |***
0.6 |**
0.4 |*
0.2 | 
    +----------------
     1 5 10 15 20 Epochs
EpochLoss ↓Accuracy ↑Observation
11.20.45Model starts learning to fill missing areas roughly
50.80.65Generated pixels become more coherent with surroundings
100.50.80Model produces realistic textures and colors
150.350.88Fine details and edges are well reconstructed
200.250.92Model converges with high-quality inpainting and outpainting
Prediction Trace - 4 Layers
Layer 1: Input Image with Mask
Layer 2: Feature Extraction
Layer 3: Generative Model (U-Net or Transformer)
Layer 4: Combine Output
Model Quiz - 3 Questions
Test your understanding
What does the mask channel tell the model during inpainting?
AWhich pixels to generate or fill
BThe color of the missing pixels
CThe size of the image
DThe brightness of the image
Key Insight
Inpainting and outpainting models learn to fill or extend images by understanding visible patterns and textures. Masks guide where to generate pixels, and training improves the model's ability to create realistic, seamless images.