Skip to content

metaloom/jdlib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.0.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 build && cd build

# Ensure to select a compatible compiler (Example for Debian 11)
CC=gcc-10 CXX=/usr/bin/g++-10 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

About

Jdlib a Java Wrapper For dlib

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 67.5%
  • Java 29.7%
  • CMake 2.8%