Giter Club home page Giter Club logo

giqa's Introduction

GIQA: Generated Image Quality Assessment

This is the official pytorch implementation of ECCV2020 "GIQA: Generated Image Quality Assessment" (https://arxiv.org/abs/2003.08932). The major contributors of this repository include Shuyang Gu, Jianmin Bao, Dong Chen, Fang Wen at Microsoft Research Asia.

A related paper which adopts GMM-GIQA to improve the performance of GANs: PriorGAN(https://arxiv.org/abs/2006.16990).

Introduction

GIQA aims to solve the problem of quality evaluation of a single generated image. In this source, we release the code of our GMM-GIQA and KNN-GIQA which are convenient to use.

Citation

If you find our code helpful for your research, please consider citing:

@article{gu2020giqa,
  title={GIQA: Generated Image Quality Assessment},
  author={Gu, Shuyang and Bao, Jianmin and Chen, Dong and Wen, Fang},
  journal={arXiv preprint arXiv:2003.08932},
  year={2020}
} 

Getting Started

Prerequisite

  • Linux.
  • Pytorch 1.0.0.
  • CUDA9.2 or 10.
  • sklearn 0.22.2

Running code

  • Download pretrained models here. We provide the LSUN-cat GMM model with PCA95 in this link, if you need more models, please contact me.

  • Extract features:

    python write_act.py path/to/read/dataset --act_path path/to/write/activation --pca_rate pca_rate --pca_path path/to/write/pca --gpu gpu_id
    
  • Get KNN-GIQA score:

    python knn_score.py path/to/test-folder --act_path path/to/read/activation --pca_path path/to/read/pca --K number/of/nearest-neighbor --output_file output/file/path --gpu gpu_id
    
  • Get GMM-GIQA score:

    first build the GMM model:

    python get_gmm.py --act_path path/to/read/activation --kernel_number number-of-Gaussian-components --gmm_path path/to/write/gmm
    

    then get the GMM-GIQA score:

    python gmm_score.py path/to/test-folder --gmm_path path/to/read/gmm --pca_path path/to/read/pca --output_file output/file/path --gpu gpu_id
    
  • For all these running bash, if we do not use PCA (such as FFHQ), just remove the pca_rate and pca_path options.

LGIQA dataset

  • The LGIQA dataset contains three sub-dataset, named LGIQA-FFHQ, LGIQA-cat, LGIQA-cityscapes. You can download the cat and cityscapes sub-dataset here. For security reason, if you need LGIQA-FFHQ dataset, please contact me.

test

  • To test if you run our code correctly, we provide results of our provided GMM-GIQA model (on LSUN-cat dataset). We put it in the test folder. For test_images, by using the "get GMM-GIQA score command" and our provided model, you can get the results like results.txt. As we pointed out in our paper, the value of the score is meaningless, but you can use the rank of score to compare which has a higher quality. For different GMM models (especially different kernels), the score has a very large range (probably from -10^7 to 10^5), it's normal since we do not directly need the value. And also, for user's dataset, it should notice that the dataset Could Not contain too few images, otherwise, the GIQA score may be inaccurate.

Reference

pytorch-fid

giqa's People

Contributors

cientgu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

giqa's Issues

ValueError: Expected the input data X have 774 features, but got 38 features

Dear authors,
I am interested in your work and I want to test it, but i meet this error:

ValueError: Expected the input data X have 774 features, but got 38 features

I run the "get the GMM-GIQA score" command only, like this

python gmm_score.py test/test_images --gmm_path checkpoints/gmm-cat-pca95-full7.pkl --pca_path checkpoints/pca95-cat.pkl --output_file test/output/output.txt --gpu 0

and I thought it maybe was the problem of PCA model that you provided, which reducing the 2048-dimensions to 38 dimensions.

:) looking forward to your reply. thx

Getting large negative GMM-GIQA scores

Dear Sir,

I'm trying to run GMM-GIQA on custom datasets.
My dataset contains 3000 real-images, and 9000 generated images of human face.
I generate the GMM model without pca and set the kernel number (M) to 5.
After testing on all of the generated images, I found that the numbers are all large negative numbers.
https://drive.google.com/file/d/1ydOK6u6yYvd4-2C01qNlH8ZD8a5VavZM/view?usp=sharing

Do you know how this happened?
Thanks for the amazing work and looking forward to your reply.

Details

I have some doubts about the selection of parameters when running the code, if so, can you please tell me the specific role of the parameters, or please give a specific example when running the code.
“path/to/activation” this type of statement to explain its role or the need to establish a path called path/to/activation in the program.
When I run: python write_act.py path/to/dataset --act_path path/to/activation --pca_rate pca_rate --pca_path path/to/pca --gpu gpu_id " line of code, I downloaded fid relevant data by default. Is it the default download or is my running wrong?
I would like to test the quality of other GAN models generated images with your pre-trained model, so when running the Extract features, do path/to/dataset need to point to the dataset you gave or my own? How do you operate if you need to point to the data set you gave?
Thank you very much for your help, as a new person, I hope I will not bother you with your questions, thank you very much.
[我在运行代码时对于参数的选择存在一些疑惑,如果可以,能不能请您详细告知参数的具体作用,或者请您给出一个运行代码时的具体的例子。
path/to/activation这种类型的语句是解释其作用还是说需要在程序中建立名为path/to/activation的路径。
我在运行python write_act.py path/to/dataset --act_path path/to/activation --pca_rate pca_rate --pca_path path/to/pca --gpu gpu_id这行代码时默认下载了fid相关数据,请问是默认下载还是我的运行有错?
我想用您预训练好的模型测试其他GAN模型生成图像的质量,那么在运行Extract features时,path/to/dataset是需要指向您给出的数据集还是我自己的数据集?若需要指向您给出的数据集的话应该如何操作?]

Performing GMM is time-consuming

Hi, it seems that performing GMM on all 70000 images of FFHQ is quite time-consuming. Could you tell me how long did you get the resulting GMM model on FFHQ ?

Some help for custom dataset

Good evening authors (in Asia :)) !
I am interested in your beautiful work and I want to try it on a custom data (input and generated synthetic image).
However, I am kind of a newbie and could not understand thoroughly how extract features work.

So for example, if I have a input image and synthetic image (generated using cycleGAN),
should I do extract features first?

Can you describe more of the steps?

Thank you in advanced :).

Two questions about write_act.py

“”“python write_act.py path/to/dataset --act_path path/to/activation --pca_rate pca_rate --pca_path path/to/pca --gpu gpu_id”“”
1)The first parameter is "path/to/dataset". Do I need to use training dataset to get activation, or just apply a test dataset can get it.
2)The second parameter is "act_path". The write_act.py is used to generate the activation, and why you apply activation when generates it ? Or this path means a directory to save the activation generated by write_act.py.

Request Help: 1) Environment 2) Examples

Dear friend,
We are interested in your work, but found it is hard to running source code. The key problems are:
1) What's your work environment: python version, sklearn version, pytorch version ?
2) Could you please give us command examples with your pkl files ?
Thanks a lot and happy new year !
Best Regards,

the GMM_score is not between [0, 1]

hello! i use your gmm code and get the score of the imgs is pretty marvious. Does there any steps i got wrong?
......
score of 114.jpg is:
12225.555544777117
score of 453.jpg is:
12162.200271020361
score of 343.jpg is:
12085.507695046039
score of 306.jpg is:
12251.0952301596
score of 438.jpg is:
12138.23795022325
score of 246.jpg is:
12085.50769569048
score of 339.jpg is:
12225.455868995597
score of 315.jpg is:
12218.148844663554
score of 261.jpg is:
12225.455868975976
score of 82.jpg is:
12085.507697492993
score of 342.jpg is:
12225.555544856654
score of 334.png is:
12218.14884460266
score of 263.png is:
12217.426774743915
score of 63.png is:
12085.507696855651
score of 382.png is:
-46069728.00091776
score of 222.png is:
12250.923218525548
score of 221.png is:
12251.13040117361
score of 270.png is:
12186.212538611771
score of 414.png is:
-25461121.514812943
score of 434.png is:
-61937752.13751065
score of 47.png is:
-82769187.2630152
score of 354.png is:
-87741719.93647467
score of 276.png is:
12217.522549181807
score of 422.png is:
-39031307.403086096
score of 4.png is:
-34059555.85986152
score of 367.png is:
-67440733.50017826
score of 387.png is:
12162.200272076472
score of 362.png is:
-45590348.13169143
score of 1.png is:
12087.937832531064
......
the step is :first use write_act.py to get act.pkl. and then 'get_gmm.py' and 'gmm_score.py'. finally i get these results with 'results.txt'

Request for FFHQ dataset

Dear authors,
I am interested in your work and I want to request for FFHQ dataset. Thank you!

some question

I have some doubts about the selection of parameters when running the code, if so, can you please tell me the specific role of the parameters, or please give a specific example when running the code.
“path/to/activation” this type of statement to explain its role or the need to establish a path called path/to/activation in the program.
When I run: python write_act.py path/to/dataset --act_path path/to/activation --pca_rate pca_rate --pca_path path/to/pca --gpu gpu_id " line of code, I downloaded fid relevant data by default. Is it the default download or is my running wrong?
I would like to test the quality of other GAN models generated images with your pre-trained model, so when running the Extract features, do path/to/dataset need to point to the dataset you gave or my own? How do you operate if you need to point to the data set you gave?
Thank you very much for your help, as a new person, I hope I will not bother you with your questions, thank you very much.
[我在运行代码时对于参数的选择存在一些疑惑,如果可以,能不能请您详细告知参数的具体作用,或者请您给出一个运行代码时的具体的例子。
path/to/activation这种类型的语句是解释其作用还是说需要在程序中建立名为path/to/activation的路径。
我在运行python write_act.py path/to/dataset --act_path path/to/activation --pca_rate pca_rate --pca_path path/to/pca --gpu gpu_id这行代码时默认下载了fid相关数据,请问是默认下载还是我的运行有错?
我想用您预训练好的模型测试其他GAN模型生成图像的质量,那么在运行Extract features时,path/to/dataset是需要指向您给出的数据集还是我自己的数据集?若需要指向您给出的数据集的话应该如何操作?]

Reproducibility

Hi, I have tried to reproduce the results on FFHQ, where I only achieved an accuracy of about 68% using GMM-GIQA. I have tried your pretrained GMM model and I can get the result reported in your paper, this verifies that there is no problem in the feature extraction part. Then I switched to use KNN-GIQA, and I get a poor result of roughly 58%, this may manifests that the there is difference of training data. I directly use the 70000 cropped and aligned 1024X1024 images of FFHQ, is there any inconsistency with your practice?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.