YOLOX 训练环境搭建

本人系统内核信息
(base) mr_zhang@mrzhang940328:~/桌面$ uname -a
Linux mrzhang940328 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

1、创建conda环境
conda create -n Yolox python=3.7
2、激活环境
conda activate Yolox
3、安装代码依赖的库文件
pip3 install -U pip && pip3 install -r requirements.txt
pip3 install -v -e .*(注意点一定不要漏了)*或者用python3 setup.py develop
4、安装pycocotools

pip3 install cython; pip3 install ‘git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI’

如果报错如下:
Collecting cython
Using cached Cython-0.29.24-cp37-cp37m-manylinux1_x86_64.whl (2.0 MB)
Installing collected packages: cython
Successfully installed cython-0.29.24
Collecting git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/cocodataset/cocoapi.git to /tmp/pip-req-build-wu49q19m
Running command git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-wu49q19m
fatal: unable to access ‘https://github.com/cocodataset/cocoapi.git/’: GnuTLS recv error (-110): The TLS connection was non-properly terminated.
WARNING: Discarding git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI. Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-wu49q19m Check the logs for full command output.
ERROR: Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-wu49q19m Check the logs for full command output.
(Yolox) mr_zhang@mrzhang940328:~/deepleaning/YOLOX-main$
重新安装命令如下:
pip3 install cython; pip3 install ‘git+git://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI’

5、运行demo

使用代码中自带的图片,进行Demo测试。
在YOLOX文件夹的终端页面输入:

python3 tools/demo.py image -n yolox-s -c yolox_s.pth --path assets/2.png --conf 0.3 --nms 0.5 --tsize 640 --save_result --device [gpu]

YOLOX的代码中,会新建一个YOLOX_outputs文件夹,在其中的yolox_s/vis_res/,可以看到带有检测效果的图片,到此Yolox的测试环境,以及测试效果都实现了。

你可能感兴趣的:(python,目标检测)