dichotomies / proxy-nca

PyTorch Implementation of `No Fuss Distance Metric Learning using Proxies`.
MIT License
181 stars 33 forks source link

Not runnable #3

Closed jonpoveda closed 6 years ago

jonpoveda commented 6 years ago

I could not run your code in any pytorch version. I'm using python 3.6. After fixing the call pnca = ProxyNCA(no_top_model, SZ_EMBED, NB_CLASS, SZ_BATCH) in pnca.py and using torch.nn.init.xavier_uniform or torch.nn.init.xavier_uniform_ depending on pytorch version, I receive these errors depending on the pytorch version:

v0.1.12-post2 and v0.2.0-post2: RuntimeError: Given input size: (128 x 3 x 3). Calculated output size: (768 x -1 x -1). Output size is too small at /b/wheel/pytorch-src/torch/lib/THNN/generic/SpatialConvolutionMM.c:4

v0.3.0 and v0.4.0: RuntimeError: Calculated padded input size per channel: (3 x 3). Kernel size: (5 x 5). Kernel size can't greater than actual input size at /pytorch/aten/src/THNN/generic/SpatialConvolutionMM.c:48

Any clue?

RamiAwar commented 6 years ago

Are you using the inceptionv3 model? I ran his notebook successfully on the cars dataset.

dichotomies commented 6 years ago

@RamiAwar might have a point here.

I've updated the whole repository. If you just run train.py, you should be able to run the code without any problems and without this issue.