赞
踩
下载源码:https://github.com/MVIG-SJTU/AlphaPose
测试
python scripts/demo_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --indir examples/demo/
报错:
ImportError: cannot import 'roi_align_cuda' from partially initialized module 'alphapose.utils.roi_align' (most likely due to a circular import)
观察导入的这个是cpp,但是并没有对应的库。
参考https://blog.csdn.net/weixin_59250115/article/details/126313125
运行python setup.py build develop
报错:
/home/zhanglu/anaconda3/envs/yolov5/compiler_compat/ld: cannot find -lOSMesa: No such file or directory
/home/zhanglu/anaconda3/envs/yolov5/compiler_compat/ld: cannot find -lGL: No such file or directory
/home/zhanglu/anaconda3/envs/yolov5/compiler_compat/ld: cannot find -lGLU: No such file or directory
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1
参考:http://c.biancheng.net/view/3901.html
知道相关库的位置,并软链接过去。
find /usr -name libGL*
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libGLU.so.1 /usr/lib/libGLU.so
find /usr -name libOSMesa*
sudo find / -name libOSMesa*
都找不到相关库。
$ sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
$ find /usr -name libOSMesa*
/usr/lib/x86_64-linux-gnu/libOSMesa.so.8
/usr/lib/x86_64-linux-gnu/libOSMesa.so.6
/usr/lib/x86_64-linux-gnu/libOSMesa.so.8.0.0
/usr/lib/x86_64-linux-gnu/libOSMesa.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libOSMesa.so /usr/lib/libOSMesa.so
再运行python setup.py build develop
,继续报错nms_kernel.cu中找不到#include <ATen/ATen.h>。
注释掉setup.py中的
# make_cuda_ext(
# name='nms_cuda',
# module='detector.nms',
# sources=['src/nms_cuda.cpp', 'src/nms_kernel.cu']),
最后成功了。
运行:python scripts/demo_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --indir examples/demo/
报错:
from . import nms_cpu, nms_cuda
ImportError: cannot import name 'nms_cuda' from partially initialized module 'detector.nms' (most likely due to a circular import) ()
因为上边没有编译这个库。就不用cuda了,在cpu上计算nms。在nms_wrapper.py中注释掉nms_cuda即可成功运行。
训练使用的是seresnet50
seresnet50介绍参考:https://blog.csdn.net/weixin_43863869/article/details/121377413
se模块
分析:上图将SENet添加至Residual模块中,即将SENet模块添加至ResNet中Conv Block和Identity Block的最后一个小Block之后。
def forward(self, x):
out = self.preact(x) ##seresnet50
out = self.suffle1(out) ##上采样nn.PixelShuffle
out = self.duc1(out) ##conv,bn,relu,nn.PixelShuffle
out = self.duc2(out) ##conv,bn,relu,nn.PixelShuffle
out = self.conv_out(out) ##conv
return out
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。