Git Product home page Git Product logo

Comments (5)

xiaoyang666 avatar xiaoyang666 commented on August 12, 2024

ValueError:Image of type float must be between -1 and 1
Screenshot from 2020-06-21 18-47-21

from sc-sfmlearner-release.

JiawangBian avatar JiawangBian commented on August 12, 2024

It says that the the "imresize" function requires that the image of type float must be between -1 and 1. Here, the image is first loaded in "sequence_floder.py" as float type by
"
def load_as_float(path):
return imread(path).astype(np.float32)
"

Can you try to change it to
"
def load_as_float(path):
return imread(path)
"
and have a try?

from sc-sfmlearner-release.

JiawangBian avatar JiawangBian commented on August 12, 2024

Or you can try to change the line76 in custom_transforms.py

scaled_images = [imresize(im, (scaled_h, scaled_w)) for im in images]

to

scaled_images = [np.array(Image.fromarray(im.astype(np.uint8)).resize((scaled_w, scaled_h))).astype(np.float32) for im in images]

Also, do not forget add "from PIL import Image" before using Image.fromarray()

from sc-sfmlearner-release.

xiaoyang666 avatar xiaoyang666 commented on August 12, 2024

Hi,
I'm very happy to have received your response.This change worked.
scaled_images = [np.array(Image.fromarray(im.astype(np.uint8)).resize((scaled_w,
scaled_h))).astype(np.float32) for im in images]
In the subsequent training, a problem occurred in inversed_warp.py (typeerror:grid_sample got an
unexpected keyword argument 'align_corners'). Normal training after deletion this.
Thank you.

from sc-sfmlearner-release.

JiawangBian avatar JiawangBian commented on August 12, 2024

It is due to pytorch version.
"align_corners" is a new keyword in pytorch after 1.4 (or 1.3 that I forgot).
You can update pytorch to the latest version, or you can just delete 'align_corners' in grid_sample function.

from sc-sfmlearner-release.

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.