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

Resize Images at Read in (imread) #32

Open
mh-nyris opened this issue May 10, 2020 · 5 comments
Open

Resize Images at Read in (imread) #32

mh-nyris opened this issue May 10, 2020 · 5 comments

Comments

@mh-nyris
Copy link

mh-nyris commented May 10, 2020

Hey there,
I ran into problems as my images are of variable size (couldn't convert the list read-in to np.array).
Does it make sense to consider resizing images in imread?
Image.open(filename).resize((299, 299))
Best,
Mike

@septasset
Copy link

I've also encounted this issue, my solution is to transform before dataloader:

    dataset = ImagePathDataset(files,
        transforms=TF.Compose([
            TF.Resize((299,299)),
            TF.ToTensor(),
    ]))

@KomputerMaster64
Copy link

Thank you for the solution.
Here is the reference architecture of the InceptionV3 model

@Newbeeer
Copy link

I observe that such resize operation would change the FID score significantly.

@kmittle
Copy link

kmittle commented Jun 23, 2024

I've also encounted this issue, my solution is to transform before dataloader:

    dataset = ImagePathDataset(files,
        transforms=TF.Compose([
            TF.Resize((299,299)),
            TF.ToTensor(),
    ]))

The InceptionV3 model in PyTorch is trained on ImageNet. According to the official documentation, it uses the mean and standard deviation of ImageNet for normalization. However, if you directly use ToTensor(), it will only normalize the values to the range 0-1.

@kmittle
Copy link

kmittle commented Jun 23, 2024

I've also encounted this issue, my solution is to transform before dataloader:

    dataset = ImagePathDataset(files,
        transforms=TF.Compose([
            TF.Resize((299,299)),
            TF.ToTensor(),
    ]))

The InceptionV3 model in PyTorch is trained on ImageNet. According to the official documentation, it uses the mean and standard deviation of ImageNet for normalization. However, if you directly use ToTensor(), it will only normalize the values to the range 0-1.

https://pytorch.org/vision/stable/models/generated/torchvision.models.inception_v3.html
image

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

5 participants