博主系统环境如下:
编译py-faster-rcnn
参考如下:
编译步骤:
- 从github上下载源码
- 1
- 2
- 1
- 2
建议加上–recursive,这样可以一并下载caffe-faster-rcnn包
- 生成Cython模块
修改py-faster-rcnn/lib/setup.py文件第135行:
‘nvcc’: [‘-arch=sm_35’,
根据自己的显卡计算能力进行修改,查询网址为: CUDA-Enabled GeForce Products
博主机子是GeForce GTX 980,所以这里我改成了52
然后:
- 1
- 2
- 1
- 2
- 生成Caffe和pycaffe
- 1
- 2
- 1
- 2
Makefile.config文件博主的如下:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
保存退出。
终端输入:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
问题
但博主在make -j8的时候,报以下错误:
全都是和cudnn有关,错误个数非常多。因为faster-rcnn的caffe所用的cudnn为旧版本的,与我的cudnn版本(v5.1)不兼容,导致出现如上错误。所以这里我们需要修改cudnn加速文件
- py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp
- py-faster-rcnn/caffe-fast-rcnn/src/caffe/util/cudnn.cpp
- py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers/目录下8个cudnn_开头的文件
- py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers/ 目录下16个cudnn_开头的文件
将以上文件用选择caffe-master版的相应文件进行替换,这样编译就不会出错啦。(亲测有效)
还遇到这个问题:
执行第一次时,发现后面还会再出现这类问题,所以我又执行了一次,下一次就可以正常了。
参考方法:
caffe配置问题与解决方法集锦
使用caffe时编译出错
后面执行demo.py的时候会遇到:
解决办法:
发现找不到pip和easy_install,所以需要安装如下:
- 1
- 1
再执行:
- 1
- 1
最后执行:
- 1
- 1
终结
- 运行demo.py
- 1
- 2
- 1
- 2
py-faster rcnn训练自己的数据
参考:
将数据集做成VOC2007格式用于Faster-RCNN训练
Faster-RCNN+ZF用自己的数据集训练模型(Python版本)