【原创】nnUnet V1在win11下的安装与配置

安装之前可以先了解一下论文的主要内容,便于之后网络训练与推理,调试程序。

论文地址:nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation | Nature Methods

也可以从其他博客快速浏览:论文解读- nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation(附实现教程)_nnunet self adaptinng-CSDN博客

如果想跟官网github一样在ubuntu下安装参考:nnUNet保姆级使用教程!从环境配置到训练与推理(新手必看)-CSDN博客


1.本博客是在win11安装,前期Anaconda的虚拟环境自己配置好,然后下载好nnUnet v1的安装包,然后解压在该目中运行:

pip install -e .

如果需要观察模型的网络结构图可以安装hiddenlayer:

nnUNet给出的指令:

pip install --upgrade git+https://github.com/FabianIsensee/hiddenlayer.git@more_plotted_details#egg=hiddenlayer

 上面指令自己运行报错:

× git clone --filter=blob:none --quiet https://github.com/FabianIsensee/hiddenlayer.git 'C:\Users\Administrator\AppData\Local\Temp\pip-install-dh84s7ac\hiddenlayer_be2e7545caf44fbeae10f5b0cfd81e30' did not run successfully,可能是网络原因。干脆直接从hiddenlayer官网的指令进行安装(顺利安装):

pip install git+https://github.com/waleedka/hiddenlayer.git

 2.开始准备推理的数据,注意它的格式要求,开始体验一下如何用官网模型进行infer使用:

查看nnUNet提供的预训练好的模型:

nnUNet_print_available_pretrained_models
Task001_BrainTumour
Brain Tumor Segmentation.
Segmentation targets are edema, enhancing tumor and necrosis,
Input modalities are 0: FLAIR, 1: T1, 2: T1 with contrast agent, 3: T2.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task002_Heart
Left Atrium Segmentation.
Segmentation target is the left atrium,
Input modalities are 0: MRI.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task003_Liver
Liver and Liver Tumor Segmentation.
Segmentation targets are liver and tumors,
Input modalities are 0: abdominal CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task004_Hippocampus
Hippocampus Segmentation.
Segmentation targets posterior and anterior parts of the hippocampus,
Input modalities are 0: MRI.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task005_Prostate
Prostate Segmentation.
Segmentation targets are peripheral and central zone,
Input modalities are 0: T2, 1: ADC.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task006_Lung
Lung Nodule Segmentation.
Segmentation target are lung nodules,
Input modalities are 0: abdominal CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task007_Pancreas
Pancreas Segmentation.
Segmentation targets are pancras and pancreas tumor,
Input modalities are 0: abdominal CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task008_HepaticVessel
Hepatic Vessel Segmentation.
Segmentation targets are hepatic vesels and liver tumors,
Input modalities are 0: abdominal CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task009_Spleen
Spleen Segmentation.
Segmentation target is the spleen,
Input modalities are 0: abdominal CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task010_Colon
Colon Cancer Segmentation.
Segmentation target are colon caner primaries,
Input modalities are 0: CT scan.
Also see Medical Segmentation Decathlon, http://medicaldecathlon.com/Task017_AbdominalOrganSegmentation
Multi-Atlas Labeling Beyond the Cranial Vault - Abdomen.
Segmentation targets are thirteen different abdominal organs,
Input modalities are 0: abdominal CT scan.
Also see https://www.synapse.org/#!Synapse:syn3193805/wiki/217754Task024_Promise
Prostate MR Image Segmentation 2012.
Segmentation target is the prostate,
Input modalities are 0: T2.
Also see https://promise12.grand-challenge.org/Task027_ACDC
Automatic Cardiac Diagnosis Challenge.
Segmentation targets are right ventricle, left ventricular cavity and left myocardium,
Input modalities are 0: cine MRI.
Also see https://acdc.creatis.insa-lyon.fr/Task029_LiTS
Liver and Liver Tumor Segmentation Challenge.
Segmentation targets are liver and liver tumors,
Input modalities are 0: abdominal CT scan.
Also see https://competitions.codalab.org/competitions/17094Task035_ISBILesionSegmentation
Longitudinal multiple sclerosis lesion segmentation Challenge.
Segmentation target is MS lesions,
input modalities are 0: FLAIR, 1: MPRAGE, 2: proton density, 3: T2.
Also see https://smart-stats-tools.org/lesion-challengeTask038_CHAOS_Task_3_5_Variant2
CHAOS - Combined (CT-MR) Healthy Abdominal Organ Segmentation Challenge (Task 3 & 5).
Segmentation targets are left and right kidney, liver, spleen,
Input modalities are 0: T1 in-phase, T1 out-phase, T2 (can be any of those)
Also see https://chaos.grand-challenge.org/Task048_KiTS_clean
Kidney and Kidney Tumor Segmentation Challenge. Segmentation targets kidney and kidney tumors, Input modalities are 0: abdominal CT scan. Also see https://kits19.grand-challenge.org/Task055_SegTHOR
SegTHOR: Segmentation of THoracic Organs at Risk in CT images.
Segmentation targets are aorta, esophagus, heart and trachea,
Input modalities are 0: CT scan.
Also see https://competitions.codalab.org/competitions/21145Task061_CREMI
MICCAI Challenge on Circuit Reconstruction from Electron Microscopy Images (Synaptic Cleft segmentation task).
Segmentation target is synaptic clefts,
Input modalities are 0: serial section transmission electron microscopy of neural tissue.
Also see https://cremi.org/Task075_Fluo_C3DH_A549_ManAndSim
Fluo-C3DH-A549-SIM and Fluo-C3DH-A549 datasets of the cell tracking challenge. Segmentation target are C3DH cells in fluorescence microscopy images.
Input modalities are 0: fluorescence_microscopy
Also see http://celltrackingchallenge.net/Task076_Fluo_N3DH_SIM
Fluo-N3DH-SIM dataset of the cell tracking challenge. Segmentation target are N3DH cells and cell borders in fluorescence microscopy images.
Input modalities are 0: fluorescence_microscopy
Also see http://celltrackingchallenge.net/
Note that the segmentation output of the models are cell center and cell border. These outputs mus tbe converted to an instance segmentation for the challenge.
See https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/dataset_conversion/Task076_Fluo_N3DH_SIM.pyTask082_BraTS2020
Brain tumor segmentation challenge 2020 (BraTS)
Segmentation targets are 0: background, 1: edema, 2: necrosis, 3: enhancing tumor
Input modalities are 0: T1, 1: T1ce, 2: T2, 3: FLAIR (MRI images)
Also see https://www.med.upenn.edu/cbica/brats2020/Task089_Fluo-N2DH-SIM_thickborder_time
Fluo-N2DH-SIM dataset of the cell tracking challenge. Segmentation target are nuclei of N2DH cells and cell borders in fluorescence microscopy images.
Input modalities are 0: t minus 4, 0: t minus 3, 0: t minus 2, 0: t minus 1, 0: frame of interest
Note that the input channels are different time steps from a time series acquisition
Note that the segmentation output of the models are cell center and cell border. These outputs mus tbe converted to an instance segmentation for the challenge.
See https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/dataset_conversion/Task089_Fluo-N2DH-SIM.py
Also see http://celltrackingchallenge.net/Task114_heart_MNMs
Cardiac MRI short axis images from the M&Ms challenge 2020.
Input modalities are 0: MRI
See also https://www.ub.edu/mnms/
Note: Labels of the M&Ms Challenge are not in the same order as for the ACDC challenge.
See https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/dataset_conversion/Task114_heart_mnms.pyTask115_COVIDSegChallenge
Covid lesion segmentation in CT images. Data originates from COVID-19-20 challenge.
Predicted labels are 0: background, 1: covid lesion
Input modalities are 0: CT
See also https://covid-segmentation.grand-challenge.org/Task135_KiTS2021
Kidney and kidney tumor segmentation in CT images. Data originates from KiTS2021 challenge.
Predicted labels are 0: background, 1: kidney, 2: tumor, 3: cyst
Input modalities are 0: CT
See also https://kits21.kits-challenge.org/Task169_BrainTumorPET
Brain tumor segmentation in FET PET images. Data originates from the Research Center Jülich, Germany.
Predicted labels are 0: background, 1: tumor
Input modalities are 0: FET PET
See also (NOT YET AVAILABLE)

 需要类似于ubuntu系统下一样,设置环境临时变量:

set RESULTS_FOLDER=自己的硬盘根目录\nnUNet-nnunetv1\dataset\nnUNet_trained_models
set nnUNet_raw_data_base=自己的硬盘根目录\nnUNet-nnunetv1\dataset\nnUNet_raw
set nnUNet_preprocessed=自己的硬盘根目录\nnUNet-nnunetv1\dataset\nnUNet_preprocessed是否设置成功,可以通过
echo %RESULTS_FOLDER%
echo %nnUNet_raw_data_base%
echo %nnUNet_preprocessed%

3. 推理之前需要将数据按照nnUNet要求进行格式转换:

由于ubuntu跟win11系统路径格式不一样(不懂可以看下区别),需要提前修改相应的程序:

1)nnUNet_convert_decathlon_task.py中22行的“folder.split('/')[-1]”改成“folder.split('\\')[-1]”。

2)utils.py中40行的input_folder.split("/")[-1]改成input_folder.split("\\")[-1]

3) common_utils.py中26行的filename.split("/")[-1]改成filename.split("\\")[-1]

然后,根据数据格式转换说明:

nnUNet_convert_decathlon_task -i FOLDER_TO_TASK_AS_DOWNLOADED_FROM_MSD -p NUM_PROCESSES

具体指令:

nnUNet_convert_decathlon_task -i 自己存放数据集的路径\Task05_Prostate

运行结果目录如下:

以imagesTs为例:

按照官网进行数据预处理:

nnUNet_plan_and_preprocess -t XXX --verify_dataset_integrity

 XXX表示任务号;

nnUNet_plan_and_preprocess -t 005 --verify_dataset_integrity

4. 运行推理程序:

范例:
nnUNet_predict -i INPUT_FOLDER -o OUTPUT_FOLDER -t TASK_NAME_OR_ID 
-m CONFIGURATION --save_npz

 这里需要注意一定要修改cropping.py中123行的i.split("/")[-1][:-4],将其修改为i.split("\\")[-1][:-4]。否则会报错误(这个错误很隐蔽,网上查了很多资料没有解决,一句句打断点找到的问题所在,debug不易,趟掉很多坑):

“return _nx.concatenate(arrs, 0, dtype=dtype, casting=casting)
ValueError: need at least one array to concatenate”

检测一下nnUNet_cropped_data是否生成了预处理的文件(*.npz和*.pkl): 

 

nnUNet_predict -i 自己的路径\nnUNet_raw\nnUNet_raw_data\Task005_Prostate\imagesTs -o 自己的路径\nnUNet_raw\nnUNet_raw_data\Task005_Prostate\inferTs -t 5 -m 3d_fullres -f 0

运行结果:

推理后得到标注结果:

现在已基本掌握了如何利用nnUNet以后模型进行推理,先会用再学如何利用自己的数据进行训练,之后重点讲如何自定义训练。这篇博客主要是为了解决nnUNet如何在win11环境中解决数据转换和数据预处理,以及如何模型推理。目前国内win11环境安装配置为此独一份,原创来之不易,点赞收藏,后期更精彩。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1421170.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

google test 使用指南

目录 测试项目 calculator.h calculator.cpp test01.cpp 创建新项目 选择Google Test 选择要测试的项目 pch.cpp 加入依赖 设为启动项目 ​编辑 运行 ​编辑 关键点 测试项目 calculator.h #ifndef __CALCULATOR_H__ #define __CALCULATOR_H__#include <i…

创新案例|为何农夫山泉创新战略升级为一家零售科技公司

农夫山泉上市的消息被公之于众后&#xff0c;几乎所有人都将目光投向了这家国内家喻户晓的饮料公司&#xff0c;谁都想第一时间内窥探它的庐山真面目。 当然&#xff0c;在此之前已经有多路消息通过旁敲侧击&#xff0c;从管窥中获取了一些农夫山泉的真实数据。 去年6月&…

【2024新版】龙年新版ui周易测算网站H5源码/在线起名网站源码/运势测算网站系统源码

>>>功能说明&#xff1a; 1、系统配置&#xff1a;系统基本配置、测算价格配置、在线预约配置、系统信息配置、代理分成配置、推广积分配置、VIP价格配置、账号管理 2、推广管理&#xff1a;我的信息、推广链接、订单管理、体现管理 3、付费应用&#xff0c;订单管…

【C语言项目】贪吃蛇(下)

个人主页~ 源码在Gitee仓库~ 上一篇贪吃蛇&#xff08;上&#xff09;~ 贪吃蛇 四、核心的实现游戏测试1、GameStart&#xff08;1&#xff09;控制台窗口大小和名字设置&#xff08;2&#xff09;光标隐藏&#xff08;3&#xff09;打印欢迎界面&#xff08;4&#xff09;创建…

富阳区石弹村全景图-没拍到景点内容

- - - 石梯山庄旁停车场拍摄 建议雨后去 整个山到处都是消息 整座山都在渗水

云原生技术解析

云原生的概念 云原生是一种软件架构和部署方法&#xff0c;旨在利用云计算的优势&#xff0c;以更灵活、可扩展和可靠的方式构建和部署应用程序。它主要关注在容器、微服务、自动化和持续交付等方面。 云原生技术是指以云计算作为基础&#xff0c;以平台和工具为依托&#xff0…

鸿蒙HarmonyOS开发:List列表组件的使用详解及案例演示(二)

文章目录 一、List组件简介1、List组件2、ListItem组件3、ListItemGroup组件 二、使用ForEach渲染列表三、设置列表分割线四、设置List排列方向五、索引值计算规则六、示例演示1、AlphabetIndexer组件2、代码3、效果 一、List组件简介 在我们常用的手机应用中&#xff0c;经常…

Redis继续(黑马)

Redis持久化 RDB与AOF RDB记录是二进制数据&#xff0c;Redis停机时会触发保存&#xff0c;名称&#xff1a; dump.rdb 缺点&#xff1a;间歇式复制可能存在宕机数据更新丢失 AOF 记录的写操作命令&#xff0c;每秒记录一下&#xff0c;也存在数据更新丢失的可能&#xff0c;相…

7. path路径绘制:使用path绘制曲线

曲线在SVG中通常是通过贝塞尔曲线命令来绘制的&#xff0c;包括二次贝塞尔曲线&#xff08;Q&#xff09;和三次贝塞尔曲线&#xff08;C&#xff09;。这些命令允许我们创建平滑的曲线路径。 贝塞尔曲线的原理 贝塞尔曲线的基本原理是通过控制点和锚点来定义一条曲线的形状。…

Shell循环语句之while

一.while语句 重复测试某个条件&#xff0c;只要条件成立则反复执行 whlie 条件测试操作 do 命令序列 done 示例&#xff1a; 1.计算1到100所有整数的和 2.提示用户输入一个小于100的整数&#xff0c;并计算从1到该数之间所有整数的和 3.求从1到100所有整数的偶数和、奇数和…

基于Springboot的家教管理系统(有报告)。Javaee项目,springboot项目。

演示视频&#xff1a; 基于Springboot的家教管理系统&#xff08;有报告&#xff09;。Javaee项目&#xff0c;springboot项目。 项目介绍&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09;三层体系结构&…

JVM 类的使用与卸载

文章目录 1. 类的使用2. 类的卸载2.1 类、类的加载器、类的实例之间的引用关系2.2 何种情况会被卸载2.3 类卸载在实际生产中情况如何2.4 方法区的垃圾回收 上一篇文章: JVM 类的加载过程详解 介绍了类的加载过程, 这篇文章来介绍类在完成加载后的使用及其卸载. 1. 类的使用 任何…

设计模式-结构型-适配器模式-Adapter

地址类 public class Address {public void street() {System.out.println("普通的街道");}public void zip() {System.out.println("普通的邮政编码");}public void city() {System.out.println("普通的城市");} } 荷兰地址类 public class …

青蒿素优化算法(AO)-2024年新算法-公式原理详解与性能测评 Matlab代码免费获取

声明&#xff1a;文章是从本人公众号中复制而来&#xff0c;因此&#xff0c;想最新最快了解各类智能优化算法及其改进的朋友&#xff0c;可关注我的公众号&#xff1a;强盛机器学习&#xff0c;不定期会有很多免费代码分享~ 目录 原理简介 一、初始化阶段 二、综合淘汰阶…

GPT 大型语言模型可视化教程

网址&#xff1a; LLM Visualization 简介 欢迎来到 GPT 大型语言模型演练&#xff01;在这里&#xff0c;我们将探索只有 85,000 个参数的 nano-gpt 模型。 它的目标很简单&#xff1a;取一个由六个字母组成的序列&#xff1a; C B A B B C 并按字母顺序排列&#xff0c;即…

微软为美国情报机构打造定制GPT-4

近日&#xff0c;微软公司宣布成功为美国情报机构打造了一款定制化的GPT-4生成式AI模型&#xff0c;该模型与互联网完全断开连接&#xff0c;标志着大型语言模型首次在安全环境中得到应用。这项技术突破将为情报分析工作带来革命性的变革&#xff0c;同时也引发了业界对人工智能…

poll 机制

poll 机制 一、poll机制概述二、使用流程三、编程3.1 驱动编程3.1 应用编程 四、POLL 机制的内核代码详解五、编译后上机实验 poll 机制与休眠唤醒机制的区别&#xff1a; 休眠唤醒方式时&#xff0c;进程如果没有得到唤醒信号&#xff0c;需要一直休眠&#xff0c;进程就干不了…

练习队列的相关操作:循环队列

1. 思路解析 循环队列就是在只有有限的空间时使用队列实现循环存储数据&#xff0c;有双向链表和数组两种选择&#xff0c;这里我们使用数组实现循环队列&#xff08;因为链表我不会 >-<&#xff09; 2. 相关函数及其实现 2.1 判空与判满 判空&#xff1a;直接返回头尾…

---随笔--Java实现TCP通信(双端通信接收与发送)

---随笔--Java实现TCP通信&#xff08;双端通信接收与发送&#xff09; 引言1. 什么是TCP通信2. 服务器与客户端核心代码2.1 服务器ServerSocket端核心代码2.2 用户Socket端核心代码2.3 小贴士之关于try-with-resources自动关闭资源的使用 3. 具体服务器端实现4. 具体客户端实现…

ONES 功能上新 | 近期产品新功能一览

支持在 ONES Project 中通过弹窗查看、编辑 ONES Wiki 页面。 应用场景&#xff1a; 当需要在 ONES Project 中查看 ONES Wiki 的页面内容时&#xff0c;可以直接点击工作项关联的 ONES Wiki 页面或项目文档组件中的页面&#xff0c;即可在 ONES Project 中通过弹窗查看 ONES W…