YOLOX
YOLOX: Exceeding YOLO Series in 2021
absl-py==0.13.0
backcall==0.2.0
cachetools==4.2.2
certifi==2021.5.30
charset-normalizer==2.0.4
cycler==0.10.0
Cython==0.29.24
decorator==5.0.9
flatbuffers==2.0
google-auth==1.35.0
google-auth-oauthlib==0.4.5
grpcio==1.39.0
idna==3.2
imageio==2.9.0
ipython==7.27.0
jedi==0.18.0
kiwisolver==1.3.1
loguru==0.5.3
Markdown==3.3.4
matplotlib==3.4.3
matplotlib-inline==0.1.2
networkx==2.6.2
ninja==1.10.2
numpy==1.21.2
oauthlib==3.1.1
onnx==1.8.1
onnx-simplifier==0.3.5
onnxoptimizer==0.2.6
onnxruntime==1.8.0
opencv-python==4.5.3.56
parso==0.8.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.3.2
prompt-toolkit==3.0.20
protobuf==3.17.3
ptyprocess==0.7.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycocotools @ git+https://github.com/cocodataset/cocoapi.git@8c9bcc3cf640524c4c20a9c40e89cb6a2f2fa0e9#subdirectory=PythonAPI
Pygments==2.10.0
pyparsing==2.4.7
python-dateutil==2.8.2
PyWavelets==1.1.1
requests==2.26.0
requests-oauthlib==1.3.0
rsa==4.7.2
scikit-image==0.18.2
scipy==1.7.1
six==1.16.0
tabulate==0.8.9
tensorboard==2.6.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
thop==0.0.31.post2005241907
tifffile==2021.8.8
torch==1.9.0
torchvision==0.10.0
tqdm==4.62.1
traitlets==5.1.0
typing-extensions==3.10.0.2
urllib3==1.26.6
wcwidth==0.2.5
Werkzeug==2.0.1
name: yolox
channels:
- >
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=4.5=1_gnu
- ca-certificates=2021.7.5=h06a4308_1
- certifi=2021.5.30=py39h06a4308_0
- intel-openmp=2021.3.0=h06a4308_3350
- ld_impl_linux-64=2.35.1=h7274673_9
- libffi=3.3=he6710b0_2
- libgcc-ng=9.3.0=h5101ec6_17
- libgomp=9.3.0=h5101ec6_17
- libstdcxx-ng=9.3.0=hd4cf53a_17
- mkl=2020.2=256
- ncurses=6.2=he6710b0_1
- openssl=1.1.1l=h7f8727e_0
- pip=21.2.4=py37h06a4308_0
- python=3.9.6=h12debd9_1
- pytorch=1.9.0=py3.9_cuda11.1_cudnn8.0.5_0
- readline=8.1=h27cfd23_0
- setuptools=52.0.0=py39h06a4308_0
- sqlite=3.36.0=hc218d9a_0
- tk=8.6.10=hbc83047_0
- torchvision=0.10.0=py39_cu111
- tzdata=2021a=h5d7bf9c_0
- wheel=0.37.0=pyhd3eb1b0_1
- xz=5.2.5=h7b6447c_0
- zlib=1.2.11=h7b6447c_3
- pip:
- absl-py==0.13.0
- backcall==0.2.0
- cachetools==4.2.2
- charset-normalizer==2.0.4
- cycler==0.10.0
- cython==0.29.24
- decorator==5.0.9
- flatbuffers==2.0
- google-auth==1.35.0
- google-auth-oauthlib==0.4.5
- grpcio==1.39.0
- idna==3.2
- imageio==2.9.0
- ipython==7.27.0
- jedi==0.18.0
- kiwisolver==1.3.1
- loguru==0.5.3
- markdown==3.3.4
- matplotlib==3.4.3
- matplotlib-inline==0.1.2
- networkx==2.6.2
- ninja==1.10.2
- numpy==1.21.2
- oauthlib==3.1.1
- onnx==1.8.1
- onnx-simplifier==0.3.5
- onnxoptimizer==0.2.6
- onnxruntime==1.8.0
- opencv-python==4.5.3.56
- parso==0.8.2
- pexpect==4.8.0
- pickleshare==0.7.5
- pillow==8.3.2
- prompt-toolkit==3.0.20
- protobuf==3.17.3
- ptyprocess==0.7.0
- pyasn1==0.4.8
- pyasn1-modules==0.2.8
- pycocotools==2.0
- pygments==2.10.0
- pyparsing==2.4.7
- python-dateutil==2.8.2
- pywavelets==1.1.1
- requests==2.26.0
- requests-oauthlib==1.3.0
- rsa==4.7.2
- scikit-image==0.18.2
- scipy==1.7.1
- six==1.16.0
- tabulate==0.8.9
- tensorboard==2.6.0
- tensorboard-data-server==0.6.1
- tensorboard-plugin-wit==1.8.0
- thop==0.0.31-2005241907
- tifffile==2021.8.8
- tqdm==4.62.1
- traitlets==5.1.0
- typing-extensions==3.10.0.2
- urllib3==1.26.6
- wcwidth==0.2.5
- werkzeug==2.0.1
prefix: /home/yoyo/miniconda3/envs/yolox
git clone [email protected]:Megvii-BaseDetection/YOLOX.git
cd YOLOX
conda env create -f yolox.yaml
pip install -r requirements-gpu.txt
下载 pretrained 模型到 /PATH/TO/YOLOX/models/yolox_s.pth
python tools/demo.py image -n yolox-s -c models/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu
cd <YOLOX_HOME>
ln -s /path/to/your/COCO ./datasets/COCO
# 如果创建软链接失败,可以直接在修改coco数据集的路径
/home/yoyo/MyDocuments/PyProjects/YOLOX/yolox/data/datasets/coco.py
data_dir = data_dir = os.path.join(get_yolox_datadir(), "COCO")
修改为
data_dir = "/home/yoyo/Downloads/COCO"
python tools/train.py -n yolox-s -d 8 -b 64 --fp16 -o [--cache]
yolox-m
yolox-l
yolox-x
-d: number of gpu devices
-b: total batch size, the recommended number for -b is num-gpu * 8
--fp16: mixed precision training
--cache: caching imgs into RAM to accelarate training, which need large system RAM.
python tools/eval.py -n yolox-s -c /home/yoyo/MyDocuments/PyProjects/YOLOX/YOLOX_outputs/yolox_s/best_ckpt.pth -b 8 -d 1 --conf 0.001 --fp16
--fuse: fuse conv and bn
-d: number of GPUs used for evaluation. DEFAULT: All GPUs available will be used.
-b: total batch size across on all GPUs
深入浅出Yolox之自有数据集训练超详细教程
Train Custom Data
subprocess.CalledProcessError: Command '['/home/yoyo/360Downloads/cmake-3.21.1-linux-x86_64/bin/cmake', '-DPYTHON_INCLUDE_DIR=/home/yoyo/miniconda3/envs/yolox/include/python3.9', '-DPYTHON_EXECUTABLE=/home/yoyo/miniconda3/envs/yolox/bin/python', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-39-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-install-u515jhgp/onnx_8b4e1627076c4280822bcbf0c56ea4bb']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for onnx
Failed to build onnx
ERROR: Could not build wheels for onnx which use PEP 517 and cannot be installed directly
错误原因:
安装onnx需要protobuf编译,所以安装onnx前需要先安装protobuf
解决办法:
pip install protobuf
sudo apt-get install protobuf-compiler libprotoc-dev
pip install onnx==1.8.1
python tools/demo.py image -f exps/default/yolox_s.py -c models/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device cpu
Traceback (most recent call last):
File "/home/yoyo/MyDocuments/PyProjects/YOLOX/tools/demo.py", line 14, in
from yolox.data.data_augment import ValTransform
ModuleNotFoundError: No module named 'yolox'
[命令行下执行python找不包的解决方法](https://www.cnblogs.com/yhleng/p/10330994.html)错误原因:....├── tools # 一级目录│ ├── demo.py # 二级目录├── yolox # 一级目录搜索包原则:同级搜索,向下搜索,不支持向父级搜索;在pycharm等IDE中,从项目根路径开始向下搜索demo.py是二级目录,yolox是一级目录demo.py二级目录无法搜索一级目录yolox包解决办法:在tools/demo.py中添加以下代码#将根目录加入sys.path中,解决命令行找不到包的问题import sysimport oscurPath = os.path.abspath(os.path.dirname(__file__))rootPath = os.path.split(curPath)[0]sys.path.append(rootPath)
RuntimeError: CUDA error: no kernel image is available for execution on the deviceCUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
[PyTorch报CUDA error: no kernel image is available for execution on the device问题解决](https://heary.cn/posts/PyTorch%E6%8A%A5CUDA-error-no-kernel-image-is-available-for-execution-on-the-device%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3/)错误原因:CUDA的版本与pytorch版本不匹配博主的环境:CUDA=11.1,cuDNN=8.0.5,python=3.9.6,pytorch=1.9解决办法:升级CUDA,注意与pytorch版本对齐
File "/home/yoyo/miniconda3/envs/yolox/lib/python3.9/site-packages/pycocotools/mask.py", line 3, in import pycocotools._mask as _mask File "pycocotools/_mask.pyx", line 1, in init pycocotools._maskValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
解决办法:pip install pycocotools
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.
错误原因:pip list 显示有 torch 1.9.0conda list 显示有 pytorch 1.9.0 py3.9_cuda11.1_cudnn8.0.5_0两个版本冲突解决办法:两个版本都卸载,重新安装即可pip uninstall torchconda uninstall pytorch
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'Traceback (most recent call last): File "/home/yoyo/MyDocuments/PyProjects/YOLOX/tools/demo.py", line 10, in import cv2 File "/home/yoyo/miniconda3/envs/yolox/lib/python3.9/site-packages/cv2/__init__.py", line 5, in from .cv2 import *ImportError: numpy.core.multiarray failed to import
解决办法:卸载numpy,重新安装numpypip uninstall numpy或者conda uninstall numpypip install numpy可能需要装依赖包pip install onnxpip install sixpip install typing_extensions
from PIL import ImageImportError: cannot import name 'Image' from 'PIL' (unknown location)
解决办法:pip install Pillow
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.
错误原因:pytorch版本与torchvision版本不匹配解决办法:torchvision版本对齐[torchvision](https://github.com/pytorch/vision#installation)
#将根目录加入sys.path中,解决命令行找不到包的问题
import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
#########################################################