From 2be7ccc4de710f6710ec9120453eef8c50d5ddf7 Mon Sep 17 00:00:00 2001 From: Jaiveer Singh Date: Fri, 2 Sep 2022 14:43:59 -0700 Subject: [PATCH] Isaac ROS 0.11.0 (DP1.1) --- .../isaac_ros_centerpose/CenterPoseDecoder.py | 19 ++++++++++++++----- .../CenterPoseDecoderUtils.py | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoder.py b/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoder.py index 677aed7..6486700 100644 --- a/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoder.py +++ b/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoder.py @@ -109,6 +109,11 @@ def decode_impl(hm, wh, kps, hm_hp, reg, hp_offset, obj_scale, K): min_dist = np.expand_dims(min_dist, -1) min_ind = np.broadcast_to(np.reshape(min_ind, (num_joints, K, 1, 1)), (batch, num_joints, K, 1, 2)) + + # make hm_kps and min_ind writable + hm_kps.setflags(write=1) + min_ind.setflags(write=1) + hm_kps = torch.gather(torch.from_numpy(hm_kps), dim=3, index=torch.from_numpy(min_ind)).numpy() hm_kps = np.reshape(hm_kps, (batch, num_joints, K, 2)) @@ -319,11 +324,15 @@ def listener_callback(self, msg): def main(args=None): - rclpy.init(args=args) - node = IsaacROSCenterposeDecoderNode('centerpose_decoder_node') - rclpy.spin(node) - node.destroy_node() - rclpy.shutdown() + try: + rclpy.init(args=args) + node = IsaacROSCenterposeDecoderNode('centerpose_decoder_node') + rclpy.spin(node) + except KeyboardInterrupt: + pass + finally: + node.destroy_node() + rclpy.shutdown() if __name__ == '__main__': diff --git a/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoderUtils.py b/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoderUtils.py index fa46cc3..3ead727 100644 --- a/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoderUtils.py +++ b/isaac_ros_centerpose/isaac_ros_centerpose/CenterPoseDecoderUtils.py @@ -55,6 +55,8 @@ def gather_feat(feat, ind, mask=None): dim = feat.shape[2] ind = np.broadcast_to(np.expand_dims( ind, 2), (ind.shape[0], ind.shape[1], dim)) + # make ind writable + ind.setflags(write=1) feat = torch.gather(torch.from_numpy(feat), 1, torch.from_numpy(ind)).numpy()