Closed Frank-Dz closed 4 years ago
It seems like to be the exact division problem caused by converting py2 to py3 from your bug report:
File "/home/frank/PycharmProjects/MultiGarmentNetwork/network/custom_layers.py", line 33, in call return tf.reshape(tf.matmul(x, self.components) + self.mean, (-1, K.int_shape(self.mean)[0] / 3, 3))
Value for attr 'Tshape' of float is not in the list of allowed values: int32, int64
So you should change some /
to //
to make sure exact division, which has different meaning between py3 and py2.
For example in file YOUR_PATH_TO_MGN/MultiGarmentNetwork/network/custom_layers.py
there are two places you need to change like followings:
class PCA_(Layer):
def __init__(self, components, mean, **kwargs):
super(PCA_, self).__init__(**kwargs)
self.components = tf.Variable(components, trainable = False)
self.mean = tf.Variable(mean, trainable = False)
######### here
self.output_dim = (K.int_shape(self.mean)[0] // 3, 3)
def build(self, input_shape):
super(PCA_, self).build(input_shape) # Be sure to call this at the end
def call(self, x):
######### here
return tf.reshape(tf.matmul(x, self.components) + self.mean, (-1, K.int_shape(self.mean)[0] // 3, 3))
def compute_output_shape(self, input_shape):
return (input_shape[0], self.output_dim[0], self.output_dim[1])
There are some others places you need to change /
to //
but I don't rermenber them all , may you should check it by yourself , good luck to you!
It seems like to be the exact division problem caused by converting py2 to py3 from your bug report:
File "/home/frank/PycharmProjects/MultiGarmentNetwork/network/custom_layers.py", line 33, in call return tf.reshape(tf.matmul(x, self.components) + self.mean, (-1, K.int_shape(self.mean)[0] / 3, 3))
Value for attr 'Tshape' of float is not in the list of allowed values: int32, int64
So you should change some
/
to//
to make sure exact division, which has different meaning between py3 and py2.For example in file
YOUR_PATH_TO_MGN/MultiGarmentNetwork/network/custom_layers.py
there are two places you need to change like followings:class PCA_(Layer): def __init__(self, components, mean, **kwargs): super(PCA_, self).__init__(**kwargs) self.components = tf.Variable(components, trainable = False) self.mean = tf.Variable(mean, trainable = False) ######### here self.output_dim = (K.int_shape(self.mean)[0] // 3, 3) def build(self, input_shape): super(PCA_, self).build(input_shape) # Be sure to call this at the end def call(self, x): ######### here return tf.reshape(tf.matmul(x, self.components) + self.mean, (-1, K.int_shape(self.mean)[0] // 3, 3)) def compute_output_shape(self, input_shape): return (input_shape[0], self.output_dim[0], self.output_dim[1])
There are some others places you need to change
/
to//
but I don't rermenber them all , may you should check it by yourself , good luck to you!
Thanks! I make it! Thanks for your kind help and guidande! Yet, after fixing this problem, I met another one: https://github.com/bharat-b7/MultiGarmentNetwork/issues/26 Actually, I also tested on Python2.7 before with DIRT for py2.7 successfully installed. I also got this error (At first I think it is caused by python's version, that's why I choose py3.5. But now it comes again...).
Anyway, thank you again for your help! Best, Frank
For future reference, had to change one extra line other than the 2 mentioned above, line 58 in file MGN/network/base_network.py
self.reshape = Reshape((len(pca.mean_)/3, 3))
to
self.reshape = Reshape((len(pca.mean_)//3, 3))
Hi~ I make a py3(python3.5) version of MGN on my Ubuntu16.04. (I will explain at the end.) And successfully installed Mesh as well as Dirt. All necessary data are loaded. But When I ran the code, I got this error:
To make a py3 version, what I have done is:
from
to
Also:
to
Above are all functions I modified.
(That's all. I also noticed someone using 2to3 to transfer, but I think the modifications described above are enough.)
Device: I only have one GPU, thus, all my device is gpu:0 The size is about 8GB.
Thanks in advance!
Plus, my pkgs are as follows: