Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


BearID Project code repository. For more information, read the hypraptive blog.


  • dlib (tested with version 19.16) - download and install somewhere. You should have OpenCV and CUDA and other packages which are helpful for dlib.
  • boost (tested with version 1.58.0)


Uses cmake flow:

git clone
cd bearid
mkdir build
cd build
cmake -DDLIB_PATH=<path_to_dlib> ..
cmake --build . --config Release


How to run end-to-end inferencing using or each of it's components individually.

Running bearid

Use the python 3 script to predict the bear identities from a set of images.

The script expects all of the binaries and networks to be in the same directory as the script. If, for example, you cloned and built bearid as ~/bearid and cloned the models as ~/bearid-models, you can:

mkdir ~/tools
cp ~/bearid/ ~/tools
cp ~/bearid/build/bear* ~/tools
cp ~/bearid-models/*.dat ~/tools

Then you can run:

~/tools/ <image_file/directories>

Intermediate results and log files will be written to the current working directory. Progress messages and final results are printed to standard out.

Running each component

Use the imglab and the C++ bearid components:

  • Imglab (from dlib) - create an XML file containing all source images
    • imglab -c <source_img_file> <image files/directories>
  • Bearface - find bear faces and face landmarks
    • ./bearface --infer <bearface_network_file> <source_img_file>
  • Bearchip - align and crop bear faces and produce bear chips
    • ./bearchip [-root <img_root_dir>] <face_metadata_file>
  • Bearembed - generate a 128D embedding from bear chips
    • ./bearembed --embed <bearembed_network_file> --anet <chip_metadata_file>
  • Bearsvm - classify set of embeddings using SVM one-vs-one classifier
    • ./bearsvm --infer <bearsvm_network_file> <embed_metadata_file>


There are python tools and scripts in the tools directory for managing datasets and evaluating results.


For pre-trained network files, see: bearid-models.