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

Error in losses.py #33

Open
nathasha-naranpanawa opened this issue Apr 28, 2020 · 2 comments
Open

Error in losses.py #33

nathasha-naranpanawa opened this issue Apr 28, 2020 · 2 comments

Comments

@nathasha-naranpanawa
Copy link

I get the following error when I try to train from scratch:

Traceback (most recent call last):
File "D:/Projects/LCFCN/main.py", line 49, in
main()
File "D:/Projects/LCFCN/main.py", line 40, in main
train.train(dataset_name, model_name, metric_name, path_history, path_model, path_opt, path_best_model, args.reset)
File "D:\Projects\LCFCN\train.py", line 76, in train
epoch=epoch)
File "D:\Projects\LCFCN\utils.py", line 30, in fit
loss = loss_function(model, batch)
File "D:\Projects\LCFCN\losses.py", line 31, in lc_loss
loss = compute_image_loss(S, counts)
File "D:\Projects\LCFCN\losses.py", line 75, in compute_image_loss
Target = (BgFgCounts.view(n*k) > 0).view(-1).float()
RuntimeError: shape '[1]' is invalid for input of size 2

Does this have something to do with the network output size? Or the image size?
How may I fix this?

@IssamLaradji
Copy link
Collaborator

Hi Natasha, sorry about the late reply. Last week was graduation week, and it was exciting and hectic :P hehe.

I have made a clean version of the code (it's very different now but more stable). Can you try running it?

@nathasha-naranpanawa
Copy link
Author

nathasha-naranpanawa commented May 11, 2020

Congratulations on graduation!
And thanks, will try running the new code

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

2 participants