GaParmar / clean-fid

PyTorch - FID calculation with proper image resizing and quantization steps [CVPR 2022]
https://www.cs.cmu.edu/~clean-fid/
MIT License
971 stars 74 forks source link

Extracting features of varying dimensionality from the Inception-V3 model #58

Open sivaramakrishnan-rajaraman opened 7 months ago

sivaramakrishnan-rajaraman commented 7 months ago

Thanks for this excellent repository. Comparing with https://github.com/mseitzer/pytorch-fid, I would like to extract features from different pooling layers like the first max pooling features (64), second max pooling features (192), pre-aux classifier features (768), and final average pooling features (2048) and compare FID scores. I believe the default option in your case is extracting the features from the final average pooling layer. Correct me if I am wrong.

from cleanfid import fid
fdir1 = '/content/gdrive/MyDrive/syn'
fdir2 = '/content/gdrive/MyDrive/orig'
score = fid.compute_fid(fdir1, fdir2)
print(score)

Is there an option to modify the function call to extract features from different layers and compare the scores? Thanks in advance.