美文网首页
Ubuntu系统配置Clion训练caffe项目

Ubuntu系统配置Clion训练caffe项目

作者: JWDong2019 | 来源:发表于2020-08-06 17:28 被阅读0次

1. Clion的安装

Ubuntu 安装Clion和运行使用总结
可以使用学校邮箱注册账号,就可以免费使用专业版
如果训练时需要使用cuda,需要在clion.sh中加入cuda路径.

cd clion安装路径/bin
gedit clion.sh
//在Run the IDE前面添加cuda路径
export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

2. Clion使用cmke编译c++源码

点击Run->Edit Configrations->点击+选择CMake Application选择caffe.bin


CMake Application配置

必须填写的内容

Working directory: /caffe/project/root #caffe项目根目录
Program arguments: train  --solver "models/VGGNet/text/labdata_gpu1_640x480/solver.prototxt"  --weights "caffe_model_path"  -gpu 1
Environment variables: LD_LIBRARY_PATH=libs

编译时报错可以在CMakeLists.txt中添加相关内容,记得有一是报需要c++11的问题,可以添加

add_compile_options(-std=c++11)

3. Clion运行caffe项目中的python代码

首先需要

make pycaffe

然后在系统环境中配置caffe项目中python的路径具体.具体可以参考Ubuntu18.04安裝cuda8.0 cudnn5.1 opencv3.4.0 caffe(TextBoxes++))
然后点击Run->Edit Configrations->点击+选择Python,然后进行相关配置

Python环境配置
必须填写的内容
Script path: 当前需要运行的python文件路径
Environment variables: PYTHONUNBUFFERED=1;PYTHONPATH=$PYTHONPATH:/caffe/project/python/root 
Python interpreter:  Use SDK of module 选择caffe项目的名字
                                Use specified interpreter 选择caffe安装的路径,默认安装在系统路径
Working directory: /caffe/project/root #caffe项目根目录

相关文章

网友评论

      本文标题:Ubuntu系统配置Clion训练caffe项目

      本文链接:https://www.haomeiwen.com/subject/wxctdktx.html