wangkanai commited on
Commit
6d29ed5
·
verified ·
1 Parent(s): 2728cb5

Add files using upload-large-folder tool

Browse files
Files changed (1) hide show
  1. README.md +117 -41
README.md CHANGED
@@ -1,5 +1,3 @@
1
- <!-- README Version: v1.0 -->
2
-
3
  ---
4
  license: apache-2.0
5
  library_name: realesrgan
@@ -13,7 +11,9 @@ tags:
13
  - image-enhancement
14
  ---
15
 
16
- # FLUX Upscale Models Collection v1.0
 
 
17
 
18
  This repository contains Real-ESRGAN upscale models for post-processing and enhancing generated images. These models can upscale images by 2x or 4x while adding fine details and improving sharpness.
19
 
@@ -21,6 +21,13 @@ This repository contains Real-ESRGAN upscale models for post-processing and enha
21
 
22
  Real-ESRGAN (Real Enhanced Super-Resolution Generative Adversarial Networks) models for high-quality image upscaling. These models are commonly used as post-processing steps for AI-generated images to increase resolution and enhance details.
23
 
 
 
 
 
 
 
 
24
  ## Repository Contents
25
 
26
  **Total Size**: ~192MB
@@ -32,19 +39,21 @@ Real-ESRGAN (Real Enhanced Super-Resolution Generative Adversarial Networks) mod
32
 
33
  ## Hardware Requirements
34
 
35
- - **VRAM**: 4GB+ recommended
36
  - **Disk Space**: 192MB
37
  - **Memory**: 8GB+ system RAM recommended
38
- - **Compatible with**: CPU or GPU inference
 
 
39
 
40
- ## Usage
41
 
42
  ```python
43
  from basicsr.archs.rrdbnet_arch import RRDBNet
44
  from realesrgan import RealESRGANer
45
  import cv2
46
 
47
- # Load the upscaler
48
  model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
49
 
50
  upsampler = RealESRGANer(
@@ -54,7 +63,7 @@ upsampler = RealESRGANer(
54
  tile=0,
55
  tile_pad=10,
56
  pre_pad=0,
57
- half=True # Use FP16 for faster inference
58
  )
59
 
60
  # Load and upscale an image
@@ -70,40 +79,124 @@ from diffusers import FluxPipeline
70
  from realesrgan import RealESRGANer
71
  from basicsr.archs.rrdbnet_arch import RRDBNet
72
  import torch
 
73
 
74
  # Generate image with FLUX
75
- pipe = FluxPipeline.from_pretrained("path/to/flux-model")
76
- image = pipe(prompt="your prompt").images[0]
 
 
 
 
 
 
 
 
77
 
78
  # Convert PIL to numpy/cv2 format
79
- import numpy as np
80
  img_array = np.array(image)
81
 
82
- # Upscale
83
- model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23)
84
  upsampler = RealESRGANer(
85
  scale=4,
86
  model_path="E:\\huggingface\\flux-upscale\\upscale_models\\4x-UltraSharp.pth",
87
- model=model
 
88
  )
 
 
89
  upscaled, _ = upsampler.enhance(img_array, outscale=4)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  ```
91
 
92
  ## Model Comparison
93
 
94
- | Model | Scale | Best For | File Size |
95
- |-------|-------|----------|-----------|
96
- | 4x-UltraSharp | 4x | Sharp details, AI-generated images | 64MB |
97
- | RealESRGAN_x2plus | 2x | Moderate upscaling, faster processing | 64MB |
98
- | RealESRGAN_x4plus | 4x | General purpose 4x upscaling | 64MB |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  ## Use Cases
101
 
102
- - Post-processing AI-generated images
103
- - Enhancing FLUX.1-dev outputs
104
- - Increasing resolution of generated artwork
105
  - Adding fine details to synthetic images
106
- - Print preparation for generated images
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  ## License
109
 
@@ -120,29 +213,12 @@ These models are released under the Apache 2.0 license.
120
  }
121
  ```
122
 
123
- ## Performance Tips
124
-
125
- - **GPU Acceleration**: Use `half=True` for FP16 inference on compatible GPUs (2x faster)
126
- - **Tiling**: For large images, enable tiling with `tile=512` to reduce VRAM usage
127
- - **Batch Processing**: Process multiple images in sequence to amortize model loading time
128
- - **CPU Fallback**: Models work on CPU but will be significantly slower
129
- - **Optimal Scale**: Use 2x for faster processing, 4x for maximum detail enhancement
130
-
131
- ## Model Specifications
132
-
133
- - **Architecture**: RRDB (Residual in Residual Dense Block)
134
- - **Input Channels**: 3 (RGB)
135
- - **Output Channels**: 3 (RGB)
136
- - **Feature Dimensions**: 64
137
- - **Blocks**: 23 (standard configuration)
138
- - **Format**: PyTorch `.pth` files
139
- - **Precision**: FP32 (supports FP16 inference)
140
-
141
  ## Links and Resources
142
 
143
  - **Real-ESRGAN Paper**: [arXiv:2107.10833](https://arxiv.org/abs/2107.10833)
144
  - **Official Repository**: [xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN)
145
  - **BasicSR Library**: [xinntao/BasicSR](https://github.com/xinntao/BasicSR)
 
146
  - **Model Downloads**: Available through official Real-ESRGAN releases
147
 
148
  ## Model Card Contact
 
 
 
1
  ---
2
  license: apache-2.0
3
  library_name: realesrgan
 
11
  - image-enhancement
12
  ---
13
 
14
+ <!-- README Version: v1.1 -->
15
+
16
+ # FLUX Upscale Models Collection v1.1
17
 
18
  This repository contains Real-ESRGAN upscale models for post-processing and enhancing generated images. These models can upscale images by 2x or 4x while adding fine details and improving sharpness.
19
 
 
21
 
22
  Real-ESRGAN (Real Enhanced Super-Resolution Generative Adversarial Networks) models for high-quality image upscaling. These models are commonly used as post-processing steps for AI-generated images to increase resolution and enhance details.
23
 
24
+ **Key Capabilities**:
25
+ - 2x and 4x image upscaling
26
+ - Detail enhancement and sharpening
27
+ - Noise reduction and artifact removal
28
+ - Optimized for AI-generated images
29
+ - CPU and GPU compatible
30
+
31
  ## Repository Contents
32
 
33
  **Total Size**: ~192MB
 
39
 
40
  ## Hardware Requirements
41
 
42
+ - **VRAM**: 4GB+ recommended for GPU inference
43
  - **Disk Space**: 192MB
44
  - **Memory**: 8GB+ system RAM recommended
45
+ - **Compatible with**: CPU or GPU inference (CUDA, ROCm, or CPU)
46
+
47
+ ## Usage Examples
48
 
49
+ ### Basic Usage with Real-ESRGAN
50
 
51
  ```python
52
  from basicsr.archs.rrdbnet_arch import RRDBNet
53
  from realesrgan import RealESRGANer
54
  import cv2
55
 
56
+ # Load the upscaler model
57
  model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
58
 
59
  upsampler = RealESRGANer(
 
63
  tile=0,
64
  tile_pad=10,
65
  pre_pad=0,
66
+ half=True # Use FP16 for faster inference on GPU
67
  )
68
 
69
  # Load and upscale an image
 
79
  from realesrgan import RealESRGANer
80
  from basicsr.archs.rrdbnet_arch import RRDBNet
81
  import torch
82
+ import numpy as np
83
 
84
  # Generate image with FLUX
85
+ pipe = FluxPipeline.from_pretrained(
86
+ "E:\\huggingface\\flux-dev-fp16",
87
+ torch_dtype=torch.float16
88
+ )
89
+ pipe.to("cuda")
90
+
91
+ image = pipe(
92
+ prompt="a beautiful landscape with mountains",
93
+ num_inference_steps=30
94
+ ).images[0]
95
 
96
  # Convert PIL to numpy/cv2 format
 
97
  img_array = np.array(image)
98
 
99
+ # Initialize upscaler
100
+ model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
101
  upsampler = RealESRGANer(
102
  scale=4,
103
  model_path="E:\\huggingface\\flux-upscale\\upscale_models\\4x-UltraSharp.pth",
104
+ model=model,
105
+ half=True
106
  )
107
+
108
+ # Upscale the generated image
109
  upscaled, _ = upsampler.enhance(img_array, outscale=4)
110
+
111
+ # Save result
112
+ import cv2
113
+ cv2.imwrite("flux_upscaled_4x.png", upscaled)
114
+ ```
115
+
116
+ ### Tiled Processing for Large Images
117
+
118
+ ```python
119
+ from basicsr.archs.rrdbnet_arch import RRDBNet
120
+ from realesrgan import RealESRGANer
121
+ import cv2
122
+
123
+ # Configure for large images with tiling
124
+ model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
125
+
126
+ upsampler = RealESRGANer(
127
+ scale=4,
128
+ model_path="E:\\huggingface\\flux-upscale\\upscale_models\\RealESRGAN_x4plus.pth",
129
+ model=model,
130
+ tile=512, # Process in 512x512 tiles
131
+ tile_pad=10, # Padding to avoid seams
132
+ pre_pad=0,
133
+ half=True
134
+ )
135
+
136
+ # Process large image
137
+ img = cv2.imread("large_image.png", cv2.IMREAD_COLOR)
138
+ output, _ = upsampler.enhance(img, outscale=4)
139
+ cv2.imwrite("large_upscaled.png", output)
140
  ```
141
 
142
  ## Model Comparison
143
 
144
+ | Model | Scale | Best For | File Size | Speed |
145
+ |-------|-------|----------|-----------|-------|
146
+ | 4x-UltraSharp | 4x | Sharp details, AI-generated images | 64MB | Moderate |
147
+ | RealESRGAN_x2plus | 2x | Moderate upscaling, faster processing | 64MB | Fast |
148
+ | RealESRGAN_x4plus | 4x | General purpose 4x upscaling | 64MB | Moderate |
149
+
150
+ **Model Selection Guide**:
151
+ - **4x-UltraSharp**: Best for AI-generated images needing maximum sharpness
152
+ - **RealESRGAN_x2plus**: Quick 2x upscaling with balanced quality
153
+ - **RealESRGAN_x4plus**: General-purpose 4x upscaling for various image types
154
+
155
+ ## Model Specifications
156
+
157
+ - **Architecture**: RRDB (Residual in Residual Dense Block)
158
+ - **Input Channels**: 3 (RGB)
159
+ - **Output Channels**: 3 (RGB)
160
+ - **Feature Dimensions**: 64
161
+ - **Network Blocks**: 23 (standard configuration)
162
+ - **Growth Channels**: 32
163
+ - **Format**: PyTorch `.pth` files
164
+ - **Precision**: FP32 (supports FP16 inference)
165
+
166
+ ## Performance Tips
167
+
168
+ - **GPU Acceleration**: Use `half=True` for FP16 inference on compatible GPUs (approximately 2x faster)
169
+ - **Tiling for VRAM**: Enable tiling with `tile=512` to reduce VRAM usage for large images
170
+ - **Tile Padding**: Use `tile_pad=10` to minimize visible seams between tiles
171
+ - **Batch Processing**: Process multiple images sequentially to amortize model loading time
172
+ - **CPU Fallback**: Models work on CPU but will be significantly slower (~10-20x)
173
+ - **Optimal Scale**: Use 2x for faster processing, 4x for maximum detail enhancement
174
+ - **Input Quality**: Better input images produce better upscaling results
175
+ - **File Formats**: Use lossless formats (PNG) for best quality preservation
176
 
177
  ## Use Cases
178
 
179
+ - Post-processing AI-generated images from FLUX.1, Stable Diffusion, etc.
180
+ - Enhancing FLUX.1-dev outputs for high-resolution prints
181
+ - Increasing resolution of generated artwork for commercial use
182
  - Adding fine details to synthetic images
183
+ - Print preparation for generated images (posters, canvas prints)
184
+ - Upscaling video frames for AI video generation pipelines
185
+ - Restoring and enhancing low-resolution generated content
186
+
187
+ ## Installation
188
+
189
+ ```bash
190
+ pip install realesrgan basicsr
191
+ ```
192
+
193
+ **Dependencies**:
194
+ - Python 3.8+
195
+ - PyTorch 1.7+
196
+ - basicsr
197
+ - realesrgan
198
+ - opencv-python
199
+ - numpy
200
 
201
  ## License
202
 
 
213
  }
214
  ```
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  ## Links and Resources
217
 
218
  - **Real-ESRGAN Paper**: [arXiv:2107.10833](https://arxiv.org/abs/2107.10833)
219
  - **Official Repository**: [xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN)
220
  - **BasicSR Library**: [xinntao/BasicSR](https://github.com/xinntao/BasicSR)
221
+ - **Hugging Face**: [Real-ESRGAN Models](https://huggingface.co/models?other=real-esrgan)
222
  - **Model Downloads**: Available through official Real-ESRGAN releases
223
 
224
  ## Model Card Contact