一、项目介绍:

二、环境安装

  • 平台:windows 10
  • 编译器:pycharm
  • cuda 11.3
  • cudnn 8.2.0.53
conda create -n yolov5area python=3.8
conda activate yolov5area
pip install torch-1.11.0+cu113-cp38-cp38-win_amd64.whl
pip install torchvision-0.12.0+cu113-cp38-cp38-win_amd64.whl
pip install matplotlib==3.2.2 -i https://mirror.baidu.com/pypi/simple
pip install opencv-python -i https://mirror.baidu.com/pypi/simple
pip install Pillow -i https://mirror.baidu.com/pypi/simple
pip install PyYAML==5.3.1 -i https://mirror.baidu.com/pypi/simple
pip install scipy==1.4.1 -i https://mirror.baidu.com/pypi/simple
pip install tensorboard==2.4.1 -i https://mirror.baidu.com/pypi/simple
pip install seaborn==0.11.0 -i https://mirror.baidu.com/pypi/simple
pip install pandas -i https://mirror.baidu.com/pypi/simple
pip install thop -i https://mirror.baidu.com/pypi/simple
pip install tqdm -i https://mirror.baidu.com/pypi/simple
pip install numpy==1.21 -i https://mirror.baidu.com/pypi/simple

三、执行代码

执行dectect.py文件

四、遇到的问题

1、AttributeError: ‘Upsample’ object has no attribute ‘recompute_scale_factor’

解决办法:

1)进入目录,找到以下代码

def forward(self, input: Tensor) -> Tensor:

  return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners,
  
  recompute_scale_factor=self.recompute_scale_factor)

改为:

def forward(self, input: Tensor) -> Tensor:
   return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)
# return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners,
# recompute_scale_factor=self.recompute_scale_factor)

五、效果展示

六、总结