Skip to content

ptran/siamese-network-ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Siamese Network Example

This repo showcases how to create a Siamese network using the tools provided by the dlib machine learning library (github link). All the layer definition, training, and testing code is in main.cpp.

Embedding Output

The image above shows the embedding learned by the Siamese network using this example. Each plotted circle represents a sample in the test set and the color is determined the number label (e.g. zeroes are the red circles on the upper-left).

Requirements

dlib

  • Minimum Required Version: 19.0
  • Dependencies
    • a C++11-compatible compiler (g++, clang++, etc...)
    • CUDA 7.5
    • cuDNN v5

CMake

  • Minimum Required Version: 2.6

Build

In order to build this project, run the following commands at this repo's root directory.

Linux

    # create a directory to contain all build by-products
    mkdir build
    cd build
    cmake -DDLIB_DIR=$DLIB_ROOT ..
    make && make install

$DLIB_ROOT is the path to the root directory of the dlib library.

Windows

    mkdir build
    cd build
    cmake  -DDLIB_DIR=$DLIB_ROOT ..
    cmake --build . --config release --target install

Instructions

After building and installing this project, first download the MNIST dataset by running download_mnist.sh. This script creates a data directory and downloads the dataset into it. Once the MNIST dataset download is completed, go to the bin directory and run the siamese_network_ex executable.

In the repo's root directory

./download_mnist.sh
cd bin
./siamese_network_ex ../data

This program creates two files: mnist_siamese_network.dat and mnist_siamese_sync. mnist_siamese_network.dat contains the weights of the neural network model and mnist_siamese_sync stores training progress.

About

dlib implementation of Siamese Network Training with Caffe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors