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

Required image format for getting FID and KID. #17

Open
jonatelintelo opened this issue Oct 25, 2023 · 5 comments
Open

Required image format for getting FID and KID. #17

jonatelintelo opened this issue Oct 25, 2023 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@jonatelintelo
Copy link

Hi,

I am trying to apply the standardized FID and KID scoring to my own dataset and generators. For this I have a question.

The evaluate_metrics(args) handles the real image and the generated image subdirectories and calculates the desired scores between all real and generated images in these subdirs. But in what format are these passed? (.jpg or something different?)

@jonatelintelo jonatelintelo changed the title Getting FID and KID for custom dataset. Required image format for getting FID and KID. Oct 25, 2023
@usert5432
Copy link
Collaborator

Hi @jonatelintelo,

Are you referring to this function?

def evaluate_metrics(path1, path2, kid_size):
return torch_fidelity.calculate_metrics(
input1 = path1,
input2 = path2,
cuda = True,
isc = False,
fid = True,
kid = True,
verbose = False,
kid_subset_size = kid_size,
)

If so, then this a wrapper around torch_fidelity package and it should support all of the image formats that torch_fidelity supports. When we evaluated the FID scores, we used png format though.

@usert5432 usert5432 self-assigned this Oct 26, 2023
@usert5432 usert5432 added the question Further information is requested label Oct 26, 2023
@jonatelintelo
Copy link
Author

jonatelintelo commented Oct 26, 2023

Hi @jonatelintelo,

Are you referring to this function?

def evaluate_metrics(path1, path2, kid_size):
return torch_fidelity.calculate_metrics(
input1 = path1,
input2 = path2,
cuda = True,
isc = False,
fid = True,
kid = True,
verbose = False,
kid_subset_size = kid_size,
)

If so, then this a wrapper around torch_fidelity package and it should support all of the image formats that torch_fidelity supports. When we evaluated the FID scores, we used png format though.

Thank you for the quick answer. I indeed meant that function.

In this wrapper function from your code, is the input to calculate_metrics a singular image or a directory with images? If it is the latter, does that mean you called calculate_metrics for every attribute you compared such as anime to selfie and selfie to anime etc.

How many samples were there at minimum in each directory during your metric calculations?

@usert5432
Copy link
Collaborator

In this wrapper function from your code, is the input to calculate_metrics a singular image or a directory with images? If it is the latter, does that mean you called calculate_metrics for every attribute you compared such as anime to selfie and selfie to anime etc.

FID scores are evaluated between directories of images. In the case of the Anime <-> Selfie translation we evaluate scores between the following directories:

  1. Real Anime Images vs Anime images obtained from selfies
  2. Real Selfie Images vs Selfie images obtained from anime images

How many samples were there at minimum in each directory during your metric calculations?

We used the entire test datasets for the evaluation. The smallest test dataset belongs to Anime2Selfie and it has just 100 anime and 100 selfie images.

@jonatelintelo
Copy link
Author

jonatelintelo commented Oct 27, 2023

Thank you for the answers, I can work further with this now.

We used the entire test datasets for the evaluation. The smallest test dataset belongs to Anime2Selfie and it has just 100 anime and 100 selfie images.

I also took a look at another FID implementation from pytorch-fid. For this implemenation the author recommends to use at least 2048 images due to the last pooling layer dimension in the inception network. Changing this might result in scores no longer correlating with visual quality. Do you know if the torch-fidelity has this same constraint and did you take this into account for the paper?

@usert5432
Copy link
Collaborator

Hi @jonatelintelo,

Do you know if the torch-fidelity has this same constraint and did you take this into account for the paper?

No, unfortunately, I am not aware whether torch-fidelity makes such recommendations or not. And, we did not take torch-fid recommendation into account.

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

No branches or pull requests

2 participants