astramlco / diffbir

DiffBIR: Towards Blind Image Restoration with Generative Diffusion Prior

  • Public
  • 515 runs
  • L40S
  • GitHub
  • License
Iterate in playground

Input

input
*file

Path to the input image you want to enhance.

string

Choose the type of model best suited for the primary content of the image: 'faces' for portraits and 'general_scenes' for everything else.

Default: "general_scenes"

string

Select the restoration model that aligns with the content of your image. This model is responsible for image restoration which removes degradations.

Default: "general_scenes"

boolean

Reload the image restoration model (SwinIR) if set to True. This can be useful if you've updated or changed the underlying SwinIR model.

Default: false

integer
(minimum: 1, maximum: 100)

The number of enhancement iterations to perform. More steps might result in a clearer image but can also introduce artifacts.

Default: 50

integer
(minimum: 1, maximum: 4)

Factor by which the input image resolution should be increased. For instance, a factor of 4 will make the resolution 4 times greater in both height and width.

Default: 4

integer
(minimum: 1, maximum: 10)

Number of times the enhancement process is repeated by feeding the output back as input. This can refine the result but might also introduce over-enhancement issues.

Default: 1

boolean

Disables the initial preprocessing step using SwinIR. Turn this off if your input image is already of high quality and doesn't require restoration.

Default: false

boolean

Whether to use patch-based sampling. This can be useful for very large images to enhance them in smaller chunks rather than all at once.

Default: false

integer

Size of each tile (or patch) when 'tiled' option is enabled. Determines how the image is divided during patch-based enhancement.

Default: 512

integer

Distance between the start of each tile when the image is divided for patch-based enhancement. A smaller stride means more overlap between tiles.

Default: 256

boolean

Use latent image guidance for enhancement. This can help in achieving more accurate and contextually relevant enhancements.

Default: false

number

For 'general_scenes': Scale factor for the guidance mechanism. Adjusts the influence of guidance on the enhancement process.

Default: 0

integer

For 'general_scenes': Specifies when (at which step) the guidance mechanism starts influencing the enhancement.

Default: 1001

integer

For 'general_scenes': Specifies when (at which step) the guidance mechanism stops influencing the enhancement.

Default: -1

string

For 'general_scenes': Determines in which space (RGB or latent) the guidance operates. 'latent' can often provide more subtle and context-aware enhancements.

Default: "latent"

integer

For 'general_scenes': Number of times the guidance process is repeated during enhancement.

Default: 5

string

Method used for color correction post enhancement. 'wavelet' and 'adain' offer different styles of color correction, while 'none' skips this step.

Default: "wavelet"

integer

Random seed to ensure reproducibility. Setting this ensures that multiple runs with the same input produce the same output.

Default: 231

boolean

For 'faces' mode: Indicates if the input images are already cropped and aligned to faces. If not, the model will attempt to do this.

Default: false

boolean

For 'faces' mode: If multiple faces are detected, only enhance the center-most face in the image.

Default: false

string

For 'faces' mode: Model used for detecting faces in the image. Choose based on accuracy and speed preferences.

Default: "retinaface_resnet50"

string

For 'faces' mode: Model used to upscale the background in images where the primary subject is a face.

Default: "RealESRGAN"

integer

For 'faces' mode: Size of each tile used by the background upsampler when dividing the image into patches.

Default: 400

integer

For 'faces' mode: Distance between the start of each tile when the background is divided for upscaling. A smaller stride means more overlap between tiles.

Default: 400

Output

outputoutputoutput
Generated in

Run time and cost

This model costs approximately $0.22 to run on Replicate, or 4 runs per $1, but this varies depending on your inputs. It is also open source and you can run it on your own computer with Docker.

This model runs on Nvidia L40S GPU hardware. Predictions typically complete within 4 minutes. The predict time for this model varies significantly based on the inputs.

Readme

This model doesn't have a readme.