ubuntu 安装使用annconda,yolact_ros示例
一、安装annconda
1、官网下载anaconda下载链接
根据需要下载自己想要的版本,本文下载的是Anaconda3-5.3.0-Linux-x86_64
2、cd 下载目录
bash Anaconda3-5.3.0-Linux-x86_64.sh
提示信息“Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]”,输入no,其余一路回车enter或者yes
3、环境配置
在~/.bashrc中添加
alias start_anaconda='source ~/anaconda3/bin/activate'
之后需要激活anaconda 环境,在终端输入 start_anaconda进入anaconda的base环境。
二、yolact_ros的使用
1、创建yolact环境,python=3.6
conda create -n yolact python=3.6
conda activate yolact
2、安装环境依赖
conda install --channel https://conda.anaconda.org/conda-forge rospkg
conda install --channel https://conda.anaconda.org/conda-forge empy
pip install pillow pycocotools matplotlib
pip install -i https://pypi.douban.com/simple/ pip install opencv-python==4.3.0.38
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.2 -c pytorch
以下是正常运行的Yolact环境配置 文件(yolact.yaml):
可通过如下命令直接配置yolact环境:
conda env create --file yolact.yml
name: yolact
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- blas=1.0=mkl
- ca-certificates=2023.12.12=h06a4308_0
- catkin_pkg=1.0.0=pyhd8ed1ab_0
- certifi=2021.5.30=py36h06a4308_0
- cudatoolkit=11.0.221=h6bb024c_0
- dataclasses=0.8=pyh4f3eec9_6
- distro=1.8.0=pyhd8ed1ab_0
- docutils=0.13.1=py36_0
- empy=3.3.4=pyh9f0ad1d_1
- freetype=2.12.1=h4a9f257_0
- intel-openmp=2022.1.0=h9e868ea_3769
- jpeg=9b=h024ee3a_2
- lcms2=2.12=h3be6417_0
- ld_impl_linux-64=2.38=h1181459_1
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libpng=1.6.39=h5eee18b_0
- libstdcxx-ng=11.2.0=h1234567_1
- libtiff=4.2.0=h85742a9_0
- libuv=1.44.2=h5eee18b_0
- libwebp-base=1.3.2=h5eee18b_0
- lz4-c=1.9.4=h6a678d5_0
- mkl=2020.2=256
- mkl-service=2.3.0=py36he8ac12f_0
- mkl_fft=1.3.0=py36h54f3939_0
- mkl_random=1.1.1=py36h0573a6f_0
- ncurses=6.4=h6a678d5_0
- ninja=1.10.2=h06a4308_5
- ninja-base=1.10.2=hd09550d_5
- numpy-base=1.19.2=py36hfa32c7d_0
- olefile=0.46=py36_0
- openjpeg=2.4.0=h3ad879b_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- pyparsing=3.1.1=pyhd8ed1ab_0
- python=3.6.13=h12debd9_1
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python_abi=3.6=2_cp36m
- pytorch=1.7.1=py3.6_cuda11.0.221_cudnn8.0.5_0
- pyyaml=5.4.1=py36h8f6f2f9_1
- readline=8.2=h5eee18b_0
- rospkg=1.5.0=pyhd8ed1ab_0
- setuptools=58.0.4=py36h06a4308_0
- six=1.16.0=pyh6c4a22f_0
- sqlite=3.41.2=h5eee18b_0
- tk=8.6.12=h1ccaba5_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.4.5=h5eee18b_0
- yaml=0.2.5=h7f98852_2
- zlib=1.2.13=h5eee18b_0
- zstd=1.4.9=haebb681_0
- pip:
- cycler==0.11.0
- install==1.3.5
- kiwisolver==1.3.1
- matplotlib==3.3.4
- numpy==1.19.5
- opencv-python==4.3.0.38
- pillow==8.4.0
- pycocotools==2.0.7
- torch==1.9.1+cu111
- torchaudio==0.9.1
- torchvision==0.10.1+cu111
prefix: /home/gjw/anaconda3/envs/yolact
3、编译yolact_ros包
catkin_make -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
#修改为自己环境的python目录
catkin_make -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/home/gjw/anaconda3/envs/yolact/bin/python3 -DPYTHON_INCLUDE_DIR=/home/gjw/anaconda3/envs/yolact/include/python3.6m -DPYTHON_LIBRARY=/home/gjw/anaconda3/envs/yolact/lib/libpython3.6m.so
4、运行yolact_ros
# 注意更改 节点订阅的话题名
roslaunch yolact_ros yolact_ros.launch