Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-Supervised Learning #221

Merged
merged 200 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
226f305
SSL initial working implementation
ebursztein Oct 16, 2021
ceabe5b
Self supervised initial version
ebursztein Oct 18, 2021
be2df5f
version bump
ebursztein Oct 18, 2021
c5b2248
Merge branch 'master' into development
owenvallis Oct 19, 2021
5b41e6f
Add dev suffix to version number.
owenvallis Oct 19, 2021
76b7ca7
Merge branch 'master' into development
owenvallis Oct 19, 2021
93ffa34
Fix nightly pypi token var in workflow.
owenvallis Oct 19, 2021
c36b955
[nightly] Increase version to 0.15.0.dev1
Oct 19, 2021
3c4a118
Merge branch 'master' into development
owenvallis Oct 19, 2021
d10a854
[nightly] Increase version to 0.15.0.dev2
Oct 20, 2021
7f392e4
vis: Introduce frontend projector (#176)
stephanwlee Oct 20, 2021
0f1cd8d
Merge branch 'master' into development
owenvallis Oct 20, 2021
0b3183a
[nightly] Increase version to 0.15.0.dev3
Oct 21, 2021
ea159f7
* Add SimClr loss
owenvallis Oct 21, 2021
9ca2ce4
Initial contrastive loss (#180)
ebursztein Oct 22, 2021
21a3220
Kaggle (#182)
owenvallis Oct 22, 2021
a9d579f
Updates to make simclr loss work as expected.
owenvallis Oct 22, 2021
f42b43b
Update unsupervised hello world to work with simsiam.
owenvallis Oct 22, 2021
c5f7463
More updates to the unsupervised notebook.
owenvallis Oct 24, 2021
fc9eec9
Updates the nightly workflow to purge the pip cache before installing
owenvallis Oct 24, 2021
75d2fd4
Fix workflow versions to python 3.9
owenvallis Oct 24, 2021
d1d998d
[nightly] Increase version to 0.15.0.dev4
Oct 24, 2021
680f983
Fix bug in unsupervised notebook.
owenvallis Oct 24, 2021
e7d9bdb
[nightly] Increase version to 0.15.0.dev5
Oct 24, 2021
b87e0d3
Reduce mean over each simsiam loss seperately before summing.
owenvallis Oct 24, 2021
8504fb2
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Oct 24, 2021
da88340
Make SimSiam a subclass of Loss.
owenvallis Oct 24, 2021
a443e66
Move loss_type cond from SimSiam.call() to the __init__.
owenvallis Oct 25, 2021
403ae5b
Fix mypy typing for simsiam loss.
owenvallis Oct 25, 2021
b1d2051
Unsupervised notebook updates.
owenvallis Oct 25, 2021
892dfff
[nightly] Increase version to 0.15.0.dev6
Oct 25, 2021
094d10e
[nightly] Increase version to 0.15.0.dev7
Oct 26, 2021
227e265
[nightly] Increase version to 0.15.0.dev8
Oct 27, 2021
1dfec75
[nightly] Increase version to 0.15.0.dev9
Oct 28, 2021
161d99e
[nightly] Increase version to 0.15.0.dev10
Oct 29, 2021
9bcb873
[nightly] Increase version to 0.15.0.dev11
Oct 30, 2021
526a41c
[nightly] Increase version to 0.15.0.dev12
Oct 31, 2021
093018d
[nightly] Increase version to 0.15.0.dev13
Nov 1, 2021
cacabca
[nightly] Increase version to 0.15.0.dev14
Nov 2, 2021
bbacd84
[nightly] Increase version to 0.15.0.dev15
Nov 3, 2021
8e48b9b
[nightly] Increase version to 0.15.0.dev16
Nov 4, 2021
5bd59d5
[nightly] Increase version to 0.15.0.dev17
Nov 5, 2021
603351c
[nightly] Increase version to 0.15.0.dev18
Nov 6, 2021
8c7527c
[nightly] Increase version to 0.15.0.dev19
Nov 7, 2021
cec580c
[nightly] Increase version to 0.15.0.dev20
Nov 8, 2021
6fb10a9
Set the direction of the False Positive Count metric to 'min' as we w…
owenvallis Nov 8, 2021
fe715f8
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Nov 8, 2021
bccd65d
[nightly] Increase version to 0.15.0.dev21
Nov 9, 2021
b37d6cd
[nightly] Increase version to 0.15.0.dev22
Nov 10, 2021
56ba48b
Unpacking the Lookup objects could fail if the Lookup sets were of di…
owenvallis Nov 11, 2021
ded9c8e
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Nov 11, 2021
5007b9f
[nightly] Increase version to 0.15.0.dev23
Nov 11, 2021
767dc1d
[nightly] Increase version to 0.15.0.dev24
Nov 12, 2021
da7c07b
[nightly] Increase version to 0.15.0.dev25
Nov 13, 2021
a7d859f
[nightly] Increase version to 0.15.0.dev26
Nov 14, 2021
d9d9883
[nightly] Increase version to 0.15.0.dev27
Nov 15, 2021
d1d42bc
Initial version of the Barlow contrastive loss.
owenvallis Nov 16, 2021
164f5c1
Updates to the simclr and simsiam contrastive losses.
owenvallis Nov 16, 2021
19a36aa
Refactor contrastive model to subclass similarity model and add suppo…
owenvallis Nov 16, 2021
99fe329
Small updates to the example notebooks.
owenvallis Nov 16, 2021
b110337
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Nov 16, 2021
234ebf3
[nightly] Increase version to 0.15.0.dev28
Nov 16, 2021
91e7fa5
Fix divide by zero in the barlow column wise normalization and only c…
owenvallis Nov 16, 2021
3df3d1a
[nightly] Increase version to 0.15.0.dev29
Nov 17, 2021
eda3f37
Merge branch 'master' into development
owenvallis Nov 17, 2021
7dd0150
[nightly] Increase version to 0.15.0.dev30
Nov 18, 2021
ef916ea
[nightly] Increase version to 0.15.0.dev31
Nov 19, 2021
010f81a
[nightly] Increase version to 0.15.0.dev32
Nov 20, 2021
7cb9e9e
[nightly] Increase version to 0.15.0.dev33
Nov 21, 2021
5c29446
[nightly] Increase version to 0.15.0.dev34
Nov 22, 2021
dfd439b
[nightly] Increase version to 0.15.0.dev35
Nov 23, 2021
819bd2e
[nightly] Increase version to 0.15.0.dev36
Nov 24, 2021
e7e6f9b
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Nov 24, 2021
8a4e563
[nightly] Increase version to 0.15.0.dev37
Nov 25, 2021
bb1d98b
Add tests and typeing for effnet architectures.
owenvallis Nov 25, 2021
a133f17
Add tests for confusion matrix and rename module to avoid clobering t…
owenvallis Nov 25, 2021
008991f
add tets for neighbor vix.
owenvallis Nov 25, 2021
7f98f70
fix typing warnings in new modules.
owenvallis Nov 25, 2021
3eb0d46
Update unsupervised draft to include barlow twins tests.
owenvallis Nov 25, 2021
d1922e4
Add draft of tf record kaggle notebook.
owenvallis Nov 25, 2021
5f81825
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Nov 25, 2021
5985874
[nightly] Increase version to 0.15.0.dev38
Nov 26, 2021
0bcd7b5
[nightly] Increase version to 0.15.0.dev39
Nov 27, 2021
04dd262
[nightly] Increase version to 0.15.0.dev40
Nov 28, 2021
ca69b2c
[nightly] Increase version to 0.15.0.dev41
Nov 29, 2021
5e9514e
[nightly] Increase version to 0.15.0.dev42
Nov 30, 2021
0d0ebef
Merge branch 'master' into development
owenvallis Nov 30, 2021
5734bb2
Fix var mismatch in sampler after merge from master.
owenvallis Nov 30, 2021
e2033d3
Add WarmUpCosine learning rate schedule. (#197)
owenvallis Nov 30, 2021
09ec779
[nightly] Increase version to 0.15.0.dev43
Dec 1, 2021
01aeda1
[nightly] Increase version to 0.15.0.dev44
Dec 2, 2021
f19f317
[nightly] Increase version to 0.15.0.dev45
Dec 3, 2021
f709afd
Add GeneralizeMeanPooling2D layer (#198)
owenvallis Dec 3, 2021
d1a9930
Add 1D version for GeM pooling.
owenvallis Dec 4, 2021
52d07d0
[nightly] Increase version to 0.15.0.dev46
Dec 4, 2021
80ba036
[nightly] Increase version to 0.15.0.dev47
Dec 5, 2021
b92eb63
Refactor GeM to reduce code duplication and add test coverage for 1D.
owenvallis Dec 5, 2021
9ab2da0
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 5, 2021
e4a648b
Rename lr schedule module to schedules to make import cleaner.
owenvallis Dec 5, 2021
8162802
[nightly] Increase version to 0.15.0.dev48
Dec 6, 2021
88c81b9
[nightly] Increase version to 0.15.0.dev49
Dec 7, 2021
5f1f48c
[nightly] Increase version to 0.15.0.dev50
Dec 8, 2021
77cf7c2
Replace GlobalMeanPooling2d wiht GeneralizedMeanPooling2D and add Non…
owenvallis Dec 8, 2021
c214632
Add support for scaling vix by max pixel value.
owenvallis Dec 8, 2021
2372150
[Bug] Cast steps to dtype in WarmUpCosine. Rename test module to sche…
owenvallis Dec 8, 2021
ff35ee1
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 8, 2021
82275b6
[nightly] Increase version to 0.15.0.dev51
Dec 9, 2021
6b62bb2
Update changelog style.
owenvallis Dec 9, 2021
282f30d
Add license to schedules module.
owenvallis Dec 9, 2021
eb07cc4
Refer to Layers using the full module path rather than importing the …
owenvallis Dec 9, 2021
c42c2c9
Rename effnet p param to gem_p to make it clear that we are setting t…
owenvallis Dec 9, 2021
b8a684e
Major updates to the contrastive model.
owenvallis Dec 9, 2021
6526dc4
Major updates to the unsupervised hello world notebook.
owenvallis Dec 9, 2021
2a9f5f3
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 9, 2021
df3bd41
[nightly] Increase version to 0.15.0.dev52
Dec 10, 2021
e389696
Fix mypy errors in ContrastiveModel.
owenvallis Dec 11, 2021
79e779a
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 11, 2021
fb71589
Update example notebooks.
owenvallis Dec 11, 2021
32ddda8
[nightly] Increase version to 0.15.0.dev53
Dec 11, 2021
8dd77d3
[nightly] Increase version to 0.15.0.dev54
Dec 12, 2021
44e3fa5
[nightly] Increase version to 0.15.0.dev55
Dec 13, 2021
ec13ba5
Update supervised hello world.
owenvallis Dec 13, 2021
0e7dc0e
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 13, 2021
b43b714
[nightly] Increase version to 0.15.0.dev56
Dec 14, 2021
c7b2bdf
[nightly] Increase version to 0.15.0.dev57
Dec 15, 2021
3283831
[nightly] Increase version to 0.15.0.dev58
Dec 16, 2021
91f8df2
[nightly] Increase version to 0.15.0.dev59
Dec 17, 2021
143ce1f
[nightly] Increase version to 0.15.0.dev60
Dec 18, 2021
30d21bb
Added soft_nearest_neighbor_loss. Closes #103 (#203)
abhisharsinha Dec 19, 2021
34f3d02
[nightly] Increase version to 0.15.0.dev61
Dec 19, 2021
2f7e68c
Add ActivationStdLoggingLayer.
owenvallis Dec 19, 2021
aaac2bb
Add area_range arg to simclr crop_and_resize.
owenvallis Dec 19, 2021
5a2e68e
Basic formatting and cleanup of doc strings and args.
owenvallis Dec 19, 2021
a5bdf04
Add resent architectures.
owenvallis Dec 19, 2021
31acdaf
Updates to contrastive model.
owenvallis Dec 19, 2021
940207d
Updates to unsupervised notebook
owenvallis Dec 19, 2021
f48ce96
Remove contrastive metrics module.
owenvallis Dec 19, 2021
c12fa56
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 19, 2021
61b61cc
[nightly] Increase version to 0.15.0.dev62
Dec 20, 2021
fa53e01
Support inner model losses.
owenvallis Dec 21, 2021
19e8fe0
Fix mypy errors in simsiam loss.
owenvallis Dec 21, 2021
cc9142b
Various fixes to ResNet18
owenvallis Dec 21, 2021
5b3fef1
Initial working version of SimSiam on cifar10
owenvallis Dec 21, 2021
be59fcc
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 21, 2021
681f100
Added SNR distance. Closes #64 (#205)
abhisharsinha Dec 21, 2021
821b296
Small updates for SimSiam example.
owenvallis Dec 21, 2021
c25336d
[nightly] Increase version to 0.15.0.dev63
Dec 21, 2021
74e6f0f
[nightly] Increase version to 0.15.0.dev64
Dec 22, 2021
3af6579
Merge branch 'master' into development
owenvallis Dec 22, 2021
ac4b0bc
Merge branch 'master' into development
owenvallis Dec 22, 2021
7ec75cd
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 22, 2021
6984fbd
Updates for contrastive model saving.
owenvallis Dec 22, 2021
6d5dbae
[nightly] Increase version to 0.15.0.dev65
Dec 23, 2021
969c3d1
[nightly] Increase version to 0.15.0.dev66
Dec 24, 2021
82f6140
[nightly] Increase version to 0.15.0.dev67
Dec 25, 2021
12fe586
[nightly] Increase version to 0.15.0.dev68
Dec 26, 2021
191e516
[nightly] Increase version to 0.15.0.dev69
Dec 27, 2021
0202678
[nightly] Increase version to 0.15.0.dev70
Dec 28, 2021
e976d29
[nightly] Increase version to 0.15.0.dev71
Dec 29, 2021
e90ec5d
Update losses to use Loss reduction.
owenvallis Dec 29, 2021
8985af8
Resnet18 returns as a SimilarityModel.
owenvallis Dec 29, 2021
1854120
Fix various mypy and linter errors.
owenvallis Dec 29, 2021
ce00de5
Add support for contrastive_model save and load.
owenvallis Dec 29, 2021
57a496a
Update unsupervised notebook with save and load.
owenvallis Dec 29, 2021
b63ee36
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Dec 29, 2021
7be915d
Merge branch 'master' into development
owenvallis Dec 30, 2021
10e9dbb
Update the save and load.
owenvallis Dec 30, 2021
587d863
Updates to visualization notebook.
owenvallis Dec 30, 2021
2889905
[nightly] Increase version to 0.15.0.dev72
Dec 30, 2021
69c53e8
Merge branch 'master' into development
owenvallis Dec 31, 2021
eb6b90d
Merge branch 'master' into development
owenvallis Dec 31, 2021
7ff26ae
Unsupervised notebook update.
owenvallis Dec 31, 2021
bbba5ce
[nightly] Increase version to 0.15.0.dev73
Dec 31, 2021
1241f24
[nightly] Increase version to 0.15.0.dev74
Jan 1, 2022
6b64519
[nightly] Increase version to 0.15.0.dev75
Jan 2, 2022
e975e6b
[nightly] Increase version to 0.15.0.dev76
Jan 3, 2022
5ae6141
Notes on the unsupervised notebook draft.
owenvallis Jan 3, 2022
339f1f2
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Jan 3, 2022
670c7cc
Merge branch 'master' into development
owenvallis Jan 3, 2022
a73318a
[nightly] Increase version to 0.15.0.dev77
Jan 4, 2022
7923129
[nightly] Increase version to 0.15.0.dev78
Jan 5, 2022
826151b
[nightly] Increase version to 0.15.0.dev79
Jan 6, 2022
7e7a8a0
Remove get_backbone() method and just have users access the backbone …
owenvallis Jan 6, 2022
7ed8743
Add new diagrams and updated copy to teh unsupervised notebook.
owenvallis Jan 6, 2022
12496f3
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Jan 6, 2022
109efd5
Merge branch 'master' into development
owenvallis Jan 6, 2022
e150242
[nightly] Increase version to 0.15.0.dev80
Jan 7, 2022
0e43df7
[nightly] Increase version to 0.15.0.dev81
Jan 8, 2022
680f78c
First finished draft of unsupervised_hello_world notebook
owenvallis Jan 8, 2022
458486f
Updates to the README file. Add self-supervised info.
owenvallis Jan 8, 2022
77b2c99
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Jan 8, 2022
4e7ad65
[nightly] Increase version to 0.15.0.dev82
Jan 9, 2022
f82f513
[nightly] Increase version to 0.15.0.dev83
Jan 10, 2022
0168a45
Update README.md
owenvallis Jan 10, 2022
9ca93bd
Remove augmentation arg from architectures.
owenvallis Jan 11, 2022
6300126
Merge branch 'development' of github.com:tensorflow/similarity into d…
owenvallis Jan 11, 2022
f117e18
Clean up example dir.
owenvallis Jan 11, 2022
4179d99
Fix flake8 errors in architectures.
owenvallis Jan 11, 2022
95dbecf
Update API docs.
owenvallis Jan 11, 2022
898faef
Bump version to 0.15.0
owenvallis Jan 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
# TensorFlow Similarity: Metric Learning for Humans

TensorFlow Similarity is a [TensorFlow](https://tensorflow.org) library for [similarity learning](https://en.wikipedia.org/wiki/Similarity_learning) also known as metric learning and contrastive learning.

TensorFlow Similarity is still in beta.
TensorFlow Similarity is a [TensorFlow](https://tensorflow.org) library for [similarity learning](https://en.wikipedia.org/wiki/Similarity_learning) which includes techniques such as self-supervised learning, metric learning, similarity learning, and contrastive learning. TensorFlow Similarity is still in beta and we may push breaking changes.

## Introduction

Tensorflow Similarity offers state-of-the-art algorithms for metric learning and all the necessary components to research, train, evaluate, and serve similarity-based models.
Tensorflow Similarity offers state-of-the-art algorithms for metric learning along with all the necessary components to research, train, evaluate, and serve similarity and contrastive based models. These components include models, losses, metrics, samplers, visualizers, and indexing subsystems to make this quick and easy.

![Example of nearest neighbors search performed on the embedding generated by a similarity model trained on the Oxford IIIT Pet Dataset.](https://raw.githubusercontent.com/tensorflow/similarity/master/assets/images/similar-cats-and-dogs.jpg)

With TensorFlow Similarity you can train and serve models that find similar items (such as images) in a large corpus of examples. For example, as visible above, you can train a similarity model to find and cluster similar looking images of cats and dogs from the [Oxford IIIT Pet Dataset](https://www.tensorflow.org/datasets/catalog/oxford_iiit_pet) by only training on a few classes. To train your own similarity model see this [notebook](examples/supervised_visualization.ipynb).

Metric learning is different from traditional classification as it's objective is different. The model learns to minimize the distance between similar examples and maximize the distance between dissimilar examples, in a supervised or self-supervised fashion. Either way, TensorFlow Similarity provides the necessary losses, metrics, samplers, visualizers, and indexing sub-system to make this quick and easy.
With Tensorflow Similarity you can train two main types of models:

**Currently, TensorFlow Similarity supports supervised training.** In future releases, it will support semi-supervised and self-supervised training.
1. **Self-supervised models**: Used to learn general data representations on unlabeled data to boost the accuracy of downstream tasks where you have few labels. For example, you can pre-train a model on a large number of unlabled images using one of the supported contrastive methods supported by TensorFlow Similarity, and then fine-tune it on a small labeled dataset to achieve higher accuracy. To get started training your own self-supervised model see this [notebook](examples/unsupervised_hello_world.ipynb).

To learn more about the benefits of using similarity training, you can check out the blog post.
2. **Similarity models**: Output embeddings that allow you to find and cluster similar examples such as images representing the same object within a large corpus of examples. For instance, as visible above, you can train a similarity model to find and cluster similar looking, unseen cat and dog images from the [Oxford IIIT Pet Dataset](https://www.tensorflow.org/datasets/catalog/oxford_iiit_pet) while only training on a few of the dataset classes. To get started training your own similarity model see this [notebook](examples/supervised_visualization.ipynb).

## What's new

- [Oct 8]: Added `Samplers.*` IO [notebook](examples/sampler_io_cookbook.ipynb) detailing how to efficently sample your data for succesful training.
- [Oct 8]: 0.14 is out which includes various speed improvements and post initial release bug fixes.
- [Jan 2022]: 0.15 self-supervised release
* Added support for self-supervised contrastive learning. Including SimCLR, SimSiam, and Barlow Twins. Checkout the in-depth [hello world notebook](examples/unsupervised_hello_world.ipynb) to get started.
* Soft Nearest Neighbor Loss added thanks to [Abhishar Sinha](https://github.com/abhisharsinha)
* Added GenerlizedMeanPooling2D support that improves similarity matching accuracy over GlobalMeanPooling2D.
* Numerous speed optimizations and general bug fixes.
- [Dec 2021]:
* Sampler speed optimizations and general bug fixes.
- [Oct 2021]: 0.14 similarity release
* 0.14 is out which includes various speed improvements and post initial release bug fixes.
* Added `Samplers.*` IO [notebook](examples/sampler_io_cookbook.ipynb) detailing how to efficiently sample your data for successful training.


For previous changes - see [the release changelog](./releases.md)
For previous changes and more details - see [the changelog](./releases.md)

## Getting Started

Expand All @@ -46,13 +51,15 @@ For more information about specific functions, you can [check the API documentat
For contributing to the project please check out the [contribution guidelines](CONTRIBUTING.md)

### Minimal Example: MNIST similarity
<details>
<summary> Click to expand and see how to train a supervised similarity model on mnist using TF.Similarity</summary>

Here is a bare bones example demonstrating how to train a TensorFlow Similarity model on the MNIST data. This example illustrates some of the main components provided by TensorFlow Similarity and how they fit together. Please refer to the [hello_world notebook](examples/supervised_hello_world.ipynb) for a more detailed introduction.

### Preparing data

TensorFlow Similarity provides [data samplers](api/TFSimilarity/samplers/), for various dataset types, that balance the batches to ensure smoother training.
In this example, we are using the multi-shot sampler that integrate directly from the TensorFlow dataset catalog.
In this example, we are using the multi-shot sampler that integrates directly from the TensorFlow dataset catalog.

```python
from tensorflow_similarity.samplers import TFDatasetMultiShotMemorySampler
Expand Down Expand Up @@ -96,7 +103,7 @@ model.fit(sampler, epochs=5)

### Building images index and querying it

Once the model is trained, reference examples must indexed via the model index API to be searchable. After indexing, you can use the model lookup API to search the index for the K most similar items.
Once the model is trained, reference examples must be indexed via the model index API to be searchable. After indexing, you can use the model lookup API to search the index for the K most similar items.

```python
from tensorflow_similarity.visualization import viz_neigbors_imgs
Expand All @@ -112,15 +119,23 @@ nns = model.single_lookup(qx[0])
# Visualize the query example and its top 5 neighbors
viz_neigbors_imgs(qx[0], qy[0], nns)
```
</details>

## Supported Algorithms

### Self-Supervised Models

- SimCLR
- SimSiam
- Barlow Twins

### Supervised Losses

- Triplet Loss
- PN Loss
- Multi Sim Loss
- Circle Loss
- Soft Nearest Neighbor Loss

### Metrics

Expand All @@ -140,7 +155,7 @@ Please cite this reference if you use any part of TensorFlow similarity in your

```bibtex
@article{EBSIM21,
title={TensorFlow Similarity: A Usuable, High-Performance Metric Learning Library},
title={TensorFlow Similarity: A Usable, High-Performance Metric Learning Library},
author={Elie Bursztein, James Long, Shun Lin, Owen Vallis, Francois Chollet},
journal={Fixme},
year={2021}
Expand Down
2 changes: 2 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The default implementation can scale up to medium deployment (1M-10M+ points) ea

- [`architectures`](./TFSimilarity/architectures.md): Deep-learning model architectures tweaked to work well for similarity

- [`augmenters`](./TFSimilarity/augmenters.md)

- [`callbacks`](./TFSimilarity/callbacks.md): Specialized callbacks that track similarity metrics during training

- [`classification_metrics`](./TFSimilarity/classification_metrics.md): Classification metrics measure matching classification quality between a
Expand Down
Loading