This Python script demonstrates how to use the MMagic API to remove noise from images and enhance their quality using the DeNoise model. Simply provide an input image, and the script will generate a denoised output! 🧹🖼️
git clone https://github.com/adrienckr/swinIR-SR.git
Before you get started, make sure you have the following dependencies installed:
- Python 3.8 (or a compatible version) 🐍
- Miniconda ⚙️
Follow these simple steps to set up your environment for using the MMagic Stable Diffusion model:
-
Install Miniconda on your system if you haven't already.
-
Create a Conda environment and activate it using the following commands:
conda create --name mmagic python=3.8 -y conda activate mmagic
-
Check your CUDA version by running the command:
nvcc --version
-
Install PyTorch by referring to the official PyTorch documentation. Select the appropriate configuration based on your system and follow the installation instructions.
-
Install the
MMCV
library usingMIM
, a package manager for AI and machine learning dependencies. Run the following commands:pip install -U openmim mim install 'mmcv>=2.0.0'
-
Install
mmengine
from the GitHub repository:pip install git+https://github.com/open-mmlab/mmengine.git
-
Install the
mmagic
toolbox in editable mode using the following command:git clone https://github.com/open-mmlab/mmagic.git cd mmagic pip3 install -e . -v
The
-e .
flag is used to install the Python package in editable mode, meaning that any changes made to the source code will be reflected in the installed package. -
Additionally, install
accelerate
for faster and less memory-intensive model loading:pip install accelerate
-
Run the script:
python app.py
-
Get the required model configuration and checkpoint from Models-and-config.txt.
-
Enter the input and output image path.
Enter the input image path: input_image.png Enter the output image path: output_image.png
You will get an enhanced quality of your image by increasing the resolution of the image with MMagic's SwinIR Image Super-Resolution model! 📷✨
Make sure to provide the correct paths for your input and output images to enjoy upscaled images. 🧼🌈