SeetaFace2-master 编译example出现/usr/lib/libgdal.so.20: undefined reference to `sqlite3_column_orig错误解决

最近在学习深度学习,刚好中科视拓开源了SeetaFace2.0的源码,于是从github下载下来,学习一下

源码的位置:

https://github.com/seetafaceengine/SeetaFace2

一、下载源码

点击上面的源码链接进行下载,下载之后的压缩包为SeetaFace2-master.zip

二、解压代码zip包,阅读README.md文档

解压之后,会在SeetaFace2-master目录下看到 README.md文档,根据文档指引完成初始编译

三、着手开始编译

1. 安装opencv

文档中说明,如果要编译example 需要准备好opencv环境,于是开始找到最新的opencv 源代码包

opencv 下载包,链接:https://opencv.org/releases/

我选择了最新的4.1.1版本,同时需要去下载opencv_contrib-4.1.1.zip,

下载地址:https://github.com/opencv/opencv_contrib/releases

下载好之后,把两个zip放在同级目录开始安装,这里我新建了一个目录,方便管理

mkdir opencv4.1

cd opencv4.1

mv ../../opencv-4.1.1.zip ../../opencv_contrib-4.1.1.zip .

unzip opencv-4.1.1.zip

unzip opencv_contrib-4.1.1.zip

mv opencv-4.1.1 opencv

mv opencv_crontrib-4.1.1 opencv_crontrib

进入opencv目录开始编译,这里添加了扩展模块opencv_crontrib的编译,命令如下:

cd opencv

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -D OPENCV_GENERATE_PKGCONFIG=YES -D WITH_1394=ON ..

完成之后,执行make 进行编译,我使用 make -j2 毕竟电脑性能一般,使用make -j8 会直接卡死(已尝试,性能好的可以尝试哈,会快一些)

完成之后执行 sudo make install    

再执行  sudo ldconfig

然后添加环境变量PKG_CONFIG_PATH~/.bashrc

PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

保存之后,执行source .bashrc

2. 测试opencv是否安装成功

通过编译一个例子程序来验证安装成功。

$ cd ..
$ cd opencv/samples/cpp/example_cmake
$ cmake .
$ make

这里出现错误了

错误如下:

Scanning dependencies of target opencv_example
[ 50%] Building CXX object CMakeFiles/opencv_example.dir/example.cpp.o
[100%] Linking CXX executable opencv_example
//usr/lib/libgdal.so.20: undefined reference to `sqlite3_column_origin_name'
//usr/lib/libgdal.so.20: undefined reference to `sqlite3_column_table_name'
collect2: error: ld returned 1 exit status
CMakeFiles/opencv_example.dir/build.make:135: recipe for target 'opencv_example' failed
make[2]: *** [opencv_example] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/opencv_example.dir/all' failed
make[1]: *** [CMakeFiles/opencv_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

查找了各种帖子没有解决,最后觉得可能是opencv 版本不对或者冲突,于是查看opencv的版本

执行如下命令

pkg-config --modversion opencv 

显示的是  3.2 

问题就在这里了,我安装的是4.1.1 不是这个版本,于是先把就的卸载

sudo apt-get remove --prue libopencv-dev

然后修改opencv.pc为新版本的

sudo cp /usr/local/lib/pkgconfig/opencv4.pc   /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc

完成之后再查看opencv的版本

pkg-config --modversion opencv  显示的是4.1.1 ,OK

继续调试,发现错误没有解决,于是我把usr/lib/libgdal.so.20 这个文件 重命名usr/lib/libgdal.so.20-bk

编译提示,需要链接opecv的库文件,于是做如下操作

sudo ln -s /usr/local/lib/libopencv_core.so.4.1 /usr/lib/libgdal.so.20

android@U-NSGWD180025:/$ ll /usr/lib/libgdal.so.20
lrwxrwxrwx 1 root root 36 Sep  5 16:16 /usr/lib/libgdal.so.20 -> /usr/local/lib/libopencv_core.so.4.1

再进行测试,结果OK

android@U-NSGWD180025:/data/tools/opencv4.1.1/opencv/samples/cpp/example_cmake$ make
Scanning dependencies of target opencv_example
[ 50%] Building CXX object CMakeFiles/opencv_example.dir/example.cpp.o
[100%] Linking CXX executable opencv_example
[100%] Built target opencv_example

 

3. 编译SestaFaces2

   结果编译成功,产生了bin目录并生成了 对应的可执行文件

cd SeetaFace2-master
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DBUILD_EXAMPLE=ON # 如果有 OpenCV,则设置为 ON
cmake --build .


android@U-NSGWD180025:/data/workspace/MYNOTE/FaceRecognition/SeetaFace2-master/build$ cmake --build .
-- == BUILD_VERSION: v2.5.5
-- Found OpenCV: /usr/local (found version "4.1.1") 
-- == Build detector: ON
-- == Build landmarker: ON
-- == Build recgnizer: ON
-- == Build example: ON
-- == Build shared library: ON
-- == PLATFORM: x86_64
-- Configuring done
-- Generating done
-- Build files have been written to: /data/workspace/MYNOTE/FaceRecognition/SeetaFace2-master/build
[ 36%] Built target SeetaNet
[ 52%] Built target SeetaFaceDetector
[ 68%] Built target SeetaFaceLandmarker
[ 89%] Built target SeetaFaceRecognizer
Scanning dependencies of target points81
[ 92%] Building CXX object example/points81/CMakeFiles/points81.dir/example.cpp.o
[ 94%] Linking CXX executable ../../bin/points81
[ 94%] Built target points81
Scanning dependencies of target search
[ 97%] Building CXX object example/search/CMakeFiles/search.dir/example.cpp.o
[100%] Linking CXX executable ../../bin/search
[100%] Built target search


android@U-NSGWD180025:/data/workspace/MYNOTE/FaceRecognition/SeetaFace2-master/build/bin$ ll
total 280
drwxr-xr-x  3 android android   4096 Sep  5 16:59 ./
drwxr-xr-x 11 android android   4096 Sep  5 17:50 ../
drwxr-xr-x  2 android android   4096 Sep  5 16:59 model/
lrwxrwxrwx  1 android android     15 Sep  5 16:25 points81 -> points81-v2.5.5*
-rwxr-xr-x  1 android android  92408 Sep  5 16:25 points81-v2.5.5*
lrwxrwxrwx  1 android android     13 Sep  5 16:25 search -> search-v2.5.5*
-rwxr-xr-x  1 android android 179008 Sep  5 16:25 search-v2.5.5*
android@U-NSGWD180025:/data/workspace/MYNOTE/FaceRecognition/SeetaFace2-master/build/bin$

接下来就下载模型进行测试,这部分也有给出的,可以下载使用,总之上面的错误困扰了我两天,记录下来~

为了更好地让开发者继续开发工作,官方已提供下载模型的渠道:

1. 人脸检测模块 FaceDetector 模型下载链接:

  • MD5 :E88669E5F1301CA56162DE8AEF1FD5D5
  • 百度网盘:https://pan.baidu.com/s/1Dt0M6LXeSe4a0Pjyz5ifkg 提取码:fs8r
  • Dropbox : https://www.dropbox.com/s/cemt9fl48t5igfh/fd_2_00.dat?dl=0

2. 面部特征 5 点定位模块 FaceLandmarker 模型下载链接:

  • MD5 :877A44AA6F07CB3064AD2828F50F261A
  • 百度网盘:https://pan.baidu.com/s/1MqofXbmTv8MIxnZTDt3h5A 提取码:7861
  • Dropbox : https://www.dropbox.com/s/noy8tien1gmw165/pd_2_00_pts5.dat?dl=0

3. 面部特征 81 点定位模块 FaceLandmarker 模型下载链接:

  • MD5 :F3F812F01121B5A80384AF3C35211BDD
  • 百度网盘:https://pan.baidu.com/s/1CCfTGaSg_JSY3cN-R1Myaw 提取码:p8mc
  • Dropbox : https://www.dropbox.com/s/v41lmclaxpwow1d/pd_2_00_pts81.dat?dl=0

4. 人脸特征提取和比对模块 FaceRecognizer 模型下载链接:

  • MD5 :2D637AAD8B1B7AE62154A877EC291C99
  • 百度网盘:https://pan.baidu.com/s/1y2vh_BHtYftR24V4xwAVWg 提取码:pim2
  • Dropbox : https://www.dropbox.com/s/6aslqcokpljha5j/fr_2_10.dat?dl=0

你可能感兴趣的:(ubuntu,SeetaFace2.0)