🇺🇸 🇨🇳
This is my bachelor graduation design project, a face recognition service based on SeetaFaceEngine. I also provided the public RESTful API. Check this out!
Clone this project via git
:
$ git clone https://github.com/Mitscherlich/antigen.git
To run this project locally, you need a pc with ubuntu os installed and at least 2GB memory for OpenCV compiling. If you haven't installed opencv yet, I also provide a script to compile an optimized version.
Then, you need Node.js to run this project. Though apt
manager provides a package nodejs
for ubuntu but I suggest nvm
for installation.
Since npm
sometimes generate a wrong dependencies tree, although it is the default package manager came with node.js but yarn
is suggested for this project.
This project uses MongoDB to store user data. You can setup a mongo server instance following their official reference or using docker.
To setup a mongo instance with docker, follow this commands below:
# pull `mongo` docker image
$ docker pull mongo
$ docker run -d --name mongo-srv \
# expose mongo default listening port
> -p 27017:27017
# persistence mongo data
> -v ~/db:/data/db
> mongo
If you want to enable user authorization, pass -e MONGO_INITDB_ROOT_USERNAME=<name>
and -e MONGO_INITDB_ROOT_PASSWORD=<password>
to docker run
command and replace mongo
with mongo --auth
.
SeetaFaceEngine requires opencv and openblas. Since libopencv-dev
not provides the latest version, I suggestion install opencv from it source.
First, you need some system dependencies for compilation:
$ sudo apt-get update
$ sudo apt-get install -fy cmake build-essential dpkg-dev
$ sudo apt-get install -fy libopenblas-dev libprotobuf-dev libssl-dev libgnutls28-dev libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
# not require if you don't need opencv-python
$ sudo apt-get install -fy python-dev python-numpy libjpeg-dev libpng-dev libtiff-dev libjasper-dev
Then you can use the installation script install-opencv.sh
to install an optimized version, or compile a full-function opencv following this commands:
$ mkdir build && cd build
$ cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
$ make -j<jobs> && sudo make install
Jobs usually equals you machine's cpu cores amount times 1.5
Downloads models from here or Baidu Disk for mainland users.
You can start this project in development mode by this command:
$ yarn dev
This uses parcel
bundler and nodemon
for auto restart.
Before you start this project in production mode, you have to build static files:
$ yarn build
Then you can start the server:
$ yarn start
See docs/API-reference.md for more details.
This project also accepts some common options by passing environment variables:
- HOST
String
- The IP address this project will listen. Default is 127.0.0.1. - PORT
String
orNumber
- The port this project will listen. Default is 3000. - BASE_URL
String
- The prefix of router and WebSocket, Default is '/'. - DB_URL
String
- MongoDB server url. Default is 127.0.0.1. - DB_PORT
String
orNumber
- MongoDB server listeing port. Default is 27017. - DB_USER
String
- MongoDB user name. Default is ''. - DB_PSK
String
- MongoDB user password. Default is ''.
This project also provides a docker-compose.yml
for docker setup. Install docker-compose and execute:
$ docker-compose up -d
Then visit http://localhost:3000 in your browser.
That's it! Have your self :)