算法DDFD的caffe实现:速度是超级的慢,要看缩放的尺度:
https://github.com/LouieYang/caf_face_detection
caffe使用的CMaklists的模板,和SRC的源文件放在一起:
其中cafferoot=/home/code/caffe/caffe-master:
opencvroot =/home/code/opencv/opencv2.4.9
cmake_minimum_required (VERSION 2.8)
project (face_detection)
add_executable(face_detection data_transformer.hpp face_detection.cpp face_detection.hpp main.cpp)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
include_directories (/cafferoot/include
/usr/local/include
/usr/local/cuda/include
/usr/include)
target_link_libraries(face_detection /cafferoot/build/lib/libcaffe.so
/usr/local/lib/libglog.so.0
/usr/lib/x86_64-linux-gnu/libboost_system.so
/opencvroot/build/lib/libopencv_highgui.so
/opencvroot/build/lib/libopencv_core.so
/opencvroot/build/lib/libopencv_imgproc.so
)
DDFD 算法分类精度较差,图像如果较大,并且缩放的尺度较多,则会出现速度较慢,并且人脸检测框会出现偏移!
DDFD采用Alex网络来训练网络,使用的过程中,输入的窗口都是227*227,输入到网络,最后得到一个二值0或者1,得到一张记录的map图;热图点的位置激活,这样就得到一张热图;不同的尺度得到不同的热图,最后在原图上得到不同尺度的框,不同的框有不同的score值,最后采用NMS来得到最好的人脸!