Coder Social home page Coder Social logo

Comments (6)

chongyangma avatar chongyangma commented on May 18, 2024 2

@M4gicT0 After change the code, have you rerun python setup.py install?

from pixel2mesh.

chongyangma avatar chongyangma commented on May 18, 2024 1

I ran into the same error. It looks like changing the following two lines in layers.py:

x2 = tf.ceil(x)

and

y2 = tf.ceil(y)

into

x2 = tf.minimum(tf.ceil(x), tf.cast(tf.shape(img_feat)[0], tf.float32) - 1)

and

y2 = tf.minimum(tf.ceil(y), tf.cast(tf.shape(img_feat)[1], tf.float32) - 1)

will bypass the error. Not sure if this is the correct solution.

from pixel2mesh.

DubiousCactus avatar DubiousCactus commented on May 18, 2024 1

@chongyangma Didn't do that, it works now. Thanks !

from pixel2mesh.

DubiousCactus avatar DubiousCactus commented on May 18, 2024

Unfortunately it didn't fix anything for me...

from pixel2mesh.

DubiousCactus avatar DubiousCactus commented on May 18, 2024

@nywang16 Is that a proper fix ? It should work out of the box.

from pixel2mesh.

hinnBU avatar hinnBU commented on May 18, 2024

Ran into this problem currently. We found that the problem is about the miscalculated indices.
Layer dimensions (see api.py or model.py):

56x56 --> indices[0...55]
28x28 --> indices[0..27]
14x14 --> indices[0..13]
7x7 --> indices[0..6]

Lines 248-253 of layers.py:

		h = tf.minimum(tf.maximum(h, 0), 223)
		w = tf.minimum(tf.maximum(w, 0), 223)

		x = h/(224.0/56)
		y = w/(224.0/56)
		out1 = project(self.img_feat[0], x, y, 64)

Calculation:

  • h and w can be values from 0 to 223
  • 223 / (224 / 56) = 55.75
  • tf.ceil(55.75) = 56

So we try to index our range of 0..55 mentioned earlier with 56 and this is the reason for the error.

Fix:

  • 223 / (223 / 55) = 55
  • tf.ceil(55.0) = 55

This has to be done for every x,y calculation before project() call.

Funny thing is this error only occurs if TF is running on CPU.
While running on GPU the call returns 0:

https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/gather_nd

Retraining is needed after the fix.

from pixel2mesh.

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.