dusty-nv / ros_deep_learning

Deep learning inference nodes for ROS / ROS2 with support for NVIDIA Jetson and TensorRT
866 stars 258 forks source link

Test Classification for single image. #78

Closed priyaganaboor-hash closed 3 years ago

priyaganaboor-hash commented 3 years ago

Hey, @dusty-nv

This below command uses the camera, can I also test the working by passing just single image. Similar to how we did in jetson-inference, where we passed the input as path to the image.file.

roslaunch ros_deep_learning video_viewer.ros1.launch input:=csi://0 output:=display://0

Which commands I have to change and which launch file to include?

priyaganaboor-hash commented 3 years ago

hey @dusty-nv ,

can u please help me solve this?

priyaganaboor-hash commented 3 years ago

If i type like this,

roslaunch ros_deep_learning imagenet.ros1.launch input:=/home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/train_img11.jpg output:=home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/output1111.jpg

-- [TRT] device GPU, /home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/resnet50.onnx initialized. [TRT] imageNet -- loaded 2 class info entries [TRT] imageNet -- /home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/resnet50.onnx initialized. [ INFO] [1622558727.615601021]: model hash => 6707725573171851291 [ INFO] [1622558727.622362479]: hash string => /home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/resnet50.onnx/home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/labels.txt [ INFO] [1622558727.627902896]: node namespace => /imagenet [ INFO] [1622558727.627993729]: class labels => /imagenet/class_labels_6707725573171851291 [ INFO] [1622558727.646194094]: imagenet node initialized, waiting for messages

It is waiting for publisher, what does it mean?

priyaganaboor-hash commented 3 years ago

Hey @dusty-nv

can you please help me here??

dusty-nv commented 3 years ago

@priyaganaboor-hash I think the issue may be that videoSource only publishes the image once, since it is only one image. It may publish that one image before imageNet node is initialized. What if you just point it to input:=/home/bm-jetson/catkin_ws/src/ros_deep_learning/PlantClassification/ ? Then it should publish many images from the directory

dusty-nv commented 3 years ago

There is also the loop parameter to the videoSource node that you can use, it will loop over the same image N number of times: https://github.com/dusty-nv/ros_deep_learning#video_source-node

priyaganaboor-hash commented 3 years ago

Thanks @dusty-nv

I published to topic /video_source/raw, it worked.

once it is classified the plant i want to terminate the execution, I am checking where i can use ros_shutdown, or use required="true" in launch. which would be better option?

dusty-nv commented 3 years ago

I am checking where i can use ros_shutdown, or use required="true" in launch. Sorry I'm not familiar with these options. I think ros_shutdown only shuts down the node it was run from within.