当前位置:网站首页>Example of joint use of ros+pytoch (semantic segmentation)
Example of joint use of ros+pytoch (semantic segmentation)
2022-07-03 06:22:00 【Daytime plus】
This article is based on ROS Graphic Deeplab v3+ Real time semantic segmentation (ROS+Pytorch) Make a pit record , And attach some understanding of the corresponding operation .( Consciously, there are many places where the understanding is not in place , If there is a big guy passing by, please don't hesitate to give me advice !)
First , The above article is very well written ! The code is also very nice, This article makes a slight change to its code ,gitee Address
This code is mainly for ubuntu 18.04,ros-melodic edition ;
ubuntu20.04 Of ros-noetic Because I have python3, It may not be so troublesome .
Actually You need to specify the following when compiling , It means to use anaconda Of python Compile code , and catkin By default ros The path of , In this way, you can call anaconda The environment and ros All kinds of libraries !
catkin config -DPYTHON_EXECUTABLE=/home/daybeha/anaconda3/bin/python -DPYTHON_INCLUDE_DIR=/home/daybeha/anaconda3/include/python3.9 -DPYTHON_LIBRARY=/home/daybeha/anaconda3/lib/libpython3.9.so -DCMAKE_BUILD_TYPE=Release -DSETUPTOOLS_DEB_LAYOUT=OFF
What needs to be noted here is , Be sure to go to the corresponding path to see if there are relevant files , How to name the related documents , For example, the original question is libpython3.6m.so, But my path is only libpython3.9.so, that m You can't ( Although I don't know this ’m’ What is the ……)
Although you can call ros and anaconda Library. , however ros The conversion of image information is often encountered when receiving information , It needs to use cv_bridge.
because stay Ubuntu18.04 Next ,ros Of python yes 2.7 edition , In the system cv_bridge Yes, it is python2 Compilation of . But if you want to use pytorch, It needs to be in python3 Let's compile , At this time, in the code cv_bridge The following errors will be reported :
So we need to use python3 Compilation of cvbuguobuguo_bridge edition , It's in the code vision_opencv Folder , Its original github The address is https://github.com/ros-perception/vision_opencv
Pay attention here catkin build
The path after cannot be written wrong !!!
If you write it wrong , If the system cannot find it, it will go to the path of environment variables , However, there is only python2.7, Cannot compile this version cv_bridge
To report a mistake
However, you need to call the cv_bridge, This is not enough , stay import cv_bridge Before , To avoid calling ros use python2.7 Compilation of cv_bridge, You need to make the path of the library first , namely predict.py Of the 7 That's ok ( I have changed this part , Please refer to the code provided in this article ):
post It can be said that instead of the seventh line above, it is in catkin build
Compiled source After add --extend, namely
source devel/setup.bash --extend
roslaunch img_seg run.launch
But I tried it myself , Whether it's the first 7 Lines of code , still –extend , It doesn't matter whether you add it or not …… You can try it on your own .
In addition, if you run through the code, you need to modify these two items , They are image topic names img_topic, and pth Model path ckpt.
Then you can catkin build
Compile .
After compiling , perform
source devel/setup.bash
roslaunch img_seg run.launch
then rosbag play kitti Of bag You can see the following effects .
About kitti How to convert data into rosbag
Of course you can use it Euroc Bring it with you rosbag The data of , Change the image topic accordingly .ROS Graphic Deeplab v3+ Real time semantic segmentation (ROS+Pytorch)
Reference
ROS Graphic Deeplab v3+ Real time semantic segmentation (ROS+Pytorch)
python3 Environmental use cv_bridge
It's not about the title
git How not to every time pull and push Enter the username and password :
First enter
git config --global credential.helper store
And then again pull perhaps push Enter the user name and password at one time , You don't need to input again in the future !
git push origin master
边栏推荐
猜你喜欢
项目总结--2(Jsoup的基本使用)
Une exploration intéressante de l'interaction souris - pointeur
Reinstalling the system displays "setup is applying system settings" stationary
Kubernetes notes (IX) kubernetes application encapsulation and expansion
Selenium - 改变窗口大小,不同机型呈现的宽高长度会不一样
Kubesphere - set up redis cluster
Creating postgre enterprise database by ArcGIS
Kubesphere - build Nacos cluster
SQL实现将多行记录合并成一行
有意思的鼠標指針交互探究
随机推荐
When PHP uses env to obtain file parameters, it gets strings
Mysql
Introduction to software engineering
简易密码锁
Use selenium to climb the annual box office of Yien
In depth analysis of kubernetes controller runtime
Es remote cluster configuration and cross cluster search
Read blog type data from mysql, Chinese garbled code - solved
Skywalking8.7 source code analysis (I): agent startup process, agent configuration loading process, custom class loader agentclassloader, plug-in definition system, plug-in loading
Decision tree of machine learning
Virtual memory technology sharing
Cesium 点击获三维坐标(经纬度高程)
Oauth2.0 - explanation of simplified mode, password mode and client mode
项目总结--01(接口的增删改查;多线程的使用)
有意思的鼠标指针交互探究
方差迭代公式推导
Leetcode solution - 02 Add Two Numbers
Naive Bayes in machine learning
Kubernetes notes (VII) kuberetes scheduling
opencv