ctu-vras / traversability_estimation

Semantic Segmentation of Images and Point Clouds for Traversability Estimation
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

Error in test_image_segmentation_dataset_demo.launch? #5

Open crankler opened 3 months ago

crankler commented 3 months ago

Hi, thank you for your shared work, it;s useful for me. However, when I input my rosbag, the error shows:

[DEBUG] [1710318477.902099, 1709132152.561885]: Image updated for camera 0 (rgb_camera_link).
Traceback (most recent call last):
  File "/home/yc/catkin_map/ctu-vras/src/traversability_estimation/scripts/nodes/segmentation_inference", line 367, in <module>
    main()
  File "/home/yc/catkin_map/ctu-vras/src/traversability_estimation/scripts/nodes/segmentation_inference", line 363, in main
    node.spin()
  File "/home/yc/catkin_map/ctu-vras/src/traversability_estimation/scripts/nodes/segmentation_inference", line 311, in spin
    pred, trav = self.process(arr)
  File "/home/yc/catkin_map/ctu-vras/src/traversability_estimation/scripts/nodes/segmentation_inference", line 248, in process
    orig_size = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
[DEBUG] [1710318477.907829, 1709132152.571938]: [/clock] failed to receive incoming message : unable to receive data from sender, check sender's logs for details
[DEBUG] [1710318477.908134, 1709132152.571938]: [/sync_rgb] failed to receive incoming message : unable to receive data from sender, check sender's logs for details

I use rosbag and camera raw format, the params as follows:

    <param name="use_sim_time" value="true"/>
    <node name="rosbag_play" pkg="rosbag" type="play" args="--clock --delay 3.0 --rate 1.0 /home/yc/wheel_1_70_650_init.bag"/>

    <node name="segmentation_inference" pkg="traversability_estimation" type="segmentation_inference" output="screen">
        <rosparam subst_value="true">
            model_name: $(arg model_name)
            smp_weights: $(arg smp_weights)
            hrnet_weights: $(arg hrnet_weights)
            device: $(arg device)
            num_cameras: 1
            image_transport: 'raw'
            legend: false
            max_age: 1.0
            input_scale: 0.5
            traversability_labels: false
        </rosparam>
        <remap from="input_0/image" to="sync_rgb"/>
        <remap from="input_0/image/compressed" to="sync_rgb/compressed"/>
        <remap from="input_0/camera_info" to="sync_rgb/camera_info"/>
        <remap from="output_0/semseg" to="segmentation_inference/semantic_segmentation"/>
        <remap from="output_0/semseg/compressed" to="segmentation_inference/semantic_segmentation/compressed"/>
        <remap from="output_0/camera_info" to="segmentation_inference/camera_info"/>
    </node>

Moverover, I add some info in the segmentation_inference as follows:

        while not rospy.is_shutdown():
            t0 = rospy.Time.now()
            i = (i + 1) % len(self.images)
            with self.lock:
                image, camera_info = self.images[i], self.camera_infos[i]
            if not image:
                rospy.loginfo('not image')
                continue
            if not camera_info:
                rospy.loginfo('not camera_info')
                continue                

            try:
                if self.image_transport:
                    arr = self.bridge.compressed_imgmsg_to_cv2(image, "bgr8")
                else:
                    arr = self.bridge.imgmsg_to_cv2(image, "bgr8")
                    rospy.loginfo('raw msg to iamge...')
            except CvBridgeError as e:
                rospy.logerr(e)
                raise

It seems that can't receive image, can you tell me how to fix it? Thank you for your reply.

crankler commented 3 months ago

I've solve this issue, the reason due to the different judgement between raw and compressed image. Then, can you tell me how to publish raw images as follows?

            pub = rospy.Publisher('output_%i/semseg_color' % i, Image, queue_size=1)
            self.image_color_pubs[i] = pub
            pub = rospy.Publisher('output_%i/semseg' % i, Image, queue_size=1)
            self.image_pubs[i] = pub

In color_pc_bagfile_demo.launch, node point_cloud_color sub the topic from semantic segmentaion, but the above node didn't pubish such topic here. Thank you to reply me and help me here.