我正在尝试使用dlib库实现一个程序.我已经能够使用dlib的所有其他文件,除了与jpeg和png相关的文件.
#include "dlib\image_io.h"
#define DLIB_JPEG_SUPPORT
int main(){
dlib::array2d<dlib::rgb_pixel> arr1;
dlib::load_jpeg(arr1,"sailboat1234.jpeg");
}
Run Code Online (Sandbox Code Playgroud)
我已将source.cpp文件和文件中的文件包含在我的项目中dlib/external.此外,我已经包含在c ++ general dlib-18.11包含的文件夹中dlib.最后,该项目在Visual Studio 2012上运行.
编辑:
当我运行程序时错误:error C2027: use of undefined type 'dlib::compile_time_assert<value>'.有任何想法吗?
我实际上是在使用OpenCV进行人脸检测,但在观看了这个视频之后:https://www.youtube.com/watch?v = LsK0hzcEyHI,我注意到dlib更准确,即使在我的测试中,也给出了很多故事肯定(但不会错过任何面孔),有没有人知道如何在Java Web应用程序(而不是Android)中使用dlib?我已经找到了Android的端口,但我不认为可以在java Web应用程序中使用它.谢谢
我正在开发应用程序,我需要在镜像凸轮或化妆凸轮等凸轮上获得面部标记点.我希望它也适用于iOS.请指导我一个强大的解决方案.我用过Dlib和Luxand.
DLIB:https://github.com/tzutalin/dlib-android-app
Luxand:http://www.luxand.com/facesdk/download/
Dlib很慢,大约有2秒的延迟(请查看git页面上的演示视频)和luxand是可以的,但它已付费.我的首要任务是使用开源解决方案.我也使用谷歌的愿景,但他们没有提供太多的面部地标点.所以请给我一个解决方案,使dlib快速工作或任何其他选项保持跨平台的优先级.提前致谢.
在dlib中有一个示例python程序来检测面部地标位置. face_landmark_detection.py
该程序检测面部特征并用原始照片中的点和线表示地标.
我想知道是否有可能获得每个点的坐标位置.像一个(10,25).'a'表示嘴角.
稍微修改程序以一次处理一张图片后,我尝试打印出dets和shape的值而没有成功.
>>>print(dets)
<dlib.dlib.rectangles object at 0x7f3eb74bf950>
>>>print(dets[0])
[(1005, 563) (1129, 687)]
Run Code Online (Sandbox Code Playgroud)
表示面部标志点和参数数据类型的参数仍然未知.这是简化的代码
import dlib
from skimage import io
#shape_predictor_68_face_landmarks.dat is the train dataset in the same directory
predictor_path = "shape_predictor_68_face_landmarks.dat"
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(predictor_path)
win = dlib.image_window()
#FDT.jpg is the picture file to be processed in the same directory
img = io.imread("FDT.jpg")
win.set_image(img)
dets = detector(img)
print("Number of faces detected: {}".format(len(dets)))
for k, d in enumerate(dets):
print("Detection {}: Left: {} Top: {} Right: {} …Run Code Online (Sandbox Code Playgroud) 我正在尝试在NDK中集成OpenCV和dlib-android。我能够同时在单独的项目中使用OpenCV和dlib,但是当两者都集成时,项目就会中断。
这是我对dlib的gradle配置
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
...
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions"
arguments "-DANDROID_PLATFORM=android-16",
"-DANDROID_TOOLCHAIN=clang",
"-DANDROID_STL=c++_shared",
"-DANDROID_CPP_FEATURES=rtti exceptions"
}
}
sourceSets {
main {
jniLibs.srcDirs = ["src/main/jniLibs/dlib/libs"]
}
}
}
...
Run Code Online (Sandbox Code Playgroud)
当我集成openCV时,我得到
未定义引用'cv :: CascadeClassifier :: detectMultiScale'
根据此答案的解决方案是将stl作为gnustl_shared
dlib与gnustl_shared给出类似std::exceptions未找到的错误。
我该如何进行整合?
我试图c++_shared在CMake 上重新编译OpenCV ,但是遇到了
致命错误:iostream:没有这样的文件或目录#include
我正在尝试dlib通过运行以下命令在Anaconda中安装软件包:
conda install -c menpo dlib
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
UnsatisfiableError: The following specifications were found to be in conflict:
- dlib
- zict
Use "conda info <package>" to see the dependencies for each package.
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
在我的面部识别项目的面被表示为如在所使用的128维嵌入(face_descriptor)FaceNet.我可以通过两种方式从图像中生成嵌入.
使用Tensorflow resnet模型v1.
emb_array = sess.run(embedding_layer,
{images_placeholder: images_array, phase_train_placeholder: False})
Run Code Online (Sandbox Code Playgroud)
可以传递图像阵列并获得嵌入列表.这有点慢.看1.6s.(虽然大量图像的时间几乎不变).注意:GPU不可用
其他方法是使用dlib
dlib.face_recognition_model_v1.compute_face_descriptor(image, shape)
Run Code Online (Sandbox Code Playgroud)
这给出了快速的结果.差不多0.05秒.但是一次只能传递一个图像.时间随图像数量的增加而增加.
有没有办法传递图像数组来计算dlib中的嵌入或以任何方式提高dlib的速度?
或者还有其他更快的方法来生成128维面部嵌入?
更新:我将多个图像连接成单个图像并传递给dlib
dlib.face_recognition_model_v1.compute_face_descriptor(big_image, shapes)
Run Code Online (Sandbox Code Playgroud)
即,将具有单个面的多个图像转换为具有多个面的单个图像.静止时间与连接的图像数量(即面部数量)成比例.几乎相同的时间迭代单个图像.
我已经在Ubuntu 16.04上使用cmake 3.11.0编译了dlib 19.10并启用了CUDA 9.1.它进展顺利,没有任何问题!
这里输出的运行 cmake ..
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ …Run Code Online (Sandbox Code Playgroud) 这是我的cmakelists.txt:
project( WolframMachine )
cmake_minimum_required(VERSION 3.1)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_SUPPRESS_REGENERATION true)
include(ExternalProject)
set(Boost_INCLUDE_DIR "C:/boost_1_66_0")
set(Boost_LIBRARY_DIR "C:/boost_1_66_0/lib64-msvc-14.0")
SET("OpenCV_DIR" "C:/opencv-3.4.1/build")
SET(dlib_DIR "C:/dlib-19.13/") # <============ DLIB
find_package( OpenCV COMPONENTS core imgproc highgui aruco optflow plot REQUIRED )
find_package(dlib REQUIRED) # <============ DLIB
add_subdirectory(dlibtest)
Run Code Online (Sandbox Code Playgroud)
跑cmake-gui给了我以下内容:
手动设置dlib_DIR没有帮助.我怎样才能解决这个问题?
UPD:尝试了其他dlib_DIR值但没有成功:
SET(dlib_DIR "C:/dlib-19.13/build/dlib/CMakeFiles/Export/lib/cmake/dlib")
Run Code Online (Sandbox Code Playgroud)
给出同样的错误:
和设置
SET(dlib_DIR "C:/dlib-19.13/build/dlib/config")
Run Code Online (Sandbox Code Playgroud)
给出另一个无意义的错误:
dlib ×10
python ×3
android ×2
c++ ×2
python-3.x ×2
anaconda ×1
android-ndk ×1
cmake ×1
cmake-gui ×1
conda ×1
java ×1
opencv ×1
tensorflow ×1
xml ×1