Open zoldaten opened 1 year ago
Please take a look at the table we have in readme: https://github.com/ShiqiYu/libfacedetection#cnn-based-face-detection-on-arm-linux-raspberry-pi-4-b.
time = 607.191ms
Your data is close to what we have (404.63ms) in single-threaded mode.
-DUSE_OPENMP=OFF
You turned off openmp for some reason, which damaged the performance.
if i use -DUSE_OPENMP=ON i cant compile examples:
pi@raspberrypi:~/libfacedetection/example/build $ make
[ 25%] Linking CXX executable detect-image
/usr/bin/ld: /usr/local/lib/libfacedetection.a(facedetectcnn.cpp.o): undefined reference to symbol 'omp_get_num_threads@@OMP_1.0'
/usr/bin/ld: //usr/lib/arm-linux-gnueabihf/libgomp.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/detect-image.dir/build.make:137: detect-image] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/detect-image.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
ok. fixed that. correct CMakeLists.txt for examples:
cmake_minimum_required( VERSION 2.8 )
project( example )
find_package( OpenCV REQUIRED )
message(STATUS "OpenCV_LIBS = ${OpenCV_LIBS}")
include_directories( ${OpenCV_INCLUDE_DIRS} )
FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
add_executable( detect-image detect-image.cpp )
add_executable( detect-camera detect-camera.cpp )
target_link_libraries( detect-image ${OpenCV_LIBS} )
#target_link_libraries( detect-image /libfacedetection/build/install/lib/libfacedetection.so )
target_link_libraries( detect-image /usr/local/lib/aarch64-linux-gnu/libfacedetection.a )
#target_link_libraries( detect-image /opencv/build/lib/libopencv_highgui.a )
target_link_libraries( detect-image /usr/local/lib/aarch64-linux-gnu/libopencv_highgui.so )
target_link_libraries( detect-image /usr/local/lib/aarch64-linux-gnu/libopencv_imgproc.so )
target_link_libraries( detect-image /usr/local/lib/aarch64-linux-gnu/libopencv_core.so )
target_link_libraries( detect-image /usr/local/lib/aarch64-linux-gnu/libopencv_imgcodecs.so )
target_link_libraries( detect-camera ${OpenCV_LIBS} )
#target_link_libraries( detect-camera /libfacedetection/build/install/lib/libfacedetection.so )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libfacedetection.a )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libopencv_highgui.so )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libopencv_video.so )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libopencv_imgproc.so )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libopencv_core.so )
target_link_libraries( detect-camera /usr/local/lib/aarch64-linux-gnu/libopencv_videoio.so )
*i also tested on aarch64 (Raspbian bullseye).
here is the line to build the main library (not examples):
cmake -DENABLE_NEON=ON -DCMAKE_BUILD_TYPE=RELEASE -DUSE_OPENMP=ON -DENABLE_AVX2=OFF -DDEMO=OFF -DCMAKE_CXX_FLAGS:STRING="-march=armv8-a -mtune=cortex-a72 -Wno-psabi" -DCMAKE_C_FLAGS:STRING="-march=armv8-a -mtune=cortex-a72 -Wno-psabi" -DCMAKE_ASM_FLAGS:STRING="-march=armv8-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a72 -g" ../
so. with OPENMP enabled i got
time = 249.999ms for 640x480 image.
have no idea how you got better results...
i`ve just successfully built library and examples on raspberry pi. so i would like to share instructions to reproduce:
it works but i dont think fast enough:
is it good result for edge device ?