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

边栏推荐
- [set theory] equivalence relation (concept of equivalence relation | examples of equivalence relation | equivalence relation and closure)
- Difference between shortest path and minimum spanning tree
- Oauth2.0 - Introduction and use and explanation of authorization code mode
- [system design] proximity service
- Svn branch management
- Migrate data from Mysql to tidb from a small amount of data
- Get a screenshot of a uiscrollview, including off screen parts
- How to scan when Canon c3120l is a network shared printer
- pytorch练习小项目
- Core principles and source code analysis of disruptor
猜你喜欢

Kubernetes notes (IX) kubernetes application encapsulation and expansion

Creating postgre enterprise database by ArcGIS

Skywalking8.7 source code analysis (II): Custom agent, service loading, witness component version identification, transform workflow

Method of converting GPS coordinates to Baidu map coordinates

CKA certification notes - CKA certification experience post

智牛股项目--05

Read blog type data from mysql, Chinese garbled code - solved

Svn branch management

Click cesium to obtain three-dimensional coordinates (longitude, latitude and elevation)

Kubesphere - Multi tenant management
随机推荐
表达式的动态解析和计算,Flee用起来真香
Oauth2.0 - using JWT to replace token and JWT content enhancement
Virtual memory technology sharing
ODL framework project construction trial -demo
About the difference between count (1), count (*), and count (column name)
In depth analysis of kubernetes controller runtime
Oracle database synonym creation
[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
opencv鼠标键盘事件
ThreadLocal的简单理解
【C#/VB.NET】 将PDF转为SVG/Image, SVG/Image转PDF
Openresty best practices
Page text acquisition
Creating postgre enterprise database by ArcGIS
Project summary --2 (basic use of jsup)
Time format record
Kubesphere - set up redis cluster
Merge and migrate data from small data volume, sub database and sub table Mysql to tidb
tabbar的设置
Various usages of MySQL backup database to create table select and how many days are left