PoseFlow-master+Ubuntu14.0.4配置遇到的问题

GitHub:https://github.com/MVIG-SJTU/AlphaPose/tree/master/PoseFlow

paper:Pose Flow: Efficient Online Pose Tracking

论文阅读:https://blog.csdn.net/m0_37644085/article/details/83038566

在Alpha pose中使用了poseflow进行pose tracking,而poseflow中在匹配的过程中使用了deep matching进行匹配。deep matching原本在fedora下配置,在Ubuntu下安装时会遇到各种问题,下面介绍其在Ubuntu下的编译安装方法。

一:DeepMatching

    • 安装
      • 错误1:“找不到/usr/lib64/atlas/libsatlas.so文件”
      • 错误2:关于gfortran的未定义的引用
      • 错误3:一堆库不太对,如usr/lib/x86_64-linux-gnu/libjpeg.a
      • so最终我用的是下面版本
    • 运行

DeepMatching主页:http://lear.inrialpes.fr/src/deepmatching/

安装

下载安装了其中的CPU版本:
Version 1.2.2
1. 下载压缩包:
deepmatching_1.2.2.zip
2. 解压开后

make clean all

一直出现错误:(这里错误是deepmatching文件夹下的makefile引起的)
下面是具体错误,最终可以使用的makefile版本往下拖拖拖。。。

错误1:“找不到/usr/lib64/atlas/libsatlas.so文件”

g++: error: /usr/local/atlas/lib/libsatlas.so: No such file or directory
make: *** [deepmatching] Error 1

所以,借鉴大家的智慧:
参考:https://blog.csdn.net/xczexcel/article/details/79574740
http://xiuyuliang.cn/2014/12/05/deepmatching/

#先装库:(一般都装过)
sudo apt-get install libatlas_dev#我找不到libatlas_dev文件  可以安装libatlas-dev
sudo apt-get install libatlas_base_dev

#然后查找libcblas.a等的路径,转到路径/usr/lib下:

sudo ld -shared -o libsatlas.so --whole-archive libatlas.a liblapack.a --no-whole-archive libf77blas.a libcblas.a

#修改 makefile 文件:
LAPACKLDFLAGS=/usr/lib64/atlas/libsatlas.so
改为LAPACKLDFLAGS=/usr/lib/libsatlas.so

 错误2:关于gfortran的未定义的引用

#修改第24行,改为静态编译
    all: deepmatching 改为 all: deepmatching-static   

错误3:makefile大概13行一堆库不太对,如usr/lib/x86_64-linux-gnu/libjpeg.a

并修改以下静态链接的地址,我的地址如下,请确保安装了所有的库,并且路径正确,特别是libgfortran.a,libquadmath.a的路径在gcc下面,务必找到对应的文件以及其位置

改为:
STATICLAPACKLDFLAGS=-fPIC -Wall -g -fopenmp -static -static-libstdc++ /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib/x86_64-linux-gnu/libpng.a /usr/lib/x86_64-linux-gnu/libz.a /usr/lib/libblas.a /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a /usr/lib/gcc/x86_64-linux-gnu/4.8/libquadmath.a

so最终makefile:(可复制粘贴 替换原)

CC=g++

OS_NAME=$(shell uname -s)
ifeq ($(OS_NAME),Linux)
  LAPACKLDFLAGS=/usr/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++ /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib/x86_64-linux-gnu/libpng.a /usr/lib/x86_64-linux-gnu/libz.a /usr/lib/libblas.a /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a /usr/lib/gcc/x86_64-linux-gnu/4.8/libquadmath.a # statically linked version

CFLAGS= -fPIC -Wall -g -std=c++11 $(LAPACKCFLAGS) -fopenmp -DUSE_OPENMP -O3
LDFLAGS=-fPIC -Wall -g -ljpeg -lpng -fopenmp
CPYTHONFLAGS=-I/usr/include/python2.7
LIBFLAGS= -L/lib/x86_64-linux-gnu -lpng -ljpeg -lz -lblas
SOURCES := $(shell find . -name '*.cpp' ! -name 'deepmatching_matlab.cpp')
OBJ := $(SOURCES:%.cpp=%.o)
HEADERS := $(shell find . -name '*.h')


all: deepmatching-static

.cpp.o:  %.cpp %.h
    $(CC) -o $@ $(CFLAGS) -c $+

deepmatching: $(HEADERS) $(OBJ)
    $(CC) -o $@ $^ $(LDFLAGS) $(LAPACKLDFLAGS)

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)

clean:
    rm -f $(OBJ) deepmatching *~ *.pyc .gdb_history deepmatching_wrap.o _deepmatching.so deepmatching.mex???

运行

1.此时可以愉快的在/deepmatching

make clean all

make python

python

import deepmatching

2.matlab有libsatlas.so的各种问题,最后使用的python版本的
按照README(在deepmatching下)

make python

import deepmatching as dm
dm.deepmatching() # show some help about options
from PIL import Image
import numpy as np
img1 = np.array(Image.open('liberty1.png'))
img2 = np.array(Image.open('liberty2.png'))
matches = dm.deepmatching( img1, img2, '-downscale 2 -v' )

遇到了一点小问题,把原本deepmatching.py中116行

# if None in (im1,im2):
#   usage_python()
#   return
改为:
if im1 is None or im2 is None:
    usage_python()
    return

--------------------- 本文来自 猪肉粒 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/zhubaoguai/article/details/81286875?utm_source=copy

你可能感兴趣的:(遇到的问题,追踪)