-
Notifications
You must be signed in to change notification settings - Fork 62
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
unet TypeError: function takes exactly 1 argument (3 given) #8
Comments
Here are further details: `--------------------------------------------------------------------------- 10 frames /usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in next(self) /usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in _next_data(self) /usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py in fetch(self, possibly_batched_index) /usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py in (.0) /content/Brain-Tumor-Segmentation/bts/dataset.py in getitem(self, index) /content/Brain-Tumor-Segmentation/bts/dataset.py in _random_transform(self, image, mask) /usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py in rotate(img, angle, resample, expand, center, fill) /usr/local/lib/python3.6/dist-packages/PIL/Image.py in rotate(self, angle, resample, expand, center, translate, fillcolor) /usr/local/lib/python3.6/dist-packages/PIL/Image.py in transform(self, size, method, data, resample, fill, fillcolor) /usr/local/lib/python3.6/dist-packages/PIL/Image.py in new(mode, size, color) TypeError: function takes exactly 1 argument (3 given)` |
The same error occurs on my side too. My initial dataset was in RGB and converted it using ImageMagick to greyscale PNG file. |
@muminoff , thanks for your response. I am using the same dataset suggested in the repo. Please could you elaborate further on the workaround this? I mean how to practically handle RGB issue in this case? |
@tobimichigan I am not maintainer of this repo. I am also issue-reporter like you. Let's wait what @sdsubhajitdas thinks about this. |
It is possible that information is lost in the RGB downgrade to Grayscale. A solution could be to retrain the model entirely, ensuring you payed attention to the shape of your new model, wrt rgb channels. |
Did anyone solve this issue? |
Hi, I tried running your code but it hangs around the line below with `"unet TypeError: function takes exactly 1 argument (3 given)".
I have commented the section. Please kindly advise,
Training process
if TRAIN:
unet_model.train()
path = os.path.join('saved_models',MODEL_NAME) if SAVE_MODEL else None
unet_train_history = unet_classifier.train(EPOCHS,trainloader,mini_batch=100,save_best=path)
print(f'Training Finished after {EPOCHS} epoches')
Testing process on test data.
unet_model.eval()
unet_score = unet_classifier.test(testloader) #unet TypeError: function takes exactly 1 argument (3 given)
print(f'\n\nDice Score {unet_score}')
Dice Score 0.7446110107881675
`
The text was updated successfully, but these errors were encountered: