• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Lua
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TripletLoss used in Google's FaceNet paper

TripletEmbedding Criterion

This aims to reproduce the loss function used in Google's FaceNet paper.

criterion = nn.TripletEmbeddingCriterion([alpha])

The cost function can be expressed as follow

loss({a, p, n}) = 1/N \sum max(0, ||a_i - p_i||^2 + alpha - ||a_i - n_i||^2)

where a, p and n are batches of the embedding of ancore, positive and negative samples respectively.

If the margin alpha is not specified, it is set to 0.2 by default.

Test

In order to test the criterion, someone can run the test script as

th test.lua

which shows how to use the criterion and checks the correctness of the gradient.

Training

The folder xmp contains two examples which show how a network can be trained with this criterion.

  • recycle-embedding recycles the embedding of the positive and negative sample from the previous epoch (faster training, less accurate)
  • fresh-embedding computes the updated embedding of all ancore, positive and negative training samples (correct algorithm, thrice slower)

Triplet construction

The folder data contains a package for generating triplets to feed to a network.

To test the data script, run data-test.lua, but you need to have a dataset in the format described in data.lua. In this same file is provided a snippet from the training script.

More Repositories

1

NYU-DLSP20

NYU Deep Learning Spring 2020
Jupyter Notebook
6,663
star
2

NYU-DLSP21

NYU Deep Learning Spring 2021
Jupyter Notebook
1,546
star
3

torch-Video-Tutorials

Light your way in Deep Learning with Torch πŸ”¦
Lua
592
star
4

pytorch-CortexNet

PyTorch implementation of the CortexNet predictive model
Jupyter Notebook
362
star
5

pytorch-PPUU

Code for Prediction and Planning Under Uncertainty (PPUU)
Jupyter Notebook
199
star
6

pytorch-Video-Tutorials

The versatility of Python 🐍 enlightened by Torch πŸ”¦ to seize Deep Learning
129
star
7

SP19-DL-collaborative-notes

Collaborative lecture notes for Spring '19 NYU DL class
TeX
116
star
8

torch-Developer-Guide

Some advanced tricks with Torch7 explained easily
Lua
94
star
9

torch-Machine-learning-with-Torch

Collection of simple machine learning algorithms for Torch
Lua
54
star
10

NYU-DLFL22

NYU Deep Learning Fall 2022
Jupyter Notebook
52
star
11

NYU-AISP24

NYU Artificial Intelligence Spring 2024
45
star
12

atcold.github.com

HTML
24
star
13

Unix-dot-files

Mac OS X and Linux optimal configuration files
Shell
19
star
14

DLSP20-collaborative-notes

19
star
15

torch-net-toolkit

A simple module for <Torch7> and the <nn> package
Lua
18
star
16

stylish-Dark-Themes

Missing Dark Themes for the Stylish platform
CSS
10
star
17

tex-Learning-TikZ

TeX
9
star
18

torch-Torch7-tools

This would be a collection of useful routines and function currently missing in Torch7
Lua
9
star
19

torch-pretty-nn

Brings some colour to the boring `nn` package of Torch.
Lua
7
star
20

torch-INRIA

Loads face, torso, body and background samples from INRIA dataset
Lua
5
star
21

SOTA-models

State Of The Art deep neural network models
Lua
5
star
22

ino-ESP32

Project repository for ESP32
C++
4
star
23

jn-web-app

Fiddling with Jupyter notebook and web apps
Jupyter Notebook
3
star
24

python-AMC-IMDB-ratings

Getting IMDB ratings for AMC movies
Python
3
star
25

Figures-Yann

Figures for Yann's book
Jupyter Notebook
2
star
26

web-Learning-WEB-technology

Some working examples for JS, CSS, and HTML
HTML
2
star
27

tex-History-timelines

A few timelines in TikZ
TeX
1
star
28

smartEYE

Implementation of the VADNN article
Lua
1
star