LCFCN icon indicating copy to clipboard operation
LCFCN copied to clipboard

Error in losses.py

Open nathasha-naranpanawa opened this issue 5 years ago • 2 comments

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?

nathasha-naranpanawa avatar Apr 28 '20 00:04 nathasha-naranpanawa

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?

IssamLaradji avatar May 11 '20 12:05 IssamLaradji

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

nathasha-naranpanawa avatar May 11 '20 22:05 nathasha-naranpanawa