{"id":25999898,"url":"https://github.com/avinabsaha/ReIQA","last_synced_at":"2025-03-05T18:42:07.725Z","repository":{"id":185970381,"uuid":"556466947","full_name":"avinabsaha/ReIQA","owner":"avinabsaha","description":"Official implementation for CVPR2023 Paper \"Re-IQA : Unsupervised Learning for Image Quality Assessment in the Wild\"","archived":false,"fork":false,"pushed_at":"2024-04-26T19:09:20.000Z","size":17312,"stargazers_count":64,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-26T20:24:52.001Z","etag":null,"topics":["blind-image-quality-assessment","contrastive-learning","cvpr","cvpr2023","fr-iqa","full-reference-image-quality-assessment","image-processing","image-quality","moco-v2","no-reference-image-quality-assessment","nr-iqa","re-iqa","resnet-50","unsupervised-learning"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2304.00451","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avinabsaha.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-23T22:59:36.000Z","updated_at":"2024-04-26T20:25:00.151Z","dependencies_parsed_at":"2024-01-23T03:30:52.020Z","dependency_job_id":"ffa01568-0834-4bb2-b2b7-9baf865f00be","html_url":"https://github.com/avinabsaha/ReIQA","commit_stats":null,"previous_names":["avinabsaha/reiqa"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinabsaha%2FReIQA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinabsaha%2FReIQA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinabsaha%2FReIQA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinabsaha%2FReIQA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avinabsaha","download_url":"https://codeload.github.com/avinabsaha/ReIQA/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242083065,"owners_count":20069234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blind-image-quality-assessment","contrastive-learning","cvpr","cvpr2023","fr-iqa","full-reference-image-quality-assessment","image-processing","image-quality","moco-v2","no-reference-image-quality-assessment","nr-iqa","re-iqa","resnet-50","unsupervised-learning"],"created_at":"2025-03-05T18:40:49.420Z","updated_at":"2025-03-05T18:42:07.719Z","avatar_url":"https://github.com/avinabsaha.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Re-IQA: Unsupervised Learning for Image Quality Assessment in the Wild\n\nOfficial PyTorch implementation of Re-IQA, a No-Reference Image Quality Assessment algorithm proposed in [IEEE/CVF CVPR 2023](https://cvpr2023.thecvf.com/). Re-IQA achieves SoTA performance across popular NR-IQA databases : KonIQ, FLIVE, SPAQ, CLIVE, LIVE-IQA, CSIQ-IQA, TID-2013 and KADID.\n\nUseful Links : [Preprint](https://arxiv.org/abs/2304.00451) [OpenAccess](https://openaccess.thecvf.com/content/CVPR2023/papers/Saha_Re-IQA_Unsupervised_Learning_for_Image_Quality_Assessment_in_the_Wild_CVPR_2023_paper.pdf) [Supplementary](https://openaccess.thecvf.com/content/CVPR2023/supplemental/Saha_Re-IQA_Unsupervised_Learning_CVPR_2023_supplemental.pdf) [YouTube Video](https://www.youtube.com/watch?v=gHIAC-L3eFg) [Slides](https://drive.google.com/file/d/1ckDpkJaj7Hk0KBX3g_0Kfpw3CBvPnGFE/view?usp=sharing) [Poster](https://drive.google.com/file/d/1aIob7YE77hT_LEARGftYdw1nINOLzENo/view?usp=sharing)\n\n## Usage\n\nThe code has been tested on Linux systems with python 3.9, pytorch 1.13.1, torchvision 0.14.1 and CUDA 11.7. Other dependencies can be installed via [requirements.txt](requirements.txt). \n\n## Training Re-IQA \n\n### Quality Aware Module\n\n#### Download Training Data \n\nWe follow the data training pipeline provided in [CONTRIQUE](https://github.com/pavancm/CONTRIQUE).\nCreate a directory ```mkdir training_data``` to store images used for training RE-IQA-Quality-Aware Module.\n1. KADIS-700k : Download [KADIS-700k](http://database.mmsp-kn.de/kadid-10k-database.html) dataset. Store this data in the ```training_data/kadis700k``` directory. Note we do not use the synthetically distorted images as in CONTRIQUE.\n2. AVA : Download [AVA](https://github.com/mtobeiyf/ava_downloader) dataset and store in the ```training_data/UGC_images/AVA_Dataset``` directory.\n3. COCO : [COCO](https://cocodataset.org/#download) dataset contains 330k images spread across multiple competitions. We used 4 folders ```training_data/UGC_images/test2015, training_data/UGC_images/train2017, training_data/UGC_images/val2017, training_data/UGC_images/unlabeled2017``` for training.\n4. CERTH-Blur : [Blur](https://mklab.iti.gr/results/certh-image-blur-dataset/) dataset images are stored in the ```training_data/UGC_images/blur_image``` directory. We only use the images labelled as \"naturally-blurred\" from the training (220) and evaluation (411) sets. We have renumbered the images in the provided [csv file](csv_files/moco_train.csv).\n5. VOC : [VOC](http://host.robots.ox.ac.uk:8080/pascal/VOC/voc2012/) images are stored in the ```training_data/UGC_images/VOC2012``` directory.\n\n#### Training Command\n\nWe use DDP Training across 6 nodes. \n\n```\npython main_contrast.py --method MoCov2 --cosine --head mlp --multiprocessing-distributed --csv_path ./csv_files/moco_train.csv --model_path ./expt0  --optimizer LARS --tb_path ./expt0 -j 28 --batch_size 630 --learning_rate 12 --n_aug 11  --epochs 40 --n_scale 2 --n_distortions 1 --patch_size 160 --world-size 6 --warm --swap_crops 1 --dist-url tcp://[your first node address]:[specified port] --rank 0\n```\n\nOn the 5 other nodes, run the same command with --rank 1-5\n\nClarifications : \nIn the paper submitted to CVPR, we had reported training for 25 epochs. However, we observed more stabilized IQA results when trained for 40 epochs. Thus, we recommend training for 40 epochs. Also, the earlier implementation of the paper, a learning rate of 0.6 was used with batch size scaling. The learning rate scaling formula based on batch size used was ((batch_size * 2 scales) / 64 * 0.6 ≈ 12). However, in the current code, we have simplified it to directly take the scaled learning rate as an input rather than calculating it using the scaling formula.\n\n#### Obtaining Quality Aware Features\n\nDownload the quality-aware trained model from [Google Drive](https://drive.google.com/file/d/1DYMx8omn69yXUmBFL728JD3qMLNogFt8/view?usp=sharing) and store in a folder named ```re-iqa_ckpts```. Finally, to obtain Re-IQA Quality-Aware features, run\n\n```\npython demo_quality_aware_feats.py --head mlp\n```\n\n### Content Aware Module \n\nWe utilized the vanilla MoCo-v2 training code using ResNet-50 architecture and ImageNet database provided in the [PyContrast](https://github.com/HobbitLong/PyContrast) repository to train our Content Aware Module using the default settings. \n\n#### Obtaining Content Aware Features\n\nDownload the content-aware trained model from [Google Drive](https://drive.google.com/file/d/1TO-5fmZFT2_nt99j4IZen6vmXUb_UL3n/view?usp=sharing) and store in a folder named ```re-iqa_ckpts```. Finally, to obtain Re-IQA Content-Aware features, run\n\n```\npython demo_content_aware_feats.py --head mlp\n```\n\n### Training Linear Regressor\n\nWe used Sklearn's Linear Regression Models with Regularization for training the final IQA model. We recommend using either one of [Ridge](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html) or [Elastic Net](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.html) models and performing extensive hyper-parameter search for each database to extract maximum performance. \n\n## Citation\n\nIf you use this code for your research, please cite the following paper:\n\n[A. Saha, S. Mishra, and A. C. Bovik, “Re-IQA : Unsupervised Learning for Image Quality Assessment in the Wild,” *Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)*, 2023, https://doi.org/10.48550/arXiv.2304.00451.](https://arxiv.org/abs/2304.00451)\n\n```\n@InProceedings{Saha_2023_CVPR,\n    author    = {Saha, Avinab and Mishra, Sandeep and Bovik, Alan C.},\n    title     = {Re-IQA: Unsupervised Learning for Image Quality Assessment in the Wild},\n    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    month     = {June},\n    year      = {2023},\n    pages     = {5846-5855}\n}\n```\n\n## Acknowledgements \n\nOur Code is based on [PyContrast](https://github.com/HobbitLong/PyContrast). We thank the [Yonglong Tian](https://github.com/HobbitLong) for making the code available.\n\n## Contacts\n\n- Avinab Saha ( avinab.saha@utexas.edu ) -- Graduate student, LIVE, Dept. of ECE, UT Austin.\n- Sandeep Mishra ( sandy.mishra@utexas.edu ) -- Graduate student, LIVE, Dept. of ECE, UT Austin.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favinabsaha%2FReIQA","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favinabsaha%2FReIQA","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favinabsaha%2FReIQA/lists"}