Spaces:
Running
Running
Delete README.md
Browse files
README.md
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
# Stable Diffusion Style Transfer with Color Distance Loss
|
2 |
-
|
3 |
-
This project implements a Stable Diffusion-based image generation system with custom style transfers and color enhancement through a distance loss function.
|
4 |
-
|
5 |
-
## ๐จ Features
|
6 |
-
|
7 |
-
### Style Transfer
|
8 |
-
- Implements 5 different artistic styles:
|
9 |
-
- Ronaldo Style (Sports scenes)
|
10 |
-
- Canna Lily (Nature and flowers)
|
11 |
-
- Three Stooges (Comedy scenes)
|
12 |
-
- Pop Art (Vibrant artistic style)
|
13 |
-
- Bird Style (Wildlife imagery)
|
14 |
-
|
15 |
-
### Color Distance Loss
|
16 |
-
The project implements a unique color enhancement through RGB channel separation:
|
17 |
-
- Calculates distances between RGB channels
|
18 |
-
- Enhances color vibrancy and contrast
|
19 |
-
- Creates more distinct color separation
|
20 |
-
- Reduces color mixing and muddiness
|
21 |
-
|
22 |
-
### Interactive Interface
|
23 |
-
- User-friendly Gradio web interface
|
24 |
-
- Side-by-side comparison of original and enhanced images
|
25 |
-
- Real-time style selection
|
26 |
-
- Example prompts for each style
|
27 |
-
|
28 |
-
## ๐ Setup and Installation
|
29 |
-
|
30 |
-
1. Install dependencies:
|
31 |
-
bash
|
32 |
-
pip install -r requirements.txt
|
33 |
-
|
34 |
-
2. Required files:
|
35 |
-
- Style embeddings (.bin files):
|
36 |
-
- ronaldo.bin
|
37 |
-
- canna-lily-flowers102.bin
|
38 |
-
- threestooges.bin
|
39 |
-
- pop_art.bin
|
40 |
-
- bird_style.bin
|
41 |
-
|
42 |
-
3. Run the application:
|
43 |
-
bash
|
44 |
-
python app.py
|
45 |
-
|
46 |
-
## ๐ฎ Usage
|
47 |
-
|
48 |
-
1. Enter a text prompt describing your desired image
|
49 |
-
2. Select a style using the radio buttons
|
50 |
-
3. Click "Generate Images" to create:
|
51 |
-
- Left: Original styled image
|
52 |
-
- Right: Image with color distance loss applied
|
53 |
-
|
54 |
-
## ๐ง Technical Details
|
55 |
-
|
56 |
-
### Distance Loss Function
|
57 |
-
def Distance_loss(images):
|
58 |
-
# Extract RGB channels
|
59 |
-
red = images[:,0:1]
|
60 |
-
green = images[:,1:2]
|
61 |
-
blue = images[:,2:3]
|
62 |
-
# Calculate channel distances
|
63 |
-
rg_distance = ((red - green) 2).mean()
|
64 |
-
rb_distance = ((red - blue) 2).mean()
|
65 |
-
gb_distance = ((green - blue) 2).mean()
|
66 |
-
return (rg_distance + rb_distance + gb_distance) 100
|
67 |
-
|
68 |
-
This loss function:
|
69 |
-
- Separates RGB channels
|
70 |
-
- Calculates squared distances between channels
|
71 |
-
- Enhances color distinctiveness
|
72 |
-
- Applies during the generation process
|
73 |
-
|
74 |
-
## ๐ Example Prompts
|
75 |
-
|
76 |
-
- Sports: "a soccer player celebrating a goal"
|
77 |
-
- Nature: "beautiful flowers in a garden"
|
78 |
-
- Comedy: "three comedians performing a skit"
|
79 |
-
- Art: "a colorful portrait in pop art style"
|
80 |
-
- Wildlife: "birds flying in a natural landscape"
|
81 |
-
|
82 |
-
## ๐ ๏ธ Requirements
|
83 |
-
|
84 |
-
- Python 3.8+
|
85 |
-
- PyTorch
|
86 |
-
- Diffusers
|
87 |
-
- Transformers
|
88 |
-
- Gradio
|
89 |
-
- CUDA-capable GPU recommended
|
90 |
-
|
91 |
-
## ๐ Results
|
92 |
-
|
93 |
-
The color distance loss typically produces:
|
94 |
-
- More vibrant colors
|
95 |
-
- Better color separation
|
96 |
-
- Enhanced contrast
|
97 |
-
- More distinctive style characteristics
|
98 |
-
|
99 |
-
## ๐ค Contributing
|
100 |
-
|
101 |
-
Feel free to:
|
102 |
-
- Submit issues
|
103 |
-
- Fork the repository
|
104 |
-
- Submit pull requests
|
105 |
-
|
106 |
-
## ๐ License
|
107 |
-
|
108 |
-
This project is open-source and available under the MIT License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|