Modelos de rt26
Browse files- README.md +126 -0
- covid_19_densenet121.pth +3 -0
- covid_19_efficientnet_b0.pth +3 -0
- covid_19_resnet50.pth +3 -0
- pneumonia_densenet121.pth +3 -0
- pneumonia_efficientnet_b0.pth +3 -0
- pneumonia_resnet50.pth +3 -0
- tuberculosis_densenet121.pth +3 -0
- tuberculosis_efficientnet_b0.pth +3 -0
- tuberculosis_resnet50.pth +3 -0
- unet_resnet34_best.pth +3 -0
README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
language:
|
| 4 |
+
- es
|
| 5 |
+
library_name: pytorch
|
| 6 |
+
pipeline_tag: image-classification
|
| 7 |
+
tags:
|
| 8 |
+
- medical-imaging
|
| 9 |
+
- chest-x-ray
|
| 10 |
+
- pneumonia
|
| 11 |
+
- covid-19
|
| 12 |
+
- tuberculosis
|
| 13 |
+
- lung-segmentation
|
| 14 |
+
- research
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# rt26 · modelos
|
| 18 |
+
|
| 19 |
+
Pesos de los modelos del proyecto [rt26](https://github.com/JRLR22/SADEPMRT), un prototipo de investigación
|
| 20 |
+
que analiza radiografías de tórax para apoyar la detección de neumonía, COVID-19 y tuberculosis.
|
| 21 |
+
|
| 22 |
+
> **No es un dispositivo médico.** No está validado clínicamente y sus resultados no constituyen un
|
| 23 |
+
> diagnóstico. Úsalos solo para investigación y docencia.
|
| 24 |
+
|
| 25 |
+
## Archivos
|
| 26 |
+
|
| 27 |
+
| Archivo | Arquitectura | Tarea | Tamaño |
|
| 28 |
+
| --- | --- | --- | --- |
|
| 29 |
+
| `pneumonia_densenet121.pth` | DenseNet121 | Normal / neumonía | 27,1 MB |
|
| 30 |
+
| `pneumonia_resnet50.pth` | ResNet50 | Normal / neumonía | 90,0 MB |
|
| 31 |
+
| `pneumonia_efficientnet_b0.pth` | EfficientNet-B0 | Normal / neumonía | 15,6 MB |
|
| 32 |
+
| `covid_19_densenet121.pth` | DenseNet121 | Normal / COVID-19 | 27,1 MB |
|
| 33 |
+
| `covid_19_resnet50.pth` | ResNet50 | Normal / COVID-19 | 90,0 MB |
|
| 34 |
+
| `covid_19_efficientnet_b0.pth` | EfficientNet-B0 | Normal / COVID-19 | 15,6 MB |
|
| 35 |
+
| `tuberculosis_densenet121.pth` | DenseNet121 | Normal / tuberculosis | 27,1 MB |
|
| 36 |
+
| `tuberculosis_resnet50.pth` | ResNet50 | Normal / tuberculosis | 90,0 MB |
|
| 37 |
+
| `tuberculosis_efficientnet_b0.pth` | EfficientNet-B0 | Normal / tuberculosis | 15,6 MB |
|
| 38 |
+
| `unet_resnet34_best.pth` | U-Net (encoder ResNet34) | Segmentación pulmonar | 93,4 MB |
|
| 39 |
+
|
| 40 |
+
Cada archivo contiene solo `{"model_state_dict": ...}`, sin estado del optimizador ni historial de
|
| 41 |
+
entrenamiento, y se puede abrir con `torch.load(..., weights_only=True)`.
|
| 42 |
+
|
| 43 |
+
Los tres clasificadores de cada enfermedad forman un ensemble: la aplicación promedia sus probabilidades
|
| 44 |
+
(*soft voting*). Entrada: radiografía en escala de grises convertida a 3 canales, 224×224, normalizada
|
| 45 |
+
con la media y desviación de ImageNet. La U-Net recibe 1 canal a 512×512.
|
| 46 |
+
|
| 47 |
+
## Uso
|
| 48 |
+
|
| 49 |
+
La forma prevista es a través del repositorio de rt26, que los descarga y comprueba con
|
| 50 |
+
`python backend/download_models.py`. Para cargarlos por separado:
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
import torch, torchvision
|
| 54 |
+
from huggingface_hub import hf_hub_download
|
| 55 |
+
|
| 56 |
+
path = hf_hub_download("JRLR22/rt26-models", "pneumonia_densenet121.pth")
|
| 57 |
+
model = torchvision.models.densenet121(weights=None)
|
| 58 |
+
model.classifier = torch.nn.Linear(model.classifier.in_features, 2)
|
| 59 |
+
model.load_state_dict(torch.load(path, map_location="cpu", weights_only=True)["model_state_dict"])
|
| 60 |
+
model.eval()
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Datos de entrenamiento
|
| 64 |
+
|
| 65 |
+
| Modelos | Dataset | Licencia |
|
| 66 |
+
| --- | --- | --- |
|
| 67 |
+
| Neumonía | [Chest X-Ray Images (Pneumonia)](https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia): Kermany, Zhang y Goldbaum, Mendeley Data, DOI [10.17632/rscbjbr9sj.2](https://doi.org/10.17632/rscbjbr9sj.2). Pacientes pediátricos de 1 a 5 años | CC BY 4.0 |
|
| 68 |
+
| COVID-19 | [COVID-19 Radiography Database](https://www.kaggle.com/datasets/tawsifurrahman/covid19-radiography-database): Chowdhury, Rahman, Khandakar et al. | Ver la página del dataset |
|
| 69 |
+
| Tuberculosis | [Tuberculosis (TB) Chest X-ray Database](https://www.kaggle.com/datasets/tawsifurrahman/tuberculosis-tb-chest-xray-dataset): Rahman, Khandakar et al. | Ver la página del dataset |
|
| 70 |
+
| U-Net | [Pulmonary Chest X-Ray Abnormalities](https://www.kaggle.com/datasets/kmader/pulmonary-chest-xray-abnormalities): conjuntos Montgomery County y Shenzhen de la U.S. National Library of Medicine. Las máscaras de pulmón son las del conjunto Montgomery (138 radiografías) | Datos públicos de la NLM; se pide citar la fuente |
|
| 71 |
+
|
| 72 |
+
## Métricas
|
| 73 |
+
|
| 74 |
+
Valores que muestra la aplicación rt26:
|
| 75 |
+
|
| 76 |
+
| Modelo | Exactitud | AUC | F1 |
|
| 77 |
+
| --- | --- | --- | --- |
|
| 78 |
+
| Ensemble neumonía | 92,75 % | 0,972 | 0,93 |
|
| 79 |
+
| Ensemble COVID-19 | 98,50 % | 0,991 | 0,98 |
|
| 80 |
+
| Ensemble tuberculosis | 97,80 % | 0,985 | 0,97 |
|
| 81 |
+
| U-Net | Dice 96,24 % | | |
|
| 82 |
+
|
| 83 |
+
En la validación guardada durante el entrenamiento, varios modelos llegan a exactitud y AUC de 1,0, en
|
| 84 |
+
algunos casos tras una sola época. Un resultado así suele indicar un conjunto de validación pequeño o
|
| 85 |
+
demasiado parecido al de entrenamiento, no un modelo infalible.
|
| 86 |
+
|
| 87 |
+
## Limitaciones
|
| 88 |
+
|
| 89 |
+
- **Cada enfermedad viene de un dataset distinto.** Los modelos pueden aprender rasgos del origen de la
|
| 90 |
+
imagen (equipo, contraste, marcas, edad) en lugar de la enfermedad.
|
| 91 |
+
- **Sin validación externa.** No se han evaluado con datos de otro hospital ni con revisión de radiólogos.
|
| 92 |
+
- **Fuera de distribución.** El modelo de neumonía se entrenó con niños de 1 a 5 años. Una imagen sin
|
| 93 |
+
relación con el entrenamiento recibe igualmente una probabilidad.
|
| 94 |
+
- **La U-Net** se entrenó con 138 radiografías de un solo programa de cribado.
|
| 95 |
+
|
| 96 |
+
## Detección YOLO
|
| 97 |
+
|
| 98 |
+
El proyecto incluye también un detector YOLOv8 de lesiones, **que no se publica aquí**: se entrenó con los
|
| 99 |
+
datos de la competición
|
| 100 |
+
[VinBigData Chest X-ray Abnormalities Detection](https://www.kaggle.com/competitions/vinbigdata-chest-xray-abnormalities-detection),
|
| 101 |
+
cuyas reglas limitan su uso a fines no comerciales y de investigación. La aplicación funciona sin él.
|
| 102 |
+
|
| 103 |
+
## Licencia
|
| 104 |
+
|
| 105 |
+
Los pesos se publican bajo [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). Los datasets
|
| 106 |
+
de entrenamiento mantienen sus propias licencias y condiciones.
|
| 107 |
+
|
| 108 |
+
## Citas
|
| 109 |
+
|
| 110 |
+
- D. S. Kermany et al., "Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning",
|
| 111 |
+
*Cell* 172(5):1122–1131, 2018. DOI [10.1016/j.cell.2018.02.010](https://doi.org/10.1016/j.cell.2018.02.010).
|
| 112 |
+
- M. E. H. Chowdhury et al., "Can AI help in screening Viral and COVID-19 pneumonia?", *IEEE Access*
|
| 113 |
+
8:132665–132676, 2020.
|
| 114 |
+
- T. Rahman et al., "Reliable Tuberculosis Detection using Chest X-ray with Deep Learning, Segmentation and
|
| 115 |
+
Visualization", *IEEE Access* 8:191586–191601, 2020. DOI
|
| 116 |
+
[10.1109/ACCESS.2020.3031384](https://doi.org/10.1109/ACCESS.2020.3031384).
|
| 117 |
+
- S. Jaeger et al., "Two public chest X-ray datasets for computer-aided screening of pulmonary diseases",
|
| 118 |
+
*Quantitative Imaging in Medicine and Surgery* 4(6):475–477, 2014.
|
| 119 |
+
- S. Jaeger et al., "Automatic tuberculosis screening using chest radiographs", *IEEE Transactions on
|
| 120 |
+
Medical Imaging* 33(2):233–245, 2014. DOI [10.1109/TMI.2013.2284099](https://doi.org/10.1109/TMI.2013.2284099).
|
| 121 |
+
- S. Candemir et al., "Lung segmentation in chest radiographs using anatomical atlases with nonrigid
|
| 122 |
+
registration", *IEEE Transactions on Medical Imaging* 33(2):577–590, 2014. DOI
|
| 123 |
+
[10.1109/TMI.2013.2290491](https://doi.org/10.1109/TMI.2013.2290491).
|
| 124 |
+
|
| 125 |
+
Fuente de los conjuntos Montgomery y Shenzhen: National Library of Medicine, National Institutes of
|
| 126 |
+
Health, Bethesda, MD, USA, y Shenzhen No.3 People's Hospital, Guangdong Medical College, Shenzhen, China.
|
covid_19_densenet121.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5468eab24cff58a1e1212b3d2cf090b7c4a583f98c5906f9d02eeace8dbf6b21
|
| 3 |
+
size 28427619
|
covid_19_efficientnet_b0.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a3872f2c010a3745f402083cd37e0a4b9d63480f2a7910ea3ec597aa3d97015a
|
| 3 |
+
size 16334222
|
covid_19_resnet50.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d5059ed2354243192d3137cbecc50a9609693ac98dd89518f23ffb752431d591
|
| 3 |
+
size 94364890
|
pneumonia_densenet121.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fc89cb2bc9f0e624630901f8a5ad4973789a64c4a89fcc0cb26e51f5d13f0ca5
|
| 3 |
+
size 28428350
|
pneumonia_efficientnet_b0.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dab40ed148637e85e365db52b92d56b9f6e5800a244950e7e4b18e0ecc888abb
|
| 3 |
+
size 16334586
|
pneumonia_resnet50.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eeaaa8099317dedcf3802e83395de32720be8c50515e02d84674bcce34634cde
|
| 3 |
+
size 94365214
|
tuberculosis_densenet121.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3f9671002c8a7293f788a5f3ce207364bee56788ff2d381fcff631c1b0d8ed8
|
| 3 |
+
size 28430607
|
tuberculosis_efficientnet_b0.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c72a68035ad8499ec2448737fb45f09dd8f71b60f84635f294239dd2d2db1b8
|
| 3 |
+
size 16335678
|
tuberculosis_resnet50.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e362e6fd889a16405b53d4c35512129865f11ec97a11f2a3825bca228c3170d9
|
| 3 |
+
size 94366186
|
unet_resnet34_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f53c41dd62b26849a8010a949eec50e827cc5c577e787040b5cdd7afef176ab4
|
| 3 |
+
size 97893156
|