Tensorflowを使用して3Dで回転行列のパラメータを学習したいと考えています。したがって、私は今、二つの問題テンソルフローの3D回転行列
- 私はエラーメッセージが表示されます持って回転行列を次のよう
g = tf.Graph() with g.as_default(): #rotations thetax = tf.Variable(tf.zeros([1])) thetax = tf.Variable(tf.zeros([1])) thetay = tf.Variable(tf.zeros([1])) p = tf.placeholder(tf.float32, [3]) rotation_matrix_x = tf.pack([tf.constant(1.0),tf.constant(0.0),tf.constant(0.0), tf.constant(0.0),tf.cos(thetax), -tf.sin(thetax), tf.constant(0.0),tf.sin(thetax), tf.cos(thetax)]) rotation_matrix_y = tf.pack([ tf.cos(thetax),tf.constant(0.0), -tf.sin(thetax), tf.constant(1.0),tf.constant(0.0),tf.constant(0.0), tf.sin(thetax),0, tf.cos(thetax)]) rotation_matrix_z = tf.pack([ tf.cos(thetax), -tf.sin(thetax),tf.constant(0.0), tf.sin(thetax), tf.cos(thetax),tf.constant(0.0), tf.constant(1.0),tf.constant(0.0),tf.constant(0.0)]) rotation_matrix_x = tf.reshape(rotation_matrix_x, (3,3)) rotation_matrix_y = tf.reshape(rotation_matrix_y, (3,3)) rotation_matrix_z = tf.reshape(rotation_matrix_z, (3,3)) rotated = tf.mult(tf.mult(rotation_matrix_x,tf.mult(rotation_matrix_y,rotation_matrix_z) ,p)
定義:
ValueError: Shapes TensorShape([]) and TensorShape([Dimension(1)]) must have the same rank
- を回転行列を定義するための よりエレガントな方法があります は余分な自由度を導入していないのですか?たとえば、法線ベクトル+角度は完全に許容可能です。
問題については、事前
ありがとうございます。ありがとうございました。 – CAFEBABE