This repository is a TensorFlow2 implementation of ProtoNet (Prototypical Network) and its applications, aiming for creating a tool in zero/few-shot learning task that can be easily extended to other datasets or used in building projects. It includes
- source code of ProtoNet and its configuration (multiple GPUs training, inference and evaluation);
- source code of data (ProtoNet's inputs) generator using multiple CPU cores;
- source code of two backbones: conv4 (original in paper) and resnet;
- source code of utilities such as image preprocessing and dataset.
- Recognize Jason Bourne! By using detections obtained from RetinaNet for Object Detection and the below face recognizer, we are able to track Jason Bourne.
bourne_540.mp4
Scenes are taken from The Bourne Ultimatum (2007 film) and the cover page is from The Bourne Identity (2002 film).
- By just learning few face images from a random person, the model is able to identify and recognize that person effectively from a group of people. Below are samples tested on the CelebA dataset.
3-shot | time (second) | mean (F1-score) | median (F1-score) |
---|---|---|---|
1-way, 15-query | 0.04 | 0.91 | 1.0 |
1-way, 100-query | 0.17 | 0.82 | 0.83 |
python 3.7.9
, tensorflow 2.3.1
, matplotlib 3.3.4
, numpy 1.19.2
, scikit-image 0.17.2
and scikit-learn 0.23.2
- Snell et al., Prototypical Networks for Few-shot Learning, https://arxiv.org/abs/1703.05175, 2017