GithubHelp home page GithubHelp logo

Comments (5)

abhiskk avatar abhiskk commented on August 12, 2024

This line converts the image to 0-1 range. I would suggest running the code or reading the documentation for such doubts. Opening an issue for these doubts is not appropriate.

from fast-neural-style.

ssundar6087 avatar ssundar6087 commented on August 12, 2024

@abhiskk I apologize if this came across as a trivial question to you. My question was specifically regarding the training script.

There you use the pytorch provided dataset.ImageFolder as follows :
transform = transforms.Compose([
transforms.Resize(args.image_size),
transforms.CenterCrop(args.image_size),
transforms.ToTensor(),
transforms.Lambda(lambda x: x.mul(255))
])
train_dataset = datasets.ImageFolder(args.dataset, transform)
train_loader = DataLoader(train_dataset, batch_size=args.batch_size)

From my limited understanding, the ImageFolder function doesn't normalize the input to floats in the range of 0-1. The other transforms such as resize, centercrop and ToTensor shouldn't change the data range either and hence my thought was that you don't need the x.mul(255) on the input. If I am mistaken, please correct me.

from fast-neural-style.

abhiskk avatar abhiskk commented on August 12, 2024

Yes, transforms.ToTensor() converts the image to 0-1 range hence the multiply was needed.

from fast-neural-style.

ssundar6087 avatar ssundar6087 commented on August 12, 2024

Thanks for clarifying. Apologies once again.

from fast-neural-style.

abhiskk avatar abhiskk commented on August 12, 2024

No worries, happy to help 👍

from fast-neural-style.

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.