Hi at all, I’m trying to convert the dlc model from Tensorflow to Pytorch (it seems that it can be run much more faster on Pytorch). For doing that I miss only the final part that from the prediction of the deconvolution layer extract the coordinates of the poses.
In simply terms of codes is this set of Tensorflow operations:
probs = tf.sigmoid(deconvolution_tensor) probs = tf.transpose(probs, [1, 2, 0, 3]) l_shape = tf.shape(probs) probs = tf.reshape(probs, (l_shape * l_shape, -1)) maxloc = tf.argmax(probs, axis=0) loc = tf.unravel_index(maxloc, (tf.cast(l_shape, tf.int64), tf.cast(l_shape, tf.int64))) maxloc = tf.reshape(maxloc, (1, -1)) joints = tf.reshape(tf.range(0, tf.cast(l_shape * l_shape, dtype=tf.int64)), (1, -1)) indices = tf.transpose(tf.concat([maxloc, joints], axis=0))
I managed to get something, but the shapes of the result is differents at a moment and so the result is not correct.
Any suggestion about doing this work?
p.s. The first not beautiful idea that works is to use Tf for only this part and converting the output from the Pytorch to numpy before sending it into the Tf graph, of course is not the best option for improving the inference speed.