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

How to test Synapse? #22

Open
onion-LHJ opened this issue Jun 5, 2024 · 0 comments
Open

How to test Synapse? #22

onion-LHJ opened this issue Jun 5, 2024 · 0 comments

Comments

@onion-LHJ
Copy link

Hi, for Synapse datasets (this is somehow different from ACDC and prostate), please import the dataset:

from dataloaders.dataset import BaseDataSets_Synapse

and then replace the orginal dataset.

and the bugs indicates the evaluation metrics error. This is not a significant problems, and I guess you could just potentially not use the HD95 metrics, that would be fine. because ths loss is based on dice, not HD95.

hi, have you tried to train a model with 10,000 iterations? or 30,000 iterations?

Thanks.

It did works!But I got a new trouble when i run test_2D_fully.py
I ran as :
python test_2D_fully.py --root_path ../data/Synapse --exp Synapse/VIM --model mambaunet --num_classes 9 --labeled_num 8
And then got a bug:
test_2D_fully.py:12: DeprecationWarning: Please use zoom from the scipy.ndimage namespace, the scipy.ndimage.interpolation namespace is deprecated.
from scipy.ndimage.interpolation import zoom
=> merge config from ../code/configs/swin_tiny_patch4_window7_224_lite.yaml
None
../model/Synapse/VIM_8_labeled/mambaunet/mambaunet_best_model.pth
Traceback (most recent call last):
File "test_2D_fully.py", line 125, in
metric = Inference(FLAGS)
File "test_2D_fully.py", line 105, in Inference
net.load_state_dict(torch.load(save_mode_path))
AttributeError: 'NoneType' object has no attribute 'load_state_dict'

Notice net is a None type.I trace back in networks.net_factory ,and found:
def net_factory(net_type="unet", in_chns=1, class_num=4):
if net_type == "unet":
net = UNet(in_chns=in_chns, class_num=class_num).cuda()
elif net_type == "enet":
net = ENet(in_channels=in_chns, num_classes=class_num).cuda()
elif net_type == "unet_ds":
net = UNet_DS(in_chns=in_chns, class_num=class_num).cuda()
elif net_type == "unet_cct":
net = UNet_CCT(in_chns=in_chns, class_num=class_num).cuda()
elif net_type == "unet_urpc":
net = UNet_URPC(in_chns=in_chns, class_num=class_num).cuda()
elif net_type == "efficient_unet":
net = Effi_UNet('efficientnet-b3', encoder_weights='imagenet',
in_channels=in_chns, classes=class_num).cuda()
elif net_type == "ViT_Seg" :#or "mambaunet"
net = ViT_seg(config, img_size=args.patch_size,
num_classes=args.num_classes).cuda()
elif net_type == "pnet":
net = PNet2D(in_chns, class_num, 64, [1, 2, 4, 8, 16]).cuda()
elif net_type == "nnUNet":
net = initialize_network(num_classes=class_num).cuda()
else:
net = None
return net

It mean that model" mambaunet" actually has no net

I dont konw how to solve it .
Thank a lot for your reply!And could you please help me for the new problem?Thanks again!

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

1 participant