examples icon indicating copy to clipboard operation
examples copied to clipboard

Add Siamese Network example

Open piyush01123 opened this issue 5 years ago • 4 comments

Hi, I want to add an example for Siamese network, since it is one of the popular use cases in ML. I am thinking of implementing it in a way similar to other examples viz. command line arguments to choose which dataset to train, hyperparameters etc. Is there something I need to keep in mind specifically apart from these:

  • Use torchvision's Dataset class and PyTorch's DataLoader class to handle data.
  • Implement a simple CNN as a nn.Module subclass
  • Implement triplet loss
  • Create train and test functions and a main function that calls those 2 methods at each epoch.
  • Report final loss and accuracy

Is this something that is worth adding to the repository.

piyush01123 avatar Oct 24 '19 11:10 piyush01123

Hi @piyush01123 you're welcome to try producing an example, I'd suggest taking a look at existing examples to see how to get going

msaroufim avatar Mar 09 '22 23:03 msaroufim

I'll submit a PR in a couple of days for this in accordance with the existing examples of this repo.

piyush01123 avatar Mar 31 '22 15:03 piyush01123

I have implemented Siamese Network example in this PR https://github.com/pytorch/examples/pull/1003

ma7dev avatar May 05 '22 23:05 ma7dev

I suggest closing this issue as #1003 has been merged to master. Thanks, @msaroufim for the feedback!


I can make another example that aligns with what the issue is suggesting in the matter of using a more proper dataset, TripletLoss, and implementing a simple CNN rather than ResNet18 which was used in #1003 implementation.

ma7dev avatar May 13 '22 18:05 ma7dev