Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 2.44 KB

README.md

File metadata and controls

106 lines (74 loc) · 2.44 KB

Jdlib

Java Wrapper For dlib for Linux and MacOSX. Till now the wrapper contains stubs for face HOG detector, facial landmarks, face embedding models.

Fork Note

This is a fork of jdlib which was initially created by Taha Emara.

This fork supports a way to run the CNN based face detection which can utilize the GPU.

Demo

Face Clustering Example

Using Jdlib

<dependency>
  <groupId>io.metaloom.jdlib</groupId>
  <artifactId>jdlib</artifactId>
  <version>2.1.0</version>
</dependency>

Compiling Jdlib

Requirements:

Debian 11:

* nvidia-cuda-toolkit
* nvidia-cudnn 

Clone project:

git clone https://github.com/metaloom/jdlib.git

Compile JNI/C++ code:

# Generate needed JNI header files via mvn
mvn clean compile

# Now build JNI lib
mkdir -p build && cd build

# Ensure to select a compatible compiler (Example for Debian 11)
export JAVA_HOME=/opt/jvm/java17
CC=gcc-13 CXX=/usr/bin/g++-13 cmake ../jni
make 

Compile Java Package:

mvn clean package

After that you will have the JAR file including the binaries for your platform inside Jdlib/target. Then you can use it inside your project as an external jar or install it manually in local maven.

Compiling and running examples

  • Download needed models to example folder
cd examples
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
wget http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2
wget http://dlib.net/files/mmod_human_face_detector.dat.bz2

bzip2 -dk shape_predictor_68_face_landmarks.dat.bz2
bzip2 -dk dlib_face_recognition_resnet_model_v1.dat.bz2
bzip2 -dk mmod_human_face_detector.dat.bz2
  • Build and run examples
cd examples
mvn clean package
java -jar target/clustering-example-jar-with-dependencies.jar
java -jar target/landmarks-example-jar-with-dependencies.jar
java -jar target/cnn-facedetect-example-jar-with-dependencies.jar

Releasing

# Set release version and commit changes
mvn versions:set -DgenerateBackupPoms=false
git add pom.xml ; git commit -m "Prepare release"

# Invoke release
mvn clean deploy -Drelease