记录一下trackformer的安装过程

记录一下trackformer的安装过程

项目地址

1、创建python环境,并激活

conda create-n trackformer python=3.8-y conda activate trackformer

2、进入trackformer中,并且运行setup.py

cd trackformer/python setup.py install

3、下载pytorch

# cuda 11.8pip install torch==2.0.1torchvision==0.15.2torchaudio==2.0.2--index-url https://download.pytorch.org/whl/cu118# 或者使用pip install torch==2.0.1torchvision==0.15.2torchaudio==2.0.2-i https://mirrors.aliyun.com/pypi/simple/

4、安装 requirements.txt

pip install -r requirements.txt pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 也可以使用阿里源 -i https://mirrors.aliyun.com/pypi/simple/

5、缺什么库 就装什么库

pip install pycocotools-i https://mirrors.aliyun.com/pypi/simple/pip install sacred==0.8.4-i https://mirrors.aliyun.com/pypi/simple/pip install pyyaml-i https://mirrors.aliyun.com/pypi/simple/pip install motmetrics-i https://mirrors.aliyun.com/pypi/simple/

6、安装MultiScaleDeformableAttention

最后直接运行的时候,提示MultiScaleDeformableAttention

因此需要安装MultiScaleDeformableAttention

python src/trackformer/models/ops/setup.py build--build-base=src/trackformer/models/ops/install



然而有的时候会报错,报错内容如下图所是,从中可以看出,报错的愿意是cuda和gcc的版本不兼容。可以看出,gcc的版本不应该超过10.
参考cuda error gcc(unsupported GNU version! gcc versions later than 5 are not supported)输出gcc的版本

gcc-v

安装gcc10

sudo apt-get install gcc-10sudo apt-get install g++-10

将gcc10与cuda建立软连接

sudo ln-s/usr/bin/gcc-10/usr/local/cuda/bin/gcc sudo ln-s/usr/bin/g++10/usr/local/cuda/bin/g++

安装MultiScaleDeformableAttention

python src/trackformer/models/ops/setup.py build --build-base=src/trackformer/models/ops/ install

7 make picture

sudo apt install ffmpeg ffmpeg-i data/snakeboard/snakeboard.mp4-vf fps=30data/snakeboard/%06d.png

8、开始检测

python src/track.pywithdataset_name=DEMO data_root_dir=data/snakeboard output_dir=data/snakeboard write_images=pretty



python解决报错ImportError: Bad git executable. https://blog.csdn.net/zzpl139/article/details/128228698