-
Notifications
You must be signed in to change notification settings - Fork 7
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
assert label.max() == self.num_classes-1, label.max() #24
Comments
comment了这一行后assert label.max() == self.num_classes-1, label.max() |
哈喽,谢谢你提供了很详细的信息来帮助我分析。 我想要指出,你把
修改成
是不正确的,尽管能够跑通。这是因为: 而之所以为什么“config文件里我把test的config改了,因为不改的话找不到数据”,这个是因为这些测试的3D volume不需要进行预处理,因此没有写在预处理的脚本当中。实际上,应该要手动将这几个volume复制粘贴到 我的建议是你先按照我这里说的来重新处理一下数据集(不需要修改config文件),然后再看看会不会出现“label最大值为-1了,是数据载入的问题”这些错误。理应是不会的。 祝好! |
感谢您的回答!请问测试的3D volume在哪里找到呢,我根据您的指示下载 BTCV dataset: Abdomen/RawData.zip. RawData/Testing/img$ ls 感谢您的帮助! |
这些.nii.gz文件就是3D volume呀
nii2format.py中应该有记录所使用的测试集volume是哪些
Tianyu Lin
Master of Science in Biomedical Engineering
Whiting School of Engineering, Johns Hopkins University
…________________________________
From: Han Liu ***@***.***>
Sent: Tuesday, December 10, 2024 9:23:55 PM
To: lin-tianyu/Stable-Diffusion-Seg ***@***.***>
Cc: Tianyu Lin ***@***.***>; Comment ***@***.***>
Subject: Re: [lin-tianyu/Stable-Diffusion-Seg] assert label.max() == self.num_classes-1, label.max() (Issue #24)
感谢您的回答!请问测试的3D volume在哪里找到呢,我根据您的指示下载 BTCV dataset: Abdomen/RawData.zip.
然后用./data/synapse/nii2format.py进行预处理,把预处理后的所有文件都放在了data/synapse下面。RawData下面貌似都是压缩文件
RawData/Testing/img$ ls
img0061.nii.gz img0064.nii.gz img0067.nii.gz img0070.nii.gz img0073.nii.gz img0076.nii.gz img0079.nii.gz
img0062.nii.gz img0065.nii.gz img0068.nii.gz img0071.nii.gz img0074.nii.gz img0077.nii.gz img0080.nii.gz
img0063.nii.gz img0066.nii.gz img0069.nii.gz img0072.nii.gz img0075.nii.gz img0078.nii.gz
感谢您的帮助!
―
Reply to this email directly, view it on GitHub<#24 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ARUIAEO4MMIE7TSKQVKPAGT2E7D6XAVCNFSM6AAAAABTKLT7HSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZTGY3DMOJQG4>.
You are receiving this because you commented.Message ID: ***@***.***>
|
所使用的测试集volume在nii2format.py中:
|
谢谢!我把test文件copy过去后确实测试集上的表现提升了很多 |
作者您好!
我在用您的代码跑实验的时候遇到了这个错误,training可以正常运行10个epoch,在validation的时候崩了,具体error为:
File "/home/server1/Documents/MedSoK/Stable-Diffusion-Seg/main.py", line 405, in log_img
metrics_dict, seg_label_dict = pl_module.log_dice()
File "/home/server1/Documents/hanliu/miniconda3/envs/sdseg/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/server1/Documents/MedSoK/Stable-Diffusion-Seg/ldm/models/diffusion/ddpm.py", line 1688, in log_dice
ema_dice, ema_iou, seg_label_pair = get_dice(data, used_sampler="direct", save_dir=save_dir)
File "/home/server1/Documents/MedSoK/Stable-Diffusion-Seg/ldm/models/diffusion/ddpm.py", line 1682, in get_dice
ema_dice_list, ema_iou_list, seg_label_pair = get_dice_loop(data, sampler,
File "/home/server1/Documents/MedSoK/Stable-Diffusion-Seg/ldm/models/diffusion/ddpm.py", line 1390, in get_dice_loop
assert label.max() == self.num_classes-1, label.max()
AssertionError: tensor(-1.)
我用的命令是:
nohup python -u main.py --base configs/latent-diffusion/synapse-cls2-ldm-kl-8.yaml -t --gpus 0, --name normal > nohup/normal.log 2>&1
数据集为BTCV,看上去是label最大值为-1了,是数据载入的问题。config文件里我把test的config改了,因为不改的话找不到数据,并且我吧BTCV的数据放在了./Stable-Diffusion-Seg/data/synapse/train和./Stable-Diffusion-Seg/data/synapse/test下,具体config为:
data:
target: main.DataModuleFromConfig
params:
batch_size: 4
num_workers: 8
wrap: False
train:
target: ldm.data.synapse.SynapseTrain
params:
size: 256
validation:
target: ldm.data.synapse.SynapseValidation
params:
size: 256
test:
target: ldm.data.synapse.SynapseValidation
params:
size: 256
提前感谢您的帮助!
The text was updated successfully, but these errors were encountered: