Cysu / open-reid

Open source person re-identification library in python
https://cysu.github.io/open-reid/
MIT License
1.34k stars 349 forks source link

OIM loss initialize error #91

Open yaodonggggggg opened 4 years ago

yaodonggggggg commented 4 years ago

I test the examples/oim_loss.py with python examples/oim_loss.py -d cuhk01 -b 2 -j 0 -a resnet50 --logs-dir logs/softmax-loss/cuhk01-resnet50. And I got the model.module.num_features 2048 ,but when I run the resnet.py in your code with

model = create('resnet50', num_features=0, norm=True,dropout=0,numclasses=4) x = torch.rand(2, 3, 256,128) out = model(x) print("out.shape",out.shape) loss = OIMLoss(2048, 4) target = torch.empty(2, dtype=torch.long).random(4) print(target) los, output = loss(out, target)

But got

File "F:/python_workspace/open-reid-master/reid/loss/oim.py", line 16, in forward outputs = inputs.mm(self.lut.t()) RuntimeError: size mismatch, m1: [2 x 4], m2: [2048 x 4]

How to deal with the problem?