当前位置:网站首页>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

边栏推荐
- What's the difference between using the Service Worker Cache API and regular browser cache?
- Oauth2.0 - using JWT to replace token and JWT content enhancement
- Oauth2.0 - use database to store client information and authorization code
- Phpstudy setting items can be accessed by other computers on the LAN
- Printer related problem record
- Migrate data from Mysql to tidb from a small amount of data
- Mysql5.7 group by error
- Judge whether the date time exceeds 31 days
- Selenium ide installation recording and local project maintenance
- Some thoughts on machine learning
猜你喜欢

YOLOV2学习与总结

SQL实现将多行记录合并成一行

Kubernetes notes (I) kubernetes cluster architecture

ROS+Pytorch的联合使用示例(语义分割)

Selenium ide installation recording and local project maintenance

技术管理进阶——你了解成长的全貌吗?

Cesium Click to obtain the longitude and latitude elevation coordinates (3D coordinates) of the model surface

Docker advanced learning (container data volume, MySQL installation, dockerfile)

Creating postgre enterprise database by ArcGIS

Advanced technology management - do you know the whole picture of growth?
随机推荐
Redis cluster creation, capacity expansion and capacity reduction
深入解析kubernetes controller-runtime
剖析虚幻渲染体系(16)- 图形驱动的秘密
phpstudy设置项目可以由局域网的其他电脑可以访问
认识弹性盒子flex
The win7 computer can't start. Turn the CPU fan and stop it
Analysis of Clickhouse mergetree principle
Read blog type data from mysql, Chinese garbled code - solved
Apifix installation
pytorch练习小项目
In depth learning
Selenium - 改变窗口大小,不同机型呈现的宽高长度会不一样
Use selenium to climb the annual box office of Yien
IE browser flash back, automatically open edge browser
What's the difference between using the Service Worker Cache API and regular browser cache?
Zhiniu stock -- 03
Skywalking8.7 source code analysis (I): agent startup process, agent configuration loading process, custom class loader agentclassloader, plug-in definition system, plug-in loading
有意思的鼠標指針交互探究
MySQL帶二進制的庫錶導出導入
PHP用ENV获取文件参数的时候拿到的是字符串