|
--- |
|
language: en |
|
--- |
|
|
|
# Refined RadImageNet - Conversion Tools |
|
|
|
The RadImageNet dataset is available upon request at [https://www.radimagenet.com/](https://www.radimagenet.com/). |
|
|
|
This repository provides tools to process the RadImageNet dataset, converting it into a refined and stratified organization suitable for various medical imaging applications. |
|
|
|
For detailed information, refer to our preprint paper: [Policy Gradient-Driven Noise Mask](https://arxiv.org/abs/2406.14568). |
|
|
|
If you use this code in your research, please cite our paper: |
|
|
|
```bibtex |
|
@article{yavuz2024policy, |
|
title={Policy Gradient-Driven Noise Mask}, |
|
author={Yavuz, Mehmet Can and Yang, Yang}, |
|
year={2024}, |
|
eprint={2406.14568}, |
|
archivePrefix={arXiv}, |
|
primaryClass={eess.IV} |
|
} |
|
``` |
|
|
|
## Performance Comparison of ResNet Models |
|
|
|
This table compares the performance of ResNet models pretrained on 2D RadImageNet using regular and Two2Three convolution techniques across various metrics: |
|
|
|
| Model | Precision (macro) | Recall (macro) | F1 Score (macro) | Balanced Accuracy | Average Accuracy | |
|
|-----------|-------------------|----------------|------------------|-------------------|------------------| |
|
| ResNet10t | 0.4720 | 0.3848 | 0.3998 | 0.3848 | 0.7981 | |
|
| ResNet18 | 0.5150 | 0.4383 | 0.4545 | 0.4383 | 0.8177 | |
|
| ResNet50 | 0.5563 | 0.4934 | 0.5097 | 0.4934 | 0.8352 | |
|
|
|
We recommend adapting the code for benchmarking other models, which can be found here: [https://github.com/pytorch/vision/tree/main/references/classification](https://github.com/pytorch/vision/tree/main/references/classification). |
|
|
|
## ResNet Models and Weights |
|
|
|
The model weights are shared through [https://huggingface.co/convergedmachine/RadImagenet](https://huggingface.co/convergedmachine/RadImagenet). |
|
|
|
To create a model using the `timm` library: |
|
|
|
```python |
|
import timm |
|
model = timm.create_model('resnet10t', num_classes=165) |
|
``` |
|
|
|
Replace `'resnet10t'` with `'resnet18'` or `'resnet50'` as needed. |
|
|
|
## Folder Structure |
|
|
|
``` |
|
correction_masks/ |
|
data/ |
|
weights/ |
|
output/ |
|
source/ |
|
correction_masks.tar.gz |
|
radimagenet.tar.gz |
|
RadiologyAI_test.csv |
|
RadiologyAI_train.csv |
|
RadiologyAI_val.csv |
|
process.py |
|
measure_acc_metrics.py |
|
``` |
|
|
|
### Files & Directories |
|
|
|
- **correction_masks/**: Contains correction masks for the images. |
|
- **data/**: Contains the extracted radiology images. |
|
- **weights/**: Directory for model weights. |
|
- **output/**: Directory for output files. |
|
- **source/**: Contains source files and datasets. |
|
- **correction_masks.tar.gz**: Compressed file containing correction masks. |
|
- **radimagenet.tar.gz**: Compressed RadImageNet dataset. |
|
- **RadiologyAI_test.csv**: CSV file for the test dataset. |
|
- **RadiologyAI_train.csv**: CSV file for the training dataset. |
|
- **RadiologyAI_val.csv**: CSV file for the validation dataset. |
|
- **process.py**: Main script to process and organize the RadImageNet files. |
|
- **measure_acc_metrics.py**: Script to measure accuracy metrics. |
|
|
|
## Download Processing Files |
|
|
|
This repository contains files from the Hugging Face repository `convergedmachine/Refined-RadImagenet`. Follow the instructions below to clone the repository using Git. |
|
|
|
### Prerequisites |
|
|
|
Ensure that Git LFS (Large File Storage) is installed: |
|
|
|
```bash |
|
git lfs install |
|
``` |
|
|
|
### Cloning the Repository |
|
|
|
To clone the entire repository to your local machine: |
|
|
|
```bash |
|
git clone https://huggingface.co/convergedmachine/Refined-RadImagenet source/ |
|
``` |
|
|
|
This command clones all files from the repository into a directory named `source`. |
|
|
|
### Notes |
|
|
|
- Ensure you have sufficient storage space for large files. |
|
- For more information about this dataset, visit the [Hugging Face page](https://huggingface.co/convergedmachine/Refined-RadImagenet). |
|
|
|
Feel free to contribute or raise issues if you encounter any problems. |
|
|
|
## Usage |
|
|
|
1. **Extract the Dataset**: |
|
|
|
```bash |
|
python process.py |
|
``` |
|
|
|
Ensure the dataset tar file is located in the `source/` directory. The script will automatically extract it to the `data/` directory. |
|
|
|
2. **Process the Images**: |
|
|
|
The script will read the CSV files, refine the images, and organize them accordingly. |
|
|
|
## Dependencies |
|
|
|
- Python 3.9+ |
|
- pandas |
|
- OpenCV |
|
- tarfile |
|
- tqdm |
|
- numpy |
|
|
|
Install the required packages using pip: |
|
|
|
```bash |
|
pip install pandas opencv-python tarfile tqdm numpy |
|
``` |
|
|
|
--- |
|
license: cc-by-2.0 |
|
--- |
|
|