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

how to process the model output in the validation phase #104

Open
mpapadomanolaki opened this issue Aug 1, 2023 · 0 comments
Open

how to process the model output in the validation phase #104

mpapadomanolaki opened this issue Aug 1, 2023 · 0 comments

Comments

@mpapadomanolaki
Copy link

Hello,

Thank you very much for your code.
I have a question.
Could you explain me how can I process the model output in the validation/testing phase?
Because the ground truth shape is (batch_size, 1, height, width), however the model output is (batch_size, 64, height, width).
So when the confusion matrix is calculated in line 121 of util/metrics.py, an error is thrown.

The actual error is:
Traceback (most recent call last):
File "/home/mariapap/CODE/STANet/./train.py", line 170, in
miou_current = val(opt, model)
File "/home/mariapap/CODE/STANet/./train.py", line 86, in val
score = model.test(val=True) # run inference
File "/home/mariapap/CODE/STANet/models/CDFA_model.py", line 79, in test
metrics.update(self.L.detach().cpu().numpy(), pred.detach().cpu().numpy())
File "/home/mariapap/CODE/STANet/util/metrics.py", line 121, in update
self.confusion_matrix += self.__fast_hist(lt.flatten(), lp.flatten())
File "/home/mariapap/CODE/STANet/util/metrics.py", line 108, in __fast_hist
hist = np.bincount(self.num_classes * label_gt[mask].astype(int) + label_pred[mask],
IndexError: boolean index did not match indexed array along dimension 0; dimension is 4194304 but corresponding boolean dimension is 65536

Thank you for your time.

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