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

ValueError: Expected input batch_size (98304) to match target batch_size (24576). #2

Open
ssbilakeri opened this issue Oct 14, 2020 · 7 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ssbilakeri
Copy link

when I use MDRS2_config file as overwrite_file getting bellow error. please suggest me where Im wrong

Traceback (most recent call last):
File "demo.py", line 11, in
trainer.train()
File "..\MDRSREID\Trainer\MDRSReIDTrainer.py", line 111, in train
source_loss += self.loss_functions[loss_type.name](item, pred, step=self.current_step)['loss']
File "..\MDRSREID\Loss_Meter\Multi_Seg_loss.py", line 24, in call
loss_list = [self.criterion(multi_seg_pred_list[i].permute(0, 2, 3, 1).contiguous().view(-1, C), ps_label) for i in range(len(multi_seg_pred_list))]
File "..\MDRSREID\Loss_Meter\Multi_Seg_loss.py", line 24, in
loss_list = [self.criterion(multi_seg_pred_list[i].permute(0, 2, 3, 1).contiguous().view(-1, C), ps_label) for i in range(len(multi_seg_pred_list))]
File "C:\Users\ssbilakeri\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "C:\Users\ssbilakeri\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 904, in forward
ignore_index=self.ignore_index, reduction=self.reduction)
File "C:\Users\ssbilakeri\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1970, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "C:\Users\ssbilakeri\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1788, in nll_loss
.format(input.size(0), target.size(0)))
ValueError: Expected input batch_size (98304) to match target batch_size (24576).

@nickhuang1996
Copy link
Owner

nickhuang1996 commented Oct 15, 2020

@ssbilakeri
For this bugs, I have rewritten the code for overwrite_configs and modified the MDRS_seg_loss.py for two options, which is correponding to backbone options.

@qianqiansbaby
Copy link

qianqiansbaby commented Oct 15, 2020

@ssbilakeri
Hi, I have same problems but I choose use option 2 then no errors and I get the same results better than those in this paper. Could you please tell me how to choose these overwrite config files for training please!:relaxed:

@qianqiansbaby
Copy link

@nickhuang1996
I have another question:
How the RamdomIdentitySampler2.py works?
I can't understand how to use this sampler.:sob: Please tell me how to use it for training.

@nickhuang1996
Copy link
Owner

@qianqiansbaby
This RamdomIdentitySampler is to select identities and their images. For example, if you set identities to 4 and their images to 8, then the batch size for training is 4*8 = 32.

@ssbilakeri
Copy link
Author

ssbilakeri commented Oct 15, 2020 via email

@nickhuang1996
Copy link
Owner

@ssbilakeri
Good luck!:relaxed: You can use my MDRS_feat_dict.mat files to test and no problem. Thank you for cooperating with me for modification on this code.:stuck_out_tongue_winking_eye:

@D77-d77
Copy link

D77-d77 commented Oct 15, 2020

@nickhuang1996
Thank you for resolving errors.😘 I have achieved excellent results through your feat_dict files.👍

@nickhuang1996 nickhuang1996 added bug Something isn't working enhancement New feature or request labels Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants