当前位置: 首页 > news >正文

ubuntu16.04下安装配置caffe2和detectron(亲测有效,非常简单)

介绍

Detectron是FAIR推出的一款优秀的物体检测、分割框架,基于caffe2,其中包含了Faster RCNN、Mask RCNN、FPN、RetinaNet、R-FCN、Openpose等常见的模型。可能是由于何凯明的缘故吧,Facebook集成了许多他提出的模型。该框架可以很方便的把这些模型应用到自己的工程和项目中,下面将具体介绍如何安装和配置caffe2和detectron。

安装配置caffe2

caffe2的安装网上教程有很多,但是有可能安装不成功,facebook开源的pytorch框架已经把caffe2集成到里面去啦~所以只需要安装pytorch即可。首先安装下依赖环境:

$ sudo apt-get update
$ sudo apt-get install -y --no-install-recommends \build-essential \cmake \git \libgoogle-glog-dev \libgtest-dev \libiomp-dev \libleveldb-dev \liblmdb-dev \libopencv-dev \libopenmpi-dev \libsnappy-dev \libprotobuf-dev \openmpi-bin \openmpi-doc \protobuf-compiler \python-dev \python-pip                          
$ sudo pip install \future \numpy \protobuf# for Ubuntu 16.04
$ sudo apt-get install -y --no-install-recommends libgflags-dev

然后进入pytorch官网 "https://pytorch.org"找到适合自己的pytorch版本,然后根据推荐的指令进行安装即可,在这里我的是 pip3 install torch torchvision
在这里插入图片描述
然后在命令栏中进行安装即可。安装完成之后,进行测试,没有报错,说明安装成功。

oliver@oliver-System-Product-Name:~$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe2
>>> 

当出现No module named ‘past’ 错误之后,进行以下两个命令即可:

pip install future
pip install --upgrade future

当下面测试通过时,说明caffe2的安装配置成功啦~

$ python3 -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Success
$ python3 -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'
1

安装配置detectron

当完成caffe2的环境搭建之后,就可以配置detectron啦~,首先需要把源文件下载到本地

git clone https://github.com/facebookresearch/detectron

然后转到detectorn文件夹内:

pip install -r requirements.txt如果权限不够的话:
pip install --user -r requirements.txt

接着:

make

make完成之后就算配置好detectron啦,下面来测试下,是否配置成功,进入requirements.txt目录下:

python detectron/tests/test_spatial_narrow_as_op.py

出现以下结果即是配置成功:

oliver@oliver-System-Product-Name:~/detectron$ python detectron/tests/test_spatial_narrow_as_op.py
net_drawer will not run correctly. Please install the correct dependencies.
[E init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
Found Detectron ops lib: /home/oliver/.local/lib/python3.6/site-packages/torch/lib/libcaffe2_detectron_ops_gpu.so
...
----------------------------------------------------------------------
Ran 3 tests in 2.160sOK

http://www.taodudu.cc/news/show-1782110.html

相关文章:

  • 【physx/wasm】在physx中添加自定义接口并重新编译wasm
  • excel---常用操作
  • Lora训练Windows[笔记]
  • linux基础指令讲解(ls、pwd、cd、touch、mkdir)
  • InnoDB 事务处理机制
  • 启明云端ESP32 C3 模组WT32C3通过 MQTT 连接 AWS
  • leetcode之字符串中的第一个唯一字符
  • 哈希表中处理冲突的方法
  • SENet算法解析
  • SNIP物体检测算法理解
  • yolov3聚类自己数据的anchor box
  • Ubuntu下安装qt57creator-plugin-ros,在QT中进行ROS开发(亲测有效)
  • ROS下面调用自定义的头文件和.cpp/.so文件(亲测有效)
  • C++调用编译好的darknet来进行物体监测
  • hard-negative mining详细介绍
  • yolov3中如何进行聚类得到anchor box的
  • ubuntu16.04下编译安装Autoware
  • catkin_make和cmake
  • 深度学习三种分割定义
  • 基于激光雷达点云数据的目标检测
  • 递归和循环两种方式求解连续数的相加
  • PCL中把txt文件转换成.pcd文件(很简单)
  • pcl对点云进行直通滤波
  • error: (-205:Formats of input arguments do not match) All the matrices must have the same data type
  • ubuntu16.04下Qt无法输入中文注释
  • ROS下sensor_msgs::ImagePtr到sensor_msgs::Image之间的转换
  • ROS下同时接收多个话题并实现相机和雷达的数据融合
  • 柱状图之最大矩形面积
  • 哈希函数的构造方法以及哈希表解决冲突的方式
  • 回旋镖的数量
  • 伪代码之KMeans和DBSCAN
  • leetcode之有效的括号
  • leetcode之每日温度
  • leetcode之逆波兰表达式
  • leetcode之二叉树的中序遍历
  • 机器学习深度学习面试宝典-深度学习500问