2021-10-31 19:57:10 索炜达电子 870
项目编号:E2033
文件大小:360K
源码说明:带中文注释
开发环境:C编译器
简要概述
可以在本地或云上(在AWS F1实例上)在FPGA上测试人脸检测。该项目与Inacel Coral集成,这意味着示例应用程序可以在FPGA集群上运行,而无需对提供的源代码进行任何更改。
基于单个FPGA的人脸检测
基于FPGA集群的人脸检测
Prerequisites
Docker
InAccel CLI
InAccel Coral-API
OpenCV libraries
You can find instructions on installing docker at https://docs.docker.com/engine/install/. Alternatively, you can install docker using the following command and further on manually configure it to start/enable the service, add your user to the docker group etc.:
curl -sS https://get.docker.com | sh
For a full documentation of the InAccel stack you can refer to https://docs.inaccel.com. To install InAccel CLI you can use the following command
curl -sS https://setup.inaccel.com/repo | sh -s install
Depending on your system you can either use apt or yum to install InAccel Coral API.
sudo apt/yum install coral-api
To install any necessary OpenCV library on Ubuntu you can simply execute the following command:
sudo apt install libopencv-*
For Centos and RedHat you can use the following flow for installing and configuring the OpenCV environment:
git clone https://github.com/opencv/opencv.git && cd opencv && git checkout 3.4.2 && cd ..
mkdir opencv/build && cd opencv/build && cmake .. && make -j && make install && cd ../..
ln -s /usr/local/share/OpenCV/java/libopencv_java342.so /usr/lib/libopencv_java342.so
rm -rf opencv
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
Install a license:
After you have installed all the required packages, you need to configure InAccel. Create a free license using the following link https://inaccel.com/license/. In a few moments you will receive your license at the mail address you provided.
inaccel config license <paste-your-license-here>
Start InAccel:
inaccel start
Install any necessary bitstreams
To run the application on FPGAs you need the right bitstreams. To make face-detection available for Xilinx Alveo U200 install the following bitstream:
https://store.inaccel.com/artifactory/bitstreams/xilinx/u200/xdma_201830.2/edu/cornell/ece/zhang/rosetta/1.4/8face-detect
To use face detection on AWS please install the following bitsteam:
https://store.inaccel.com/artifactory/bitstreams/xilinx/aws-vu9p-f1/dynamic_5.0/edu/cornell/ece/zhang/rosetta/1.1/4face-detect
Run the Face Detection Application
Apart from the FPGA accelerated version we also provide a CPU (reference) version of Viola Jones algorithm. The version is specified using the TARGET variable. TARGET can either be 'hw' or 'sw'.
For example, to generate the binary for the FPGA accelerated version you can issue the following command:
TARGET=hw make
The binary takes any input videos or cameras as arguments. E.g:
./face_detect_hw /path/to/video1 /path/to/video2 ...
目录│文件列表:
└ face-detect
│ Makefile
│ NOTICE
├ hw
│ │ face_detect_save.cpp
│ │ face_detect_view.cpp
│ │ rectangles.cpp
│ │ rectangles.h
│ │ safe_queue.h
│ │ utils.cpp
│ └ utils.h
├ img
│ │ face-detect-cluster.jpg
│ └ face-detect.png
└ sw
│ class.txt
│ face_detect_save.cpp
│ face_detect_view.cpp
│ haar.cpp
│ haar.h
│ image.cpp
│ image.h
│ info.txt
│ rectangles.cpp
│ safe_queue.h
│ stdio-wrapper.cpp
└ stdio-wrapper.h