1.到GitHub下载yolox的安装包
https://github.com/Megvii-BaseDetection/YOLOX
2.安装环境依赖
在anaconda的anaconda powershell prompt创建并激活yolox的环境,并进入YOLOX的目录。
使用 conda创建环境:conda create -n yolox python=3.7
激活环境:conda activate yolox
下载pytorch:
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch
看看gpu能不能用
python
import torch
print(torch.cuda.is_available())
ture即可
命令行输入后面的网址表示清华源镜像:
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
如下图显示这个pycocotools没装好:先不管它,先装apex
安装apex
git clone https://github.com/nvidia/apex
cd apex
python setup.py install
注意:此处如果cuda和cudatoolkit的版本不对应会装不起
安装cython
pip install cython
3.执行指令
python setup.py develop
换一个方法:在腾讯软件管理下载了Visual Studio Installer2017
安装opencv-xontrib-python
pip install opencv-contrib-python
安装pycocotools
pycocotools本来不支持windows,现在已经有了支持的版本了:
https://github.com/philferriere/cocoapi
pip install cython
git clone https://github.com/philferriere/cocoapi.git
cd cocoapi/PythonAPI
python setup.py install --user
这个方法也不行,
用这个指令单独装它 pycocotools,解决!
conda install -c conda-forge pycocotools
将权重文件yolox_s.pth下载后放入根目录下执行测试指令:
python tools/demo.py image -n yolox-s -c yolox_s.pth --path assets/dog.jpg --conf 0.3 --nms 0.5 --tsize 640 --save_result
出错:
又出错:
然后是这个错:error: Setup script exited with error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
用这个博客的方法解决了,
Setup script exited with error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual_步青云之上的博客-优快云博客出现如下问题:1.下载这个:地址:链接:https://pan.baidu.com/s/1tLTSWaAh79T1Nk9TO6WLOA提取码:ktpy2.默认安装就好3.安装之https://blog.youkuaiyun.com/sy20173081277/article/details/84962633最后执行指令测试:python tools/demo.py image -n yolox-s -c yolox_s.pth --path assets/dog.jpg --conf 0.3 --nms 0.5 --tsize 640 --save_result