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

Implementation of Centroid Triplet Loss Function #209

Closed
wants to merge 2 commits into from
Closed

Implementation of Centroid Triplet Loss Function #209

wants to merge 2 commits into from

Conversation

Spinachboul
Copy link

Hello Developers,

I have added the code for Centroid Triplet Loss function as an added implementation in the "Loss" folder.
I follows the basic code template, just contains a few changes in the forward function where the The Centroid Triplet Loss aims to learn embeddings (vectors) in such a way that distances between centroids belonging to the same group or cluster are minimized while distances between centroids of different groups are maximized.

Copy link

netlify bot commented Dec 3, 2023

Deploy Preview for capable-unicorn-d5e336 failed.

Name Link
🔨 Latest commit a8a91a4
🔍 Latest deploy log https://app.netlify.com/sites/capable-unicorn-d5e336/deploys/656c5ce9a20da6000884618b

Copy link

netlify bot commented Dec 3, 2023

Deploy Preview for capable-unicorn-d5e336 failed.

Name Link
🔨 Latest commit 9004633
🔍 Latest deploy log https://app.netlify.com/sites/capable-unicorn-d5e336/deploys/656c5cf3af47640008d48597

Copy link
Author

@Spinachboul Spinachboul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the code indentation is slightly shifted , no change in the logic!

@HanClinto
Copy link

Looks like the build is failing due to formatting issues:

5:51:06 AM: /opt/buildhome/python3.8/lib/python3.8/site-packages/quaterion/loss/cos_face_loss.py:docstring of quaterion.loss.cos_face_loss.CosFaceLoss.forward:3: ERROR: Unexpected indentation.
5:51:06 AM: /opt/buildhome/python3.8/lib/python3.8/site-packages/quaterion/loss/cos_face_loss.py:docstring of quaterion.loss.cos_face_loss.CosFaceLoss.forward:4: WARNING: Block quote ends without a blank line; unexpected unindent.
5:51:06 AM: /opt/build/repo/docs/source/tutorials/triplet_loss_trick.rst:2: WARNING: Title underline too short.
5:51:06 AM: Triplet Loss: Vector Collapse Prevention
5:51:06 AM: ============================

@Spinachboul Spinachboul closed this Dec 9, 2023
@Spinachboul
Copy link
Author

@HanClinto
So should I again raise a PR for the function?

@HanClinto
Copy link

@HanClinto So should I again raise a PR for the function?

I can't speak for the maintainers of Quaternion, but Centroid Triplet Loss looks like a very useful function to have -- I would personally be interested in trying it out!

@Spinachboul Spinachboul deleted the Spinachboul(Centroid_Triplet_Loss) branch December 9, 2023 06:11
@Spinachboul
Copy link
Author

For now I have deleted the branch. I also thought of implementing n-pair which is apparently better than contrastive and triplet loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants