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

fix SiameseNetwork forward_once method + cleanup #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
20 changes: 2 additions & 18 deletions siamese_net.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import torchvision
import torchvision.datasets as dset
import torchvision.transforms as transforms
from torch.utils.data import DataLoader,Dataset
import matplotlib.pyplot as plt
import torchvision.utils
import numpy as np
import random
from PIL import Image
import torch
from torch.autograd import Variable
import PIL.ImageOps
import torch.nn as nn
from torch import optim
import torch.nn.functional as F



class SiameseNetwork(nn.Module):
def __init__(self):
super(SiameseNetwork, self).__init__()
Expand All @@ -37,7 +24,6 @@ def __init__(self):
nn.BatchNorm2d(128),
#nn.Dropout2d(p=0.4),


nn.Conv2d(128,256,kernel_size=1,stride=2),
nn.ReLU(inplace=True),
nn.BatchNorm2d(256),
Expand All @@ -62,10 +48,8 @@ def __init__(self):

def forward_once(self, x):
output = self.net(x)
#output = output.view(output.size()[0], -1)
#output = self.fc(output)

output = torch.squeeze(output)
output = torch.flatten(output, start_dim=1)

return output

def forward(self, input1, input2,input3=None):
Expand Down