Skip to content

how to build on armv7l raspberry pi 4b raspbian buster - code share #355

Description

@zoldaten

i`ve just successfully built library and examples on raspberry pi.
so i would like to share instructions to reproduce:

 git clone https://github.com/ShiqiYu/libfacedetection.git

cd libfacedetection
mkdir build && cd build

cmake -DENABLE_NEON=ON -DCMAKE_BUILD_TYPE=RELEASE -DUSE_OPENMP=OFF -DENABLE_AVX2=OFF -DDEMO=OFF -DCMAKE_CXX_FLAGS:STRING="-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a72 -Wno-psabi" -DCMAKE_C_FLAGS:STRING="-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a72 -Wno-psabi" -DCMAKE_ASM_FLAGS:STRING="-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a72 -g" ..

*Replace -mtune=cortex-a15 with -mtune=cortex-a53 for RPi3 and -mtune=cortex-a72 for RPi4.

make
sudo make install

cd ..
cd example

nano CMakeLists.txt
cmake_minimum_required( VERSION 2.8 )
project( example )
find_package( OpenCV REQUIRED )
message(STATUS "OpenCV_LIBS = ${OpenCV_LIBS}")
include_directories( ${OpenCV_INCLUDE_DIRS} )
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 /home/al/Desktop/projects/libfacedetection/build/install/lib/libfacedetection.so )
#target_link_libraries( detect-image /opencv/build/lib/libopencv_highgui.a )
target_link_libraries( detect-image /usr/local/lib/libopencv_highgui.so )
target_link_libraries( detect-image /usr/local/lib/libopencv_imgproc.so )
target_link_libraries( detect-image /usr/local/lib/libopencv_core.so )
target_link_libraries( detect-image /usr/local/lib/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 /home/al/Desktop/projects/libfacedetection/build/install/lib/libfacedetection.a )
target_link_libraries( detect-camera /usr/local/lib/libopencv_highgui.so )
target_link_libraries( detect-camera /usr/local/lib/libopencv_video.so )
target_link_libraries( detect-camera /usr/local/lib/libopencv_imgproc.so )
target_link_libraries( detect-camera /usr/local/lib/libopencv_core.so )
target_link_libraries( detect-camera /usr/local/lib/libopencv_videoio.so )

nano detect-camera.cpp
	/home/pi/libfacedetection/src/facedetectcnn.h
nano detect-image.cpp
	/home/pi/libfacedetection/src/facedetectcnn.h

nano /home/pi/libfacedetection/src/facedetectcnn.h
	/home/pi/libfacedetection/build/facedetection_export.h
mkdir build
cd  build
cmake ..
make

./detect-image image.jpg

it works but i dont think fast enough:

./detect-image img_640x480.jpg 
time = 607.191ms
2 faces detected.
face 0: confidence=91, [171, 265, 35, 48] (179,285) (195,285) (186,295) (181,301) (193,302)
face 1: confidence=34, [446, 207, 56, 67] (460,230) (481,230) (467,241) (461,254) (477,252)

is it good result for edge device ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions