PaddlePaddle / PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
https://arxiv.org/abs/2101.06175
Apache License 2.0
8.66k stars 1.68k forks source link

使用SwinUnet在自己的数据集(含有14种器官)上训练多器官分割模型 #3046

Closed SurvivorNo1 closed 8 months ago

SurvivorNo1 commented 1 year ago

问题确认 Search before asking

请提出你的问题 Please ask your question

我需要在自己的数据集上使用SwinUnet训练一个多器官分割模型,但是官方给出的配置文件只有8种器官且数据集处理代码tools/prepare_abdomen.py中也只显示了8种器官,请问一下直接修改配置文件的num_classes大于8,是否可以使用?

if __name__ == "__main__":
    prep = Prep_abdomen()
    prep.generate_dataset_json(
        modalities=('CT', ),
        labels={
            0: 'background',
            1: 'spleen',
            2: 'right kidney',
            3: 'left kidney',
            4: 'gallbladder',
            5: 'liver',
            6: 'stomach',
            7: 'aorta',
            8: 'pancreas'
        },
        dataset_name="Abdomen CT scans",
        dataset_description="Under Institutional Review Board (IRB) supervision, 50 abdomen CT scans of were randomly selected from a combination of an ongoing colorectal cancer chemotherapy trial, and a retrospective ventral hernia study.",
        license_desc="https://creativecommons.org/licenses/by/4.0/legalcode",
        dataset_reference="https://www.synapse.org/#!Synapse:syn3193805/wiki/89480",
    )
    prep.load_save(mode='train')
    prep.load_save(mode='val')
    prep.generate_txt()
shiyutang commented 1 year ago

可以使用,详情可以参考在自己数据上训练的教程:https://github.com/PaddlePaddle/PaddleSeg/blob/develop/contrib/MedicalSeg/README_CN.md#-%E5%9C%A8%E8%87%AA%E5%B7%B1%E7%9A%84%E6%95%B0%E6%8D%AE%E4%B8%8A%E8%AE%AD%E7%BB%83