Giter Site home page Giter Site logo

transmil's Introduction

README

环境配置

参照https://github.com/zldscr0/WSI-FT中p39环境的配置,其他依赖项通过执行下面的指令安装。

 pip install -r requirement.txt

数据集

WSI Segmentation and Patching
CUDA_VISIBLE_DEVICES=0,1 python extract_features_fp.py --data_h5_dir DIR_TO_COORDS --data_slide_dir DATA_DIRECTORY --csv_path CSV_FILE_NAME --feat_dir FEATURES_DIRECTORY --batch_size 512 --slide_ext .svs
Feature Extraction
CUDA_VISIBLE_DEVICES=0,1 python extract_features_fp.py --data_h5_dir DIR_TO_COORDS --data_slide_dir DATA_DIRECTORY --csv_path CSV_FILE_NAME --feat_dir FEATURES_DIRECTORY --batch_size 512 --slide_ext .svs

这两个处理数据集的部分也可以直接使用之前的WSI-finetuning复现中写的两个脚本https://github.com/zldscr0/WSI-FT

处理好的图像在本地服务器上存储位置为/data/Colon/feat_dir

参数修改

1.修改TransMIL.yaml中的

dataset_name:数据集名称,需同TransMIL/datasets下的数据集构造相关的.py文件一一对应。

data_dir:CLAM框架执行完提取特征(上述的Feature Extraction)后的.pt文件

label_dir:存带标签信息(已经划分好训练集、测试集和验证集)的.csv文件的目录,.csv的文件示例参照代码库中的dataset_csv/final.csv

image-20230926084626349

2.修改TransMIL.yaml中的其他相关超参数开始运行。

train

python train.py --stage='train' --config='TransMIL.yaml'  --gpus=0 --fold=0
训练过程截图

image-20230926091511801

最优模型

自动保存在logs/下,训练过程中验证集的结果存在metrics.csv

image-20230926091621266

test

对最优模型进行测试:

python train.py --stage='test' --config='TransMIL.yaml'  --gpus=0 --fold=0
测试结果

logs/fold0/result.csv

image-20230925090413156

Loss图

image-20230926092242051

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.