GithubHelp home page GithubHelp logo

Comments (8)

mseitzer avatar mseitzer commented on July 17, 2024

Are you sure that there any images in the folders you are using? It recognizes only images with extensions .jpg and .png (small caps).

from pytorch-fid.

sagarkora avatar sagarkora commented on July 17, 2024

Ok. I missed that part. I changed the extension from .jpeg to .png and ran this again with the below error. As mentioned in Support grayscale images #41 - I did update the code to convert to RGB, but still, I ran into the below error:

0%| | 0/20 [00:00<?, ?it/s]

5%|▌ | 1/20 [00:00<00:06, 3.15it/s]

10%|█ | 2/20 [00:00<00:05, 3.32it/s]

15%|█▌ | 3/20 [00:00<00:04, 3.42it/s]

20%|██ | 4/20 [00:01<00:04, 3.51it/s]

25%|██▌ | 5/20 [00:01<00:04, 3.60it/s]

30%|███ | 6/20 [00:01<00:03, 3.62it/s]

35%|███▌ | 7/20 [00:01<00:03, 3.70it/s]

40%|████ | 8/20 [00:02<00:03, 3.72it/s]

45%|████▌ | 9/20 [00:02<00:02, 3.75it/s]

50%|█████ | 10/20 [00:02<00:02, 3.74it/s]

55%|█████▌ | 11/20 [00:02<00:02, 3.71it/s]

60%|██████ | 12/20 [00:03<00:02, 3.74it/s]

65%|██████▌ | 13/20 [00:03<00:01, 3.75it/s]

70%|███████ | 14/20 [00:03<00:01, 3.76it/s]

75%|███████▌ | 15/20 [00:04<00:01, 3.73it/s]

80%|████████ | 16/20 [00:04<00:01, 3.75it/s]

85%|████████▌ | 17/20 [00:04<00:00, 3.77it/s]

90%|█████████ | 18/20 [00:04<00:00, 3.79it/s]

95%|█████████▌| 19/20 [00:05<00:00, 3.79it/s]

100%|██████████| 20/20 [00:05<00:00, 3.73it/s]

0%| | 0/20 [00:01<?, ?it/s]

ValueError Traceback (most recent call last)
/usr/lib/python3.6/runpy.py in run_module(mod_name, init_globals, run_name, alter_sys)
203 run_name = mod_name
204 if alter_sys:
--> 205 return _run_module_code(code, init_globals, run_name, mod_spec)
206 else:
207 # Leave the sys module alone

7 frames
/content/drive/My Drive/pytorch-fid-master/pytorch_fid/fid_score.py in get_activations(files, model, batch_size, dims, cuda)
108
109 # Reshape to (n_images, 3, height, width)
--> 110 images = images.transpose((0, 3, 1, 2))
111 images /= 255
112

ValueError: axes don't match array
/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py:2590: UserWarning: Unknown failure executing module: <pytorch_fid>
warn('Unknown failure executing module: <%s>' % mod_name)

from pytorch-fid.

mseitzer avatar mseitzer commented on July 17, 2024

There still seems to be something wrong with your images, or how they are loaded to arrays. Namely it appears as if images does not have 4 dimensions at this point. Can you insert print(images.shape) before the transpose line and post the result?

from pytorch-fid.

sagarkora avatar sagarkora commented on July 17, 2024

print(images.shape)
(50,)

from pytorch-fid.

sagarkora avatar sagarkora commented on July 17, 2024

Ok, I guess the size of the image varies. After adding the resize(299,299)- (to match the input of Inception model) to the line where images load solves the problem. Is there a better solution? After changing the code, I calculated FID score using --dims 768 which resulted in the FID score of 1.3

from pytorch-fid.

mseitzer avatar mseitzer commented on July 17, 2024

It is intentional that images are not automatically resized to the same size because there are several ways you can get images of different size to the same size (e.g. cropping, rescaling) and it is up to the user to decide which way works best for the used dataset.

Regarding the score you get, keep in mind that normal FID score uses the full 2048 dimensions. So you can not compare scores with 768 dimensions to the normal FID score, and they might behave entirely different. They might not even reflect human judgment of image quality.

from pytorch-fid.

sagarkora avatar sagarkora commented on July 17, 2024

I understand and agree with your comment. But, do you think we can still calculate FID score using 2048 dimensions for the samples less than 2048 in either of the two comparable folders(images). I know we might not have the full rank and covariance matrix and some NAN's. But, I'm just wondering if it makes sense to even give it a try?

from pytorch-fid.

mseitzer avatar mseitzer commented on July 17, 2024

It depends on what you do with the results. Maybe you would be able to compute an approximation to FID using less than 2048 samples, but it's hard to predict how good the quality of this approximation is. You surely can not compare against FID scores computed on full 2048 samples.

from pytorch-fid.

Related Issues (20)

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.