This project implements a deep learning model to generate medical reports from chest X-ray images. It leverages CLIP for image feature extraction and BioBART for report generation, connected by an MLP. The application provides a Streamlit interface for interactive testing and an evaluation script for comprehensive metric calculation.
.
├── app.py # Streamlit application for interactive testing
├── evaluate.py # Script for comprehensive model evaluation
├── requirements.txt # Python dependencies
└── README.md # Project README file
Clone the repository:
git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
cd test-chest-x-ray
Install dependencies: It's recommended to use a virtual environment.
pip install -r requirements.txt
To run the interactive Streamlit application on Kaggle, follow these steps:
Create a new Kaggle Notebook.
Add necessary data:
best-model-iux-ray (contains vit_biobart_best_model.pt and xray_images folder)data-split-csv (contains Test_Data.csv)/kaggle/input/.Run the following commands in a Kaggle Notebook cell:
# Clone repository
!git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
%cd test-chest-x-ray
# Install requirements
!pip install -r requirements.txt
# Run Streamlit with localtunnel for external access
!streamlit run app.py &>/logs.txt & npx localtunnel --port 8501
# Get the URL (may take a moment to appear)
!cat /logs.txt
You should see an output similar to this: your url is: https://[random-string].loca.lt. Copy this URL and open it in your browser to interact with the Streamlit app.
To run the comprehensive evaluation script on Kaggle:
Create a new Kaggle Notebook or use an existing one.
Add necessary data:
best-model-iux-ray (contains vit_biobart_best_model.pt and xray_images folder)data-split-csv (contains Test_Data.csv)/kaggle/input/.Run the following commands in a Kaggle Notebook cell:
# Clone repository
!git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
%cd test-chest-x-ray
# Install requirements
!pip install -r requirements.txt
# Run the evaluation script
!python evaluate.py
The script will print the evaluation metrics for each sample and the final aggregate metrics to the console. A file named evaluation_results.csv will also be generated in your Kaggle working directory, containing detailed results for each processed sample.
The models are pre-trained and the checkpoint (vit_biobart_best_model.pt) along with the X-ray images (xray_images folder) are expected to be available in the /kaggle/input/best-model-iux-ray/ directory on Kaggle. The test data split (Test_Data.csv) is expected in /kaggle/input/data-split-csv/.
vit_biobart_best_model.pt (part of best-model-iux-ray Kaggle dataset)/kaggle/input/best-model-iux-ray/xray_images//kaggle/input/data-split-csv/Test_Data.csvThe evaluation script calculates the following metrics for each sample and provides their mean and standard deviation across the entire test set:
Feel free to open issues or submit pull requests if you have suggestions, bug fixes, or new features.
This project is licensed under the MIT License - see the LICENSE file for details (if you have one, otherwise remove this section).
This project implements a deep learning model to generate medical reports from chest X-ray images. It leverages CLIP for image feature extraction and BioBART for report generation, connected by an MLP. The application provides a Streamlit interface for interactive testing and an evaluation script for comprehensive metric calculation.
.
├── app.py # Streamlit application for interactive testing
├── evaluate.py # Script for comprehensive model evaluation
├── requirements.txt # Python dependencies
└── README.md # Project README file
Clone the repository:
git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
cd test-chest-x-ray
Install dependencies: It's recommended to use a virtual environment.
pip install -r requirements.txt
To run the interactive Streamlit application on Kaggle, follow these steps:
Create a new Kaggle Notebook.
Add necessary data:
best-model-iux-ray (contains vit_biobart_best_model.pt and xray_images folder)data-split-csv (contains Test_Data.csv)/kaggle/input/.Run the following commands in a Kaggle Notebook cell:
# Clone repository
!git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
%cd test-chest-x-ray
# Install requirements
!pip install -r requirements.txt
# Run Streamlit with localtunnel for external access
!streamlit run app.py &>/logs.txt & npx localtunnel --port 8501
# Get the URL (may take a moment to appear)
!cat /logs.txt
You should see an output similar to this: your url is: https://[random-string].loca.lt. Copy this URL and open it in your browser to interact with the Streamlit app.
To run the comprehensive evaluation script on Kaggle:
Create a new Kaggle Notebook or use an existing one.
Add necessary data:
best-model-iux-ray (contains vit_biobart_best_model.pt and xray_images folder)data-split-csv (contains Test_Data.csv)/kaggle/input/.Run the following commands in a Kaggle Notebook cell:
# Clone repository
!git clone https://github.com/Be-Tap-Code/test-chest-x-ray.git
%cd test-chest-x-ray
# Install requirements
!pip install -r requirements.txt
# Run the evaluation script
!python evaluate.py
The script will print the evaluation metrics for each sample and the final aggregate metrics to the console. A file named evaluation_results.csv will also be generated in your Kaggle working directory, containing detailed results for each processed sample.
The models are pre-trained and the checkpoint (vit_biobart_best_model.pt) along with the X-ray images (xray_images folder) are expected to be available in the /kaggle/input/best-model-iux-ray/ directory on Kaggle. The test data split (Test_Data.csv) is expected in /kaggle/input/data-split-csv/.
vit_biobart_best_model.pt (part of best-model-iux-ray Kaggle dataset)/kaggle/input/best-model-iux-ray/xray_images//kaggle/input/data-split-csv/Test_Data.csvThe evaluation script calculates the following metrics for each sample and provides their mean and standard deviation across the entire test set:
Feel free to open issues or submit pull requests if you have suggestions, bug fixes, or new features.
This project is licensed under the MIT License - see the LICENSE file for details (if you have one, otherwise remove this section).