File size: 4,585 Bytes
c37da31
 
 
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
 
 
e493c37
c37da31
 
e493c37
 
 
 
c37da31
 
a2add9d
 
 
c37da31
a2add9d
c37da31
 
 
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
6566192
a2add9d
c37da31
a2add9d
c37da31
 
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
 
 
 
 
 
 
 
 
 
 
 
 
 
a2add9d
c37da31
a2add9d
c37da31
 
 
 
 
 
 
 
 
 
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
 
a2add9d
 
c37da31
 
 
 
 
6566192
c37da31
 
 
 
 
 
 
 
 
 
 
 
a2add9d
c37da31
a2add9d
c37da31
a2add9d
c37da31
 
 
 
 
 
 
 
 
 
 
 
 
 
a2add9d
 
a86589a
a2add9d
a1dae3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
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
@inproceedings{yavuz2025policy,
  title={Policy Gradient-Driven Noise Mask},
  author={Yavuz, Mehmet Can and Yang, Yang},
  booktitle={International Conference on Pattern Recognition},
  pages={414--431},
  year={2025},
  organization={Springer}
}
```

## 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 codes are shared through [https://github.com/convergedmachine/Refined-RadImagenet/](https://github.com/convergedmachine/Refined-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 [Github page](https://github.com/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
---
This project is licensed under the MIT License.