研究背景
准备进行行星/恒星等小目标检测
研究参考
算法编译
环境搭建
# packages in environment at /home/ouc/miniconda3/envs/fpn2:
#
# Name Version Build Channel
blas 1.0 mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
ca-certificates 2019.1.23 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
certifi 2019.3.9 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cffi 1.12.2 py27h2e261b9_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cudatoolkit 8.0 3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
cudnn 7.1.3 cuda8.0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
freetype 2.9.1 h8a8886c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
intel-openmp 2019.3 199 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
jpeg 9b h024ee3a_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libedit 3.1.20181209 hc058e9b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libffi 3.2.1 hd88cf55_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgcc-ng 8.2.0 hdf63c60_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgfortran-ng 7.3.0 hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libpng 1.6.36 hbc83047_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libstdcxx-ng 8.2.0 hdf63c60_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtiff 4.0.10 h2733197_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl 2018.0.3 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_fft 1.0.6 py27h7dd41cf_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_random 1.0.1 py27h4414c95_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
nccl 1.3.4 cuda8.0_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ncurses 6.1 he6710b0_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
ninja 1.8.2 py27h6bb024c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy 1.15.4 py27h1d66e8a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy-base 1.15.4 py27h81de0dd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
olefile 0.46 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
openssl 1.1.1b h7b6447c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pillow 5.4.1 py27h34e0f95_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip 19.0.3 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pycparser 2.19 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python 2.7.16 h9bab390_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pytorch 0.3.1 py27hfbe7015_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyyaml 5.1 py27h7b6447c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
readline 7.0 h7b6447c_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools 40.8.0 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
six 1.12.0 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
sqlite 3.27.2 h7b6447c_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tk 8.6.8 hbc83047_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
torchvision 0.2.0 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel 0.33.1 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
xz 5.2.4 h14c3975_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
yaml 0.1.7 had09818_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zlib 1.2.11 h7b6447c_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zstd 1.3.7 h0b5b093_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
训练前准备
-
数据集
VOC2007
存放路径 /data/VOCdevkit2007/VOC2007 -
sh make.sh
报错
src/binding.cpp:6:10: fatal error: torch/extension.h: No such file or directory
Pytorch版本问题
解决fatal error: torch/extension.h: No such file or directory
报错
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
训练报错
- indices报错
TypeError: index(): argument 'indices' (position 1) must be tuple of Tensors, not Tensor in proposal_target_layer_cascade.py
解决
labels = gt_boxes[:, :, 4].contiguous().view(-1).index((offset.view(-1),)).view(batch_size, -1)`
- proposals_single 报错
#output[i,:num_proposal,1:] = proposals_single
if num_proposal == 0:
num_proposal = num_proposal + 1
proposals_single = torch.zeros((1, 4))
output[i, :num_proposal, 1:] = proposals_single
- 报错 RCNN_rpn was not defined
RCNN_rpn.rpn_loss_cls.data[0]->
rpn_loss_cls.data[0]
测试报错
- RuntimeError报错
File "/home/ouc/data1/liuhongzhi/FPN/test_net.py", line 284, in <module>
cls_dets = torch.cat((cls_boxes, cls_scores), 1)
RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 1 and 2 at /opt/conda/conda-bld/pytorch_1525796793591/work/torch/lib/THC/generic/THCTensorMath.cu:102
解决:
#cls_dets = torch.cat((cls_boxes, cls_scores), 1)
cls_dets = torch.cat((cls_boxes, cls_scores.unsqueeze(1)), 1)
知识补充
-
计算模型以及中间变量的显存占用大小
浅谈深度学习:如何计算模型以及中间变量的显存占用大小 -
pytorch 减小显存消耗,优化显存使用
pytorch 减小显存消耗,优化显存使用,避免out of memory -
git clone 子模块下载不全问题
有时含有子模块的git库下载不全,比如
git clone https://github.com/mahyarnajibi/SNIPER.git
此时应输入如下指令
git clone --recursive https://github.com/mahyarnajibi/SNIPER.git
参考链接
网友评论