Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Help: 1) Environment 2) Examples #5

Open
delldu opened this issue Feb 11, 2021 · 13 comments
Open

Request Help: 1) Environment 2) Examples #5

delldu opened this issue Feb 11, 2021 · 13 comments

Comments

@delldu
Copy link

delldu commented Feb 11, 2021

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,

@cientgu
Copy link
Owner

cientgu commented Feb 13, 2021

I am glad you are interested in our work.

  1. we use python 3.6, PyTorch 1.4 and sklearn 0.22.2 for our code.
  2. we have provided the command examples to achieve the pkl files, the extracted activation file is too large so we do not provide it. It can easily get with the first "extract feature" command line.
    If there are still any trouble to try our code, feel free to tell me.

@ke-s
Copy link

ke-s commented Mar 1, 2021

Thank you for your answer.
I have a little question want to ask you. During the execution of Extract features orders, what is stored in the path/to/dataset is your cat.rar and city.rar or our own test data set,or empty folders, I have set up a path for path/to/dataset. I have set up a path for the path/to/dataset.
I currently run directly to the python you give write_act. Py path/to/dataset - act_path path/to/activation - 0.95 - pca_path pca_rate path/to/pca - gpu gpu_id, path is one of my new folder, inside of a dataset, activation, pca is a new empty folder
Are the activation files generated automatically during Extract features command run, I have downloaded the GMM - cat - pca95 - full7. PKL and pca95 - the PKL, should how to apply?
Thank you very much!

@cientgu
Copy link
Owner

cientgu commented Mar 1, 2021

  1. The path/to/dataset should point to the folder contains raw images like jpg or png, similar to pytorch-fid code (https://github.com/mseitzer/pytorch-fid) in the reference.
  2. Yes, the activation files generated automatically from the Extract features command line. After you download the GMM file, just use "python gmm_score.py path/to/test-folder --gmm_path path/to/gmm --pca_path path/to/pca --output_file output/file/path --gpu gpu_id" to get the GMM-GIQA score. If you only have the activation file or you just want to get the KNN-GIQA score, just use "python knn_score.py path/to/test-folder --act_path path/to/activation --pca_path path/to/pca --K number/of/nearest-neighbor --output_file output/file/path --gpu gpu_id". But usually it will cost more time especially the dataset is large.

@ke-s
Copy link

ke-s commented Mar 1, 2021

Thank you
I tried to run the Extract features"
where i put your city.rar, in the path/to/dataset, but in the runtime prompt "“IsADirectoryError: [Errno 21] Is a directory: 'path/to/pca'”what kind of file should i put in the'path/to/pca'"
Previously, I incorporated your cat.rar and city.rar into the path/to/dataset,it shows “ValueError: could not broadcast input array from shape (256,256,3) into shape (256)”,Why is that,Which data set should I put in at run time.
So if I want to get the relevant scores for the coco data set dcgan generated,Should I put coco test data set or what data set in my path/to/dataset?
Thank you very much for your reply.

@cientgu
Copy link
Owner

cientgu commented Mar 1, 2021

Thank you
I tried to run the Extract features"
where i put your city.rar, in the path/to/dataset, but in the runtime prompt "“IsADirectoryError: [Errno 21] Is a directory: 'path/to/pca'”what kind of file should i put in the'path/to/pca'"
Previously, I incorporated your cat.rar and city.rar into the path/to/dataset,it shows “ValueError: could not broadcast input array from shape (256,256,3) into shape (256)”,Why is that,Which data set should I put in at run time.
So if I want to get the relevant scores for the coco data set dcgan generated,Should I put coco test data set or what data set in my path/to/dataset?
Thank you very much for your reply.

  1. You should extract the rar file to jpg and png images
  2. for extract features command line, the path/to/pca is one of the output, so you should give a path and name to the pca file, such as pca.pkl
  3. if you want to get the scores of DCGAN generated images on coco dataset, in extract features command line, path/to/dataset should be coco dataset, in get score command line, path/to/dataset should be the folder of DCGAN generated images.

@ke-s
Copy link

ke-s commented Mar 2, 2021

Thank you for your help, but one problem I encountered during debugging “Extract features”is
“ File "GIQA-master/write_act.py", line 67, in get_activations
    images = images.transpose((0, 3, 1, 2))
ValueError: axes don't match array”
now my dataset is vg,I'm trying to turn the grayscale image into a three way,Still showing the same problem。What is the reason?How should I solve it? Thank you for your help

@cientgu
Copy link
Owner

cientgu commented Mar 3, 2021

Thank you for your help, but one problem I encountered during debugging “Extract features”is
“ File "GIQA-master/write_act.py", line 67, in get_activations
    images = images.transpose((0, 3, 1, 2))
ValueError: axes don't match array”
now my dataset is vg,I'm trying to turn the grayscale image into a three way,Still showing the same problem。What is the reason?How should I solve it? Thank you for your help

I think it may be caused by the wrong image file. You may check and debug it yourself.

@ke-s
Copy link

ke-s commented Mar 3, 2021

Thank you for your reply!
So, I would like to ask, are all the photos in your dataset color images?Are there any restrictions on image data sets?

@cientgu
Copy link
Owner

cientgu commented Mar 3, 2021

Thank you for your reply!
So, I would like to ask, are all the photos in your dataset color images?Are there any restrictions on image data sets?

Only color images are ok. It's better to use enough data with enough resolution.

@ke-s
Copy link

ke-s commented Mar 7, 2021

Thank you.
I have removed all grayscale images,But when running : python write_act.py img/image --act_path activation/vg.pkl --pca_rate 0.95 --pca_path pca/pca95-cat.pkl --gpu 1 ,still showing error:
File "write_act.py", line 70, in get_activations
    images = images.transpose((0, 3, 1, 2))
ValueError: axes don't match array
What's the reason?
I tried the online approach, all of which was to change the image to RGB,but there's still no solution.
Thank you very much for your reply。

@ke-s
Copy link

ke-s commented Mar 7, 2021

This is the shape of some of the pictures I listed, all three channels.my environment is my environment。
(375, 500, 3)
(427, 640, 3)
(640, 425, 3)
(640, 427, 3)
(427, 640, 3)
(640, 424, 3)
(375, 500, 3)
(423, 640, 3)
(480, 640, 3)
(480, 640, 3)
(640, 426, 3)
(640, 419, 3)
(640, 640, 3)

@cientgu
Copy link
Owner

cientgu commented Mar 8, 2021

If your images are not in the same size, you need to resize them to the same size, then the error will be fixed.

@cientgu
Copy link
Owner

cientgu commented Mar 8, 2021

If your images are not in the same size, you need to resize them to the same size, then the error will be fixed.

And also, for building GMM model or just using KNN-GIQA, the number of images to get activation should not be too small, I am not sure what dataset you are trying to apply, but I think it should at least have 5000 images to get a good result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants