Coder Social home page Coder Social logo

ratchet's Introduction

RATCHET: RAdiological Text Captioning for Human Examined Thoraxes

RATCHET is a Medical Transformer for Chest X-ray Diagnosis and Reporting. Based on the architecture featured in Attention Is All You Need. This network is trained and validated on the MIMIC-CXR v2.0.0 dataset.

Architecture

RATCHET Architecture

Run the code

Download pretrained weights and put in ./checkpoints folder.

Start streamlit to run the webapp:

streamlit run web_demo.py
Environment:
Python 3.9.10
Packages:
imageio                  2.26.0
matplotlib               3.7.1
numpy                    1.23.5
pandas                   1.5.3
scikit-image             0.20.0
streamlit                1.20.0
tensorflow               2.11.0
tokenizers               0.13.2
tqdm                     4.64.1

Docker Container

Build the docker container:

docker build -t ratchet ./Dockerfile

Run the docker image on CXR images:

docker run --user $(id -u):$(id -g) \
-v /path/to/image_input_folder:/code/RATCHET/inp_folder \
-v /path/to/report_output_folder:/code/RATCHET/out_folder:rw \
-i -t ratchet python run_model.py

Each image in inp_folder would have a corresponding .txt report saved in out_folder.

Results

     Cardiomegaly           Cardiomegaly Attention Plot     

Generated Text:

In comparison with the study of ___, there is little overall change. Again there is substantial enlargement of the cardiac silhouette with a dual-channel pacer device in place. No evidence of vascular congestion or acute focal pneumonia. Blunting of the costophrenic angles is again seen.

More Examples

More Captioning Examples

ratchet's People

Stargazers

 avatar USTC-liuchang avatar masterchen avatar José Domingues avatar Harsha Vishwanadha avatar YONGGI HONG avatar Akash A Desai avatar Isabella avatar ElsieSHEN avatar Jiashuoli98 avatar  avatar  avatar Jun Li avatar Chantal Pellegrini avatar Trần Nguyễn Đức Thọ avatar  avatar Francis Chen avatar Ye TIAN avatar Peilun Dai avatar Peng Xia avatar  avatar Santiago Toledo-Cortés avatar Abhinav Suri avatar  avatar Tiago Filipe Sousa Gonçalves avatar  avatar tianhe2098 avatar Siyuan Yan avatar PENG PEIXI avatar  avatar Jun Wang avatar Luyi avatar  avatar quektc avatar Huaqi (Harvey) Qiu avatar Bernhard Kainz avatar Hadrien Reynaud avatar Cheng avatar

Watchers

James Cloos avatar Bernhard Kainz avatar  avatar  avatar

ratchet's Issues

Training the model using 10% of the dataset

@farrell236
Hey farrell,
Since the dataset is too large can I train the model using only 10% of the dataset? (Currently I don't have enough computational power and other resources to train the model with whole MIMIC-CXR dataset of size ~500GB). If that is possible what are the steps, I need to follow to successfully train the model with only 10% of the dataset. As far as I understand, I may need to,

  • Create the MIMIC_AP_PA_train.csv with only 10% of the original train dataset
  • Create both mimic-merges.txt & mimic-vocab.json from the (10% train + test + validate) data

Other than these do I have to follow any other steps?

Also, instead of DenseNet-121 can't we use something like MobileNetV2 for the encoder?

Used report section

Hi! Thanks for your work and publishing your code.
Which section of the report did you predict? The findings or impression section or both? Or the output of the create_section_files.py, which can be either of them depending on what's included in the report.

Thank you in advance!

DenseNet121 Pre-trained Weights Error

I am using the pre-trained weights in the classifer/assets/ folder and I get the following error when running the code:

ValueError: The name "zero_padding2d" is used 2 times in the model. All layer names should be unique.

Any help would be appreciated.

How to train or evaluate the model?

Considering the training and evaluating the model, how can it be done?
I tried to evaluate the model using python3 evaluate.py but it looks like there is a missing file

FileNotFoundError: [Errno 2] No such file or directory: 'preprocessing/mimic/MIMIC_AP_PA_test.csv'

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.