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

test.py checking #19

Closed
bhralzz opened this issue Sep 21, 2021 · 3 comments
Closed

test.py checking #19

bhralzz opened this issue Sep 21, 2021 · 3 comments

Comments

@bhralzz
Copy link

bhralzz commented Sep 21, 2021

Hi again.
I also tested the multi gpu train.py form and worked fine till now in training,
however I need to use trained model for testing on new samples.
did you checked test.py file?
Error shown as below
TypeError: init() got an unexpected keyword argument 'mask_num_classes'
there are some another errors like undefined name visualize_model, evalrobustness, testloader, ...
please check test.py
waiting to hear from you.
thanks

@askerlee
Copy link
Owner

askerlee commented Sep 21, 2021

You mean test3d.py right?
Previously I suggested you to insert a structure like below to use brats 2020 dataset. But seems brats 2020 folders are already included in this structure:

                     'brats': {
                                 'num_classes': 4,
                                 'bce_weight':  [0., 3, 1, 1.75],  # bg, ET, WT, TC
                                 'ds_class':    'BratsSet',
                                 'train_ds_names':  '2019train',
                                 'test_ds_name':    '2019valid',
                                 'chosen_modality': -1,
                                 'xyz_permute':     None, # (1, 2, 0),
                                 'orig_input_size': None,
                                 # each dim of the orig_patch_size should always be multiply of 8.
                                 'orig_patch_size': (112, 112, 96),
                                 'input_scale':     (1,   1,   1),
                                 'D_pool_K':         2,
                                 'has_mask':    { '2019train': True,    '2019valid': False, 
                                                  '2020train': True,    '2020valid': False },
                                 'weight':      { '2019train': 1,       '2019valid': 1, 
                                                  '2020train': 1,       '2020valid': 1 }
                               },   

But you need to name the names of the training and validation folders to 2020train and 2020valid, respectively.
Then the test command line will be like:
python3 test3d.py --task brats --split all --bs 5 --ds 2020valid --net segtran --attractors 1024 --translayers 1 --cpdir ../model/segtran-brats-2019train-01170142 --iters 8000

@bhralzz
Copy link
Author

bhralzz commented Sep 21, 2021

but still getting below error in test3d.py
TypeError: init() got an unexpected keyword argument 'mask_num_classes'

when running the command
python3 test3d.py --task brats --split all --bs 5 --ds BraTS20_Valid --net segtran --attractors 1024 --translayers 1 --cpdir ../model/segtran-brats-BraTS20_Train-09211348 --iters 1000
as the train and validation folder path as below:
BraTS20_Train & BraTS20_Valid
and the train3d.py worked correctly in this setting

by removing such keywords worked!

@askerlee
Copy link
Owner

Thank you! Yes it's because I updated datasets3d.py but forgot to update test3d.py. So some useless variables were still there. I've fixed the 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