(原)在anaconda3+ubuntu16.04中编译Pose flow中的deepmatching动态库
转载请注明出处:
https://www.cnblogs.com/darkknightzh/p/11285239.html
参考网址:
https://github.com/YuliangXiu/PoseFlow
http://xiuyuliang.cn/2014/12/05/deepmatching/
1 简介
pose flow可以直接使用,但是需要编译deep matching的文件夹。官方给出的编译步骤如下:
cd deepmatching
make clean all
make python
cd ..
2 makefile
但是直接使用官方的makefile无法编译成功,需要修改一下。
由于这边是用的是anaconda3,下面直接贴出修改后的makefile:
注意:如果直接拷贝可能由于网页原因,把下面28、31、34等这些行前面的tab换成了空格,导致make的时候出错。此时将这些行的空格改成tab即可。
CC=g++ OS_NAME=$(shell uname -s)
ifeq ($(OS_NAME),Linux)
LAPACKLDFLAGS=/home/xxx/anaconda3/lib/libsatlas.so # single-threaded blas #LAPACKLDFLAGS=/usr/lib64/atlas/libtatlas.so # multi-threaded blas
#BLAS_THREADING=-D MULTITHREADED_BLAS # remove this if wrong
endif
ifeq ($(OS_NAME),Darwin) # Mac OS X
LAPACKLDFLAGS=-framework Accelerate # for OS X
endif
LAPACKCFLAGS=-Dinteger=int $(BLAS_THREADING)
STATICLAPACKLDFLAGS=-fPIC -Wall -g -fopenmp -static -static-libstdc++ /home/xxx/anaconda3/lib/libjpeg.a /home/xxx/anaconda3/lib/libpng.a /usr/lib64/libz.a /usr/lib64/libblas.a /usr/lib/gcc/x86_64-redhat-linux/4.9./libgfortran.a /usr/lib/gcc/x86_64-redhat-linux/4.9./libquadmath.a # statically linked version CFLAGS= -fPIC -Wall -g -std=c++ $(LAPACKCFLAGS) -fopenmp -DUSE_OPENMP -O3
LDFLAGS=-fPIC -Wall -g -ljpeg -lpng -fopenmp -lblas
CPYTHONFLAGS=-I/home/xxx/anaconda3/include/python3.6m SOURCES := $(shell find . -name '*.cpp' ! -name 'deepmatching_matlab.cpp')
OBJ := $(SOURCES:%.cpp=%.o)
HEADERS := $(shell find . -name '*.h') all: deepmatching .cpp.o: %.cpp %.h
$(CC) -o $@ $(CFLAGS) -c $+ deepmatching: $(HEADERS) $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS) $(LAPACKLDFLAGS) -L/home/xxx/anaconda3/lib -I/home/xxx/anaconda3/include deepmatching-static: $(HEADERS) $(OBJ)
$(CC) -o $@ $^ $(STATICLAPACKLDFLAGS) python: $(HEADERS) $(OBJ)
# swig -python $(CPYTHONFLAGS) deepmatching.i # not necessary, only do if you have swig compiler
g++ $(CFLAGS) -c deepmatching_wrap.c $(CPYTHONFLAGS)
g++ -shared $(LDFLAGS) $(LAPACKLDFLAGS) deepmatching_wrap.o $(OBJ) -o _deepmatching.so $(LIBFLAGS) -L/home/xxx/anaconda3/lib clean:
rm -f $(OBJ) deepmatching *~ *.pyc .gdb_history deepmatching_wrap.o _deepmatching.so deepmatching.mex???
3 说明
3.1. 虽然STATICLAPACKLDFLAGS也进行了修改,但是由于未编译静态库,因而未进行测试这个是否成功。
3.2. 其他修改主要是设置路径,最主要的是LDFLAGS,增加了-lblas,否则我这边会出错。
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_stop_numeric'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_i4_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_transfer_character'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_compare_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_st_write_done'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_r8_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_concat_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_r4_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_etime'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_copy_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_transfer_integer'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_st_write'
3.3. 另一方面,31行增加了-L/home/xxx/anaconda3/lib,否则提示下面的错(原因是使用的是anaconda3,这些库都是anaconda3里面的,不在系统目录中)。
/usr/bin/ld: cannot find -ljpeg
/usr/bin/ld: cannot find –lpng
若提示找不到头文件,可以在该行-I处添加。
3.4. 将deepmatching_wrap.c中2983行
#include <numpy/arrayobject.h>
修改为
#include </home/xxx/anaconda3/lib/python3./site-packages/numpy/core/include/numpy/arrayobject.h>
这个不记得是哪个参考网址里面给出的了(我这边根据anaconda3的路径重新配置了),见谅。。。
3.5 http://xiuyuliang.cn/2014/12/05/deepmatching/中指出,ubuntu中没有libsatlas.so,按照该网页的第一步,直接将libatlas.a liblapack.a libf77blas.a libcblas.a捏成一个即可。在anaconda3中,这些.a文件均在/home/xxx/anaconda3/lib中,因而在该文件夹中打开终端,而后输入网页中的命令即可(若需复制命令,请移步该网页,此处只是保存个备份,如有侵权,我会删除)。

3.6 在~/.bashrc中添加下面两句(不知道为何3.3中-I添加了include路径,结果还是有错)
export C_INCLUDE_PATH=/home/xxx/anaconda3/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/home/xxx/anaconda3/include:$CPLUS_INCLUDE_PATH
否则找不到jpeglib.h
io.cpp:19:21: fatal error: jpeglib.h: No such file or directory
=================================================================================
190807更新:
3.7 编译成功之后,运行pose flow的matching.py时,若使用deep matching,会提示找不到libjpeg.so.9,原因是其不在系统的目录里面。可以将matching.py的最后一句修改成:
cmd = "LD_LIBRARY_PATH=/home/xxx/anaconda3/lib ./deepmatching/deepmatching %s %s -nt 10 -downscale 3 -out %s/%s_%s.txt > cache"%(img1,img2,vidname,img1_id,img2_id)
之后便可以成功使用deep matching。
190807更新结束
=================================================================================
(原)在anaconda3+ubuntu16.04中编译Pose flow中的deepmatching动态库的更多相关文章
- Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件)
Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件) https://blog.csdn.net/woainishifu/article/details/79712110 我们在做项 ...
- 在ubuntu16.04上编译android源码【转】
本文转载自:http://blog.csdn.net/fuchaosz/article/details/51487585 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6. ...
- Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)
Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...
- 动态库与静态库的学习 博主写的很好 静态库 编译的时候 需要加上 static 动态库编译ok运行不成功就按照文章中的方法修改
来源连接 http://www.cnblogs.com/skynet/p/3372855.html C++静态库与动态库 这次分享的宗旨是--让大家学会创建与使用静态库.动态库,知道静态库与动态库 ...
- ubuntu16.04下编译ceres-solver
一.编译环境 ubuntu16.04 二.准备工作之安装必要的库 2.1安装cmake sudo apt-get install cmake 2.2 安装google-glog + gflags su ...
- Ubuntu16.04下编译android6.0源码
http://blog.csdn.net/cnliwy/article/details/52189349 作为一名合格的android开发人员,怎么能不会编译android源码呢!一定要来一次说编译就 ...
- ubuntu16.04下编译安装vim8.1
之前写过一篇centos7下编译安装vim8.0的教程,ubuntu16.04相比centos7下安装过程不同在于依赖包名字的不同,其余都是一样.下面给出ubuntu16.04编译安装vim8.0需要 ...
- Ubuntu16.04下编译安装及运行单目ORBSLAM2
官网有源代码和配置教程,地址是 https://github.com/raulmur/ORB_SLAM2 1 安装必要工具 首先,有两个工具是需要提前安装的.即cmake和Git. sudo apt- ...
- 关于jni编译32位、64位动态库(Android.mk和Application.mk文件)
最近新项目需要编译64位的动态库,这里记录如何配置. 在jni目录下加入Android.mk和Application.mk文件. Application.mk APP_ABI := armeabi a ...
随机推荐
- 洛谷 U86501 趣味擂台
洛谷 U86501 趣味擂台 题目传送门 题目背景 \(JDFZ\)\(2019\)秋季运动会开始辣!运动会中有一个叫做"趣味擂台"的游戏...... 题目描述 游戏内容是这样的: ...
- C++中#define与typedefine的区别
原文链接:https://www.cnblogs.com/fengfengqingqingyangyang/p/3270432.html (1)typedef是用来定义关键字/标识符的别名,并未分配内 ...
- 【oracle】存储过程中获取delete语句执行后删除的记录数
dbms_output.put_line(to_char(sql%rowcount));
- 两个开源的 Spring Boot + Vue 前后端分离项目
折腾了一周的域名备案昨天终于搞定了. 松哥第一时间想到赶紧把微人事和 V 部落部署上去,我知道很多小伙伴已经等不及了. 1. 也曾经上过线 其实这两个项目当时刚做好的时候,我就把它们部署到服务器上了, ...
- C语言 某数输出二进制的某位
如题: 输入一个整数,截取它对应的二进制位中从右到左的第8-11位(最右边为第0位). **输入格式要求:"%d" 提示信息:"请输入一个整数:" **输出格式 ...
- IAR环境搭建
工具下载:https://pan.baidu.com/s/1nwv0RVz 第一步:右键点击EW8051-EV-8103-Web.exe,使用管理员权限运行. 第二步:我们运行之后只要一直Next下去 ...
- [LeetCode] 352. Data Stream as Disjoint Intervals 分离区间的数据流
Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen ...
- 【对不同形式矩阵的总结】WC 2009 最短路径问题(线段树+矩阵乘法)
题意 题目链接:https://www.luogu.org/problem/P4150 一个 \(6\times n\) 的网格图,每个格点有一个初始权值.有两种操作: 修改一个格子的权值 求 ...
- Elasticsearch由浅入深(八)搜索引擎:mapping、精确匹配与全文搜索、分词器、mapping总结
下面先简单描述一下mapping是什么? 自动或手动为index中的type建立的一种数据结构和相关配置,简称为mappingdynamic mapping,自动为我们建立index,创建type,以 ...
- mnist数据集探究
一.mnist的属性和方法 为了方便我只检查了后20个属性和方法 from tensorflow.examples.tutorials.mnist import input_data mnist = ...