Jetson TX2测试caffe-ssd网络时遇到的问题

问题如下图所示:

问题分析:

进过近两天查阅资料,发现该问题主要由两个原因造成。其一,TX2的显卡计算能力有限,当训练部分的batch_size设置过大时容易出现该问题;其二,为显卡计算能力与配置文件不匹配造成。

解决办法:

针对原因1:

仅需将ssd文件夹/examples/ssd/ssd_pascal.py文件中的batch_size,设小即可,根据TX2是我计算能力我设置为8,如下所示

336 # Divide the mini-batch to different GPUs.
337 batch_size = 32
338 accum_batch_size = 32

针对原因2:

针对显卡计算能力不匹配的问题,在caffe-ssd目录下的Makefile.config文件当中做适当修改并重新编译即可,原始的文件如下所示

33 # CUDA architecture setting: going with all of them.
34 # For CUDA < 6.0, comment the lines after *_35 for compatibility.
35 CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
36              -gencode arch=compute_20,code=sm_21 \
37              -gencode arch=compute_30,code=sm_30 \
38              -gencode arch=compute_35,code=sm_35 \
39              -gencode arch=compute_50,code=sm_50 \
40              -gencode arch=compute_52,code=sm_52 \
41              -gencode arch=compute_61,code=sm_61

通过网络查找到TX2的计算能力为6.2,因此将Makefile.config做出如下修改

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the lines after *_35 for compatibility.
CUDA_ARCH := -gencode arch=compute_62,code=sm_62 \
             -gencode arch=compute_35,code=sm_35 \
             -gencode arch=compute_50,code=sm_50 \
             -gencode arch=compute_52,code=sm_52 \
             -gencode arch=compute_61,code=sm_61 

然后再重新编译一次即可:

cd /home/Ubuntu/caffe-ssd
make clean  #清楚之前的编译
make all -j4
make test -j4
make runtest -j4  #这一步,github给出的选项是可选项,没必要运行
make pycaffe -j4

猜你喜欢

转载自blog.csdn.net/QLULIBIN/article/details/81913885