Skip to content

yasamanhbn/Triplet-and-contrastive-loss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Triplet and Contrastive Loss

This repository contains two Python notebooks demonstrating the implementation of triplet and contrastive loss for similarity learning. Triplet and contrastive loss are commonly used in siamese and triplet network architectures for learning similarity and dissimilarity between data points.

Contents

  • triplet_loss.ipynb: Jupyter notebook containing the implementation of triplet and contrastive loss using TensorFlow/Keras.
  • data/: Directory containing sample datasets for testing the implementation.

Usage

To use the notebook, simply open TripletLoss.ipynb or Contrasive Loss.ipynbin Jupyter Notebook or JupyterLab. The notebook contains detailed explanations and code for implementing triplet and contrastive loss, as well as examples of how to use them in training neural networks.

Dependencies

The implementation in the notebook requires the following Python libraries:

  • pytorch
  • NumPy
  • Matplotlib

You can install the required dependencies using the following command:

pip install pytorch numpy matplotlib

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Feel free to contribute to this project by opening issues or pull requests.

Acknowledgements

This implementation is based on the following research papers:

Author

Yasaman Haghbin

About

Implementation of Triplet loss and Contrastive loss

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published