Session20 / README.md
Navyabhat's picture
Upload 10 files
dcfb6cf verified

A newer version of the Gradio SDK is available: 4.37.1

Upgrade
metadata
title: 'ERA SESSION20 - Stable Diffusion: Generative Art with Guidance'
emoji: 🌍
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 3.48.0
app_file: app.py
pinned: false
license: mit

Styles Used:

  1. Oil style
  2. Xyz
  3. Allante
  4. Moebius
  5. Polygons

Result of Experiments with different styles:

Prompt: "a cat and dog in the style of cs"
"cs" in the prompt refers to "custom style" whose embedding is replaced by each of the concept embeddings shown below image


Prompt: "dolphin swimming on Mars in the style of cs" image

Result of Experiments with Guidance loss functions:

Prompt: "a mouse in the style of cs" Loss Function: python def loss_fn(images): return images.mean() image

def loss_fn(images):
    return -images.median()/3

image

def loss_fn(images):
    error = (images - images.min()) / 255*(images.max() - images.min())
    return error.mean()

image

Prompt: "angry german shephard in the style of cs"

def loss_fn(images):
    error1 = torch.abs(images[:, 0] - 0.9)
    error2 = torch.abs(images[:, 1] - 0.9)
    error3 = torch.abs(images[:, 2] - 0.9)
    return (
        torch.sin(error1.mean()) + torch.sin(error2.mean()) + torch.sin(error3.mean())
    ) / 3

image


Prompt: "A campfire (oil on canvas)"

def loss_fn(images):
    error1 = torch.abs(images[:, 0] - 0.9)
    error2 = torch.abs(images[:, 1] - 0.9)
    error3 = torch.abs(images[:, 2] - 0.9)
    return (
        torch.sin((error1 * error2 * error3)).mean()
        + torch.cos((error1 * error2 * error3)).mean()
    )

image


def loss_fn(images):
    error1 = torch.abs(images[:, 0] - 0.9)
    error2 = torch.abs(images[:, 1] - 0.9)
    error3 = torch.abs(images[:, 2] - 0.9)
    return (
        torch.sin(error1.mean()) + torch.sin(error2.mean()) + torch.sin(error3.mean())
    ) / 3

image