nnunetv2系列: 导出模型参数文件和配置文件成zip压缩包

nnunetv2系列: 导出模型参数文件和配置文件成zip压缩包

根据nnUNetv2_export_model_to_zip命令在pyproject.toml文件中查找到nnUNetv2_export_model_to_zip = "nnunetv2.model_sharing.entry_points:export_pretrained_model_entry"信息,那么在nnunetv2.model_sharing.entry_points.py文件中可以看到export_pretrained_model_entry定义的相关的参数和默认值。
我们也可以通过命令nnUNetv2_export_model_to_zip -h直接获取相关的参数信息。
这里仅提供五折中的一折的模型参数文件和配置文件,如果需要全部的模型参数文件和配置文件,需要修改nnUNetv2_export_model_to_zip命令中的-f参数,默认是五折。

查看参数和说明

nnUNetv2_export_model_to_zip -h
# 运行结果:
# usage: nnUNetv2_export_model_to_zip [-h] -d D -o O [-c C [C ...]] [-tr TR] [-p P] [-f F [F ...]] [-chk CHK [CHK ...]] [--not_strict]
#                                     [--exp_cv_preds]

# Use this to export a trained model as a zip file.

# options:
# -h, --help          show this help message and exit
# -d D                Dataset name or id
# -o O                Output file name
# -c C [C ...]        List of configuration names
# -tr TR              Trainer class
# -p P                plans identifier
# -f F [F ...]        list of fold ids
# -chk CHK [CHK ...]  Lis tof checkpoint names to export. Default: checkpoint_final.pth
# --not_strict        Set this to allow missing folds and/or configurations
# --exp_cv_preds      Set this to export the cross-validation predictions as well

终端执行命令示例

nnUNetv2_export_model_to_zip \
-d 500 \
-c 2d \
-tr nnUNetTrainer \
-p nnUNetPlans \
-f 0 \
-chk checkpoint_best.pth \
-o /home/xxx/nnUNet/nnUNet_results/xxx/export_model.zip
# 提示信息
# Configuration 2d
# Exporting fold_0
# No ensemble directory found for task xxx

export_model.zip目录结构

xxx/
├── nnUNetTrainer__nnUNetPlans__2d/
│   ├── fold_0/
    │   ├── checkpoint_best.pth
    │   ├── debug.json
    │   ├── progress.png
    |   ├── validation/
    │   │   ├── summary.json
│   ├── dataset_fingerprint.json
│   ├── dataset.json
│   ├── plans.json

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值