Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

How to import/install "iou3d_nms_cuda.cpython-37m-x86_64-linux-gnu.so" as a ROS2 module?

$
0
0

I have successfully trained and tested a pointpillars network on my own point cloud dataset using https://github.com/shangjie-li/pointpillars/tree/master. I modified demo_in_ros.py from that repository to apply the trained model for 3D object detection using ROS2 (Humble). I used https://answers.ros.org/question/367793/including-a-python-module-in-a-ros2-package/ and was able to install all python codes (located in different folders) as modules in ROS2 workspace (ros2_pointpillars) /ros2_pointpillars/install/lidar_object_detection/lib/python3.10/site-packages/lidar_object_detection. I need to use iou3d_nms_cuda.cpython-37m-x86_64-linux-gnu.so which is located in /ops/iou3d_nms folder. How can I import/install it as a module in ROS2?

I appreciate any help in advance.

#setup.py

from setuptools import setuppackage_name = 'lidar_object_detection'submodules = ['lidar_object_detection.utils','lidar_object_detection.layers.vfe','lidar_object_detection.layers.map_to_bev','lidar_object_detection.layers.backbones_2d','lidar_object_detection.layers.dense_heads','lidar_object_detection.ops.iou3d_nms', 'lidar_object_detection.ops.roiaware_pool3d', 'lidar_object_detection.ops.iou3d_nms.src',               #'lidar_object_detection.ops.iou3d_nms_cuda',              'lidar_object_detection.data', 'lidar_object_detection.data.processor', 'lidar_object_detection.data.kitti_object_eval_python','lidar_object_detection.data.kitti', 'lidar_object_detection.data.augmentor'               ]setup(    name=package_name,    version='0.0.0',    packages=[package_name] + submodules,    data_files=[        ('share/ament_index/resource_index/packages',            ['resource/'+ package_name]),        ('share/'+ package_name, ['package.xml']),    ],    install_requires=['setuptools'],    zip_safe=True,    maintainer='usr',    maintainer_email='usr@gmail.com',    description='Object detection',    license='Apache License 2.0',    tests_require=['pytest'],    entry_points={'console_scripts': ['subscriber = lidar_object_detection.demo_in_ros:main',        ],    },)

#demo_in_ros.py

import argparseimport globfrom pathlib import Pathimport timeimport osimport sysimport mathimport threadingimport rclpyfrom std_msgs.msg import Headerfrom sensor_msgs.msg import PointCloud2from visualization_msgs.msg import Marker, MarkerArrayimport matplotlib.pyplot as pltimport cv2import numpy as npimport torchfrom .ops.iou3d_nms import iou3d_nms_cudafrom .ops.iou3d_nms import iou3d_nms_utilsfrom .data import cfg, cfg_from_yaml_filefrom .data import KittiDatasetfrom .pointpillar import build_network, load_data_to_gpufrom .utils import common_utils, calibration_kittifrom .utils import opencv_vis_utilsfrom .utils import numpy_pc2

#package.xml

<?xml version="1.0"?><?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?><package format="3"><name>lidar_object_detection</name><version>0.0.0</version><description>Object detection</description><maintainer email="usr@gmail.com">usr</maintainer><license>Apache License 2.0</license><exec_depend>rclpy</exec_depend><exec_depend>std_msgs</exec_depend><exec_depend>sensor_msgs</exec_depend><exec_depend>visualization_msgs</exec_depend><test_depend>ament_copyright</test_depend><test_depend>ament_flake8</test_depend><test_depend>ament_pep257</test_depend><test_depend>python3-pytest</test_depend><export><build_type>ament_python</build_type></export></package>

Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>