The Consistency Critic: Correcting Inconsistencies in Generated Images via
Reference-Guided Attentive Alignment
🖼️ Visual Results
🔧 Dependencies and Installation
We recommend using Python 3.10 and PyTorch with CUDA support. To set up the environment:
# Create a new conda environment
conda create -n imagecritic python=3.10
conda activate imagecritic
# Install other dependencies
pip install -r requirements.txt
⚡ Quick Inference
Tips
Due to copyright issues, we have embedded the download of the kontext model weights in the inference code below, You can run following inference code directly.
If you have already downloaded the corresponding model, you can comment out the related code and directly replace the inference path.
Local Gradio Demo
python app.py
How to use
During testing, if the details that need to be fixed are located in a very low-resolution area, you should expand the bounding box to cover a larger region. Try to include both the target area to be fixed and some of the surrounding context, as illustrated in the example.
Since the method is based on local inpainting, it cannot replace objects when the difference is too large. If you need to replace an entire object, you must manually paint a black mask (using any drawing tool) over the part to be replaced, and then feed it into the model to perform the replacement.
Single case inference
python infer.py
Single Model Download
You can download the base model FLUX.1-Kontext-dev directly from Hugging Face.
Alternatively, you can download it via the following command (⚠️ Remember to replace your_hf_token in the script with your actual Hugging Face access token):
python ./download_kontext.py
You can download our ImageCritic directly from Hugging Face.
Alternatively, you can download it via following code:
ImageCritic
🖼️ Visual Results
🔧 Dependencies and Installation
We recommend using Python 3.10 and PyTorch with CUDA support. To set up the environment:
⚡ Quick Inference
Tips
Due to copyright issues, we have embedded the download of the kontext model weights in the inference code below, You can run following inference code directly. If you have already downloaded the corresponding model, you can comment out the related code and directly replace the inference path.
Local Gradio Demo
How to use
During testing, if the details that need to be fixed are located in a very low-resolution area, you should expand the bounding box to cover a larger region. Try to include both the target area to be fixed and some of the surrounding context, as illustrated in the example.
Since the method is based on local inpainting, it cannot replace objects when the difference is too large. If you need to replace an entire object, you must manually paint a black mask (using any drawing tool) over the part to be replaced, and then feed it into the model to perform the replacement.
Single case inference
Single Model Download
You can download the base model FLUX.1-Kontext-dev directly from Hugging Face.
Alternatively, you can download it via the following command
(⚠️ Remember to replace
your_hf_tokenin the script with your actual Hugging Face access token):You can download our ImageCritic directly from Hugging Face.
Alternatively, you can download it via following code:
Or using Git:
Dataset Download
You can download our training dataset Critic-10K directly from Hugging Face.
Alternatively, you can download it via Python:
Or using Git:
Online HuggingFace Demo
You can try ImageCritic demo on HuggingFace.
Citation
If ImageCritic is helpful, please help to ⭐ the repo.
If you find this project useful for your research, please consider citing our paper.
📧 Contact
If you have any comments or questions, please open a new issue or contact Ziheng Ouyang
License
Licensed under a Creative Commons Attribution-NonCommercial 4.0 International for Non-commercial use only. Any commercial use should get formal permission first.