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

OIM loss initialize error #91

Open
yaodonggggggg opened this issue May 4, 2020 · 0 comments
Open

OIM loss initialize error #91

yaodonggggggg opened this issue May 4, 2020 · 0 comments

Comments

@yaodonggggggg
Copy link

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,num_classes=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?

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

No branches or pull requests

1 participant