-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Some problems occurred in predict.py. #94
Comments
Hi, can you try after pulling the last commit on master ? |
Thank you for your reply. I try to use torch.from_numpy(img).unsqeeze(0),to transfer the numpy type of img to that of torch. |
I'm getting the following error: python predict.py -i validation.jpg --viz --no-save
When I add a path, I get this error instead:
|
I am also getting similar error File "D:\PW\courses\neuralNetworks\repo\Pytorch-UNet\predict.py", line 141, in File "D:\PW\courses\neuralNetworks\repo\Pytorch-UNet\predict.py", line 26, in predict_img File "D:\PW\courses\neuralNetworks\repo\Pytorch-UNet\utils\dataset.py", line 18, in init FileNotFoundError: [WinError 3] The system cannot find the path specified: ''` |
Hi, can you try again after pulling the last commit ? |
You validation DICE is > 1 and your loss is negative so there is a problem with your masks. If you have 2 classes, make sure the mask values are 0s or 1s. |
Verify that after loading your mask, the tensor contains only 0s and 1s |
can you print the resulting true mask tensor and the network output values ? |
Can you be more spesific? Where are they? |
In the train loop Line 81 in ebe3bbb
print masks_pred and true_masks and make sure they are as expected |
Please show some of the values of these tensors : min, max, type, ... |
Yes that what I meant. The values of the true mask should be between [0, 1], as they are probabilities. Divide your true masks by 255 in your loader. ( I'm doing that in my loader, did you bypass that ? Line 40 in ebe3bbb
|
no its same. its not bypassed. |
I solve the problem, it is about .tif files.
After changing libtiff version it works properly. |
I have come to similar problem like this:
It seems like png picture cannot use '.shape[2]'.... I change it into '.width' and finally succesfully run the project~ |
@Janene-Li make sure you are using the latest version of Pillow |
Hi, sorry for troubling you. But when I run predict.py, it remind AttributeError: 'numpy.ndarray' object has no attribute 'unsqueeze':
Traceback (most recent call last):
File "origin_predict.py", line 135, in
device=device)
File "origin_predict.py", line 32, in predict_img
img = img.unsqueeze(0)
AttributeError: 'numpy.ndarray' object has no attribute 'unsqueeze'
Do you know how to deal with it? Thank you so much.
The text was updated successfully, but these errors were encountered: