This is the ROS implementation of the semantic segmentation algorithm Deeplab v3+.
We put two packages here for the convenience of using the correct version of Opencv.
You need an Anaconda environment with pytorch installed.
In addition, a few third-party packages (such as catkin_pkg visdom) are required, but there is no specific statistics.
You can install them when an error is reported.
mkdir DeepLabV3Plus_ws && cd DeepLabV3Plus_ws
mkdir src && cd src
git clone git@github.com:BIT-DYN/deeplab_ros.git
cd ..
source activate your_env
catkin config
catkin config -DPYTHON_EXECUTABLE=/home/user_name/anaconda3/envs/your_env/bin/python -DPYTHON_INCLUDE_DIR=/home/user_name/anaconda3/envs/your_env/include/python3.7m -DPYTHON_LIBRARY=/home/user_name/anaconda3/envs/your_env/lib/libpython3.7m.so -DCMAKE_BUILD_TYPE=Release -DSETUPTOOLS_DEB_LAYOUT=OFF
catkin_make
The code needs to be modified for your own use. They are all in the file Img_seg_ros/predict.py. Please modify your path or topic name.
- Line 30
sys.path.append('/home/dyn/DeepLabV3Plus_ws/devel/lib/python3.6/site-packages')
- Line 51
ckpt = "/home/dyn/DeepLabV3Plus_ws/src/deeplab_ros/Img_seg_ros/best_deeplabv3plus_mobilenet_cityscapes_os16.pth"
- Line 112
img_top = "/miivii_gmsl_ros/camera0/image_raw"
source devel/setup.bash
roslaunch img_seg run.launch
Open rviz to view the topic as '/image_ view/image_seg' color segmentation results. The colors of various categories can be modified in the file Img_seg_ros/datasets/cityscapes.py. The colors of various categories can be modified in the file.