用的coco数据集
-
首先修改参数:
/home/gaoziran/YOLOv6-main/data/coco.yaml/
由于在服务器上跑,直接用绝对路径。 -
训练时遇到问题:UserWarning: torch.meshgrid: in an upcoming release
解决办法:
修改文件:/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/function.py/
-
训练:
单卡训练:
python tools/train.py --batch 32 --conf configs/yolov6n.py --data data/coco.yaml --device 0
双卡训练:
python -m torch.distributed.launch --nproc_per_node 2 tools/train.py --batch 32 --conf configs/yolov6n.py --data data/coco.yaml --device 0,1 -
遇到问题:RuntimeError: Address already in use
解决办法:加入参数 master_port
修改如下:
python -m torch.distributed.launch --master_port 2333 --nproc_per_node 2 tools/train.py --batch 16 --conf configs/yolov6n.py --data data/coco.yaml --device 0,1 -
遇到问题:ImportError: cannot import name ‘QuantStub‘ from ‘torch.ao.quantization‘
解决办法:anoconda3\Lib\site-packages\torch\ao\quantization_init_.py里面粘贴下面内容
class QuantStub(nn.Module):
r""“Quantize stub module, before calibration, this is same as an observer,
it will be swapped asnnq.Quantize
inconvert
.
Args:
qconfig: quantization configuration for the tensor,
if qconfig is not provided, we will get qconfig from parent modules
“””
def init(self, qconfig=None):
super(QuantStub, self).init()
if qconfig:
self.qconfig = qconfigdef forward(self, x):
return x -
遇到问题:UserWarning: Detected call of
lr_scheduler.step()
beforeoptimizer.step()
.
解决办法:更换torch版本!
torch-1.10.0+cu113-cp38-cp38
torchvision-0.11.1+cu113-cp38-cp38 -
遇到问题:AttributeError: module ‘distutils‘ has no attribute ‘version‘
setuptools 版本问题
解决办法:更换版本
pip uninstall setuptools
pip install setuptools==59.5.0