The Consistency Critic: Correcting Inconsistencies in Generated Images via Reference-Guided Attentive Alignment
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.txtDue 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.
python app.pyDuring 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.
python infer.pyYou can download the base model FLUX.1-Kontext-dev directly from Hugging Face.
Alternatively, you can download it via the following command
(your_hf_token in the script with your actual Hugging Face access token):
python ./download_kontext.pyYou can download our ImageCritic directly from Hugging Face.
Alternatively, you can download it via following code:
python ./download_imageCritic.pyOr using Git:
git lfs install
git clone https://huggingface.co/ziheng1234/ImageCriticYou can download our training dataset Critic-10K directly from Hugging Face.
Alternatively, you can download it via Python:
python /raid/users/oyzh/ImageCritic/download_dataset.pyOr using Git:
git lfs install
git clone https://huggingface.co/datasets/ziheng1234/Critic-10KYou can try ImageCritic demo on HuggingFace.
If ImageCritic is helpful, please help to ⭐ the repo.
If you find this project useful for your research, please consider citing our paper.
If you have any comments or questions, please open a new issue or contact Ziheng Ouyang
Licensed under a Creative Commons Attribution-NonCommercial 4.0 International for Non-commercial use only. Any commercial use should get formal permission first.

