envision-classifier 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- envision_classifier-0.1.0/LICENSE.md +21 -0
- envision_classifier-0.1.0/PKG-INFO +120 -0
- envision_classifier-0.1.0/README.md +82 -0
- envision_classifier-0.1.0/envision_classifier/__init__.py +25 -0
- envision_classifier-0.1.0/envision_classifier/__main__.py +4 -0
- envision_classifier-0.1.0/envision_classifier/classifier.py +813 -0
- envision_classifier-0.1.0/envision_classifier/cli.py +90 -0
- envision_classifier-0.1.0/pyproject.toml +140 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 FAIR Data Innovations Hub
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: envision-classifier
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Few-shot classifier for detecting eye imaging datasets
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE.md
|
|
7
|
+
Keywords: eye imaging,ophthalmology,OCT,fundus,retina,machine learning,dataset discovery,classification,setfit,few-shot,fair-data
|
|
8
|
+
Author: FAIR Data Innovations Hub
|
|
9
|
+
Author-email: contact@fairdataihub.org
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
26
|
+
Requires-Dist: click (>=8.0,<9.0)
|
|
27
|
+
Requires-Dist: datasets (>=2.14.0)
|
|
28
|
+
Requires-Dist: huggingface-hub (>=0.20.0)
|
|
29
|
+
Requires-Dist: scikit-learn (>=1.3.0)
|
|
30
|
+
Requires-Dist: setfit (>=1.0.0)
|
|
31
|
+
Requires-Dist: torch (>=2.0.0)
|
|
32
|
+
Requires-Dist: transformers (>=4.35.0)
|
|
33
|
+
Project-URL: Documentation, https://envision-classifier.readthedocs.io
|
|
34
|
+
Project-URL: Homepage, https://github.com/EyeACT/envision-classifier
|
|
35
|
+
Project-URL: Repository, https://github.com/EyeACT/envision-classifier
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# envision-classifier
|
|
39
|
+
|
|
40
|
+
SetFit few-shot classifier for identifying eye imaging datasets from scientific metadata.
|
|
41
|
+
|
|
42
|
+
Part of the [EyeACT](https://github.com/EyeACT) project by the [FAIR Data Innovations Hub](https://fairdataihub.org).
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install git+https://github.com/EyeACT/envision-classifier.git
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Python API
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from envision_classifier import EyeImagingClassifier
|
|
54
|
+
|
|
55
|
+
# Downloads model from HuggingFace on first use
|
|
56
|
+
clf = EyeImagingClassifier()
|
|
57
|
+
|
|
58
|
+
# Classify a single record
|
|
59
|
+
result = clf.classify("Retinal OCT dataset for diabetic retinopathy")
|
|
60
|
+
print(result)
|
|
61
|
+
# {'label': 'EYE_IMAGING', 'confidence': 0.999, 'probabilities': {...}}
|
|
62
|
+
|
|
63
|
+
# Classify a batch
|
|
64
|
+
results = clf.classify_batch([
|
|
65
|
+
"Retinal fundus photography dataset for glaucoma screening",
|
|
66
|
+
"COVID-19 genome sequencing data",
|
|
67
|
+
{"title": "OCT images", "description": "Macular degeneration scans"},
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
# Use a local model instead of downloading
|
|
71
|
+
clf = EyeImagingClassifier(model_path="./my_model")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## CLI
|
|
75
|
+
|
|
76
|
+
After installing, the `envision-classifier` command is available:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Classify a text string
|
|
80
|
+
envision-classifier classify --text "Retinal OCT dataset for diabetic retinopathy"
|
|
81
|
+
|
|
82
|
+
# Classify from a JSON file
|
|
83
|
+
envision-classifier classify records.json
|
|
84
|
+
|
|
85
|
+
# Pipe JSON via stdin
|
|
86
|
+
echo '{"title": "Fundus images", "description": "DR screening"}' | envision-classifier classify
|
|
87
|
+
|
|
88
|
+
# Train a new model from built-in training data
|
|
89
|
+
envision-classifier train --output ./my_model
|
|
90
|
+
|
|
91
|
+
# Show model info and training data counts
|
|
92
|
+
envision-classifier info
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Classification Labels
|
|
96
|
+
|
|
97
|
+
| Label | Description |
|
|
98
|
+
|-------|-------------|
|
|
99
|
+
| **EYE_IMAGING** | Actual eye imaging datasets (fundus, OCT, OCTA, cornea) |
|
|
100
|
+
| **EYE_SOFTWARE** | Code, tools, models for eye imaging (no actual data) |
|
|
101
|
+
| **EDGE_CASE** | Eye research papers, reviews, non-imaging data |
|
|
102
|
+
| **NEGATIVE** | Not eye-related |
|
|
103
|
+
|
|
104
|
+
## Model
|
|
105
|
+
|
|
106
|
+
- **Base model**: `sentence-transformers/all-mpnet-base-v2` (768-dim)
|
|
107
|
+
- **Training data**: 474 curated examples (77 EYE_IMAGING, 48 EYE_SOFTWARE, 79 EDGE_CASE, 270 NEGATIVE)
|
|
108
|
+
- **Test accuracy**: 0.937, **macro F1**: 0.902
|
|
109
|
+
- **Spot-check**: 29/33 (87.9%)
|
|
110
|
+
- **Model weights**: [fairdataihub/envision-eye-imaging-classifier](https://huggingface.co/fairdataihub/envision-eye-imaging-classifier)
|
|
111
|
+
|
|
112
|
+
## Related
|
|
113
|
+
|
|
114
|
+
- [envision-discovery](https://github.com/EyeACT/envision-discovery) -- Full pipeline (scraping + classification + export)
|
|
115
|
+
- [Model on HuggingFace](https://huggingface.co/fairdataihub/envision-eye-imaging-classifier)
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
|
120
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# envision-classifier
|
|
2
|
+
|
|
3
|
+
SetFit few-shot classifier for identifying eye imaging datasets from scientific metadata.
|
|
4
|
+
|
|
5
|
+
Part of the [EyeACT](https://github.com/EyeACT) project by the [FAIR Data Innovations Hub](https://fairdataihub.org).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install git+https://github.com/EyeACT/envision-classifier.git
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Python API
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from envision_classifier import EyeImagingClassifier
|
|
17
|
+
|
|
18
|
+
# Downloads model from HuggingFace on first use
|
|
19
|
+
clf = EyeImagingClassifier()
|
|
20
|
+
|
|
21
|
+
# Classify a single record
|
|
22
|
+
result = clf.classify("Retinal OCT dataset for diabetic retinopathy")
|
|
23
|
+
print(result)
|
|
24
|
+
# {'label': 'EYE_IMAGING', 'confidence': 0.999, 'probabilities': {...}}
|
|
25
|
+
|
|
26
|
+
# Classify a batch
|
|
27
|
+
results = clf.classify_batch([
|
|
28
|
+
"Retinal fundus photography dataset for glaucoma screening",
|
|
29
|
+
"COVID-19 genome sequencing data",
|
|
30
|
+
{"title": "OCT images", "description": "Macular degeneration scans"},
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
# Use a local model instead of downloading
|
|
34
|
+
clf = EyeImagingClassifier(model_path="./my_model")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## CLI
|
|
38
|
+
|
|
39
|
+
After installing, the `envision-classifier` command is available:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Classify a text string
|
|
43
|
+
envision-classifier classify --text "Retinal OCT dataset for diabetic retinopathy"
|
|
44
|
+
|
|
45
|
+
# Classify from a JSON file
|
|
46
|
+
envision-classifier classify records.json
|
|
47
|
+
|
|
48
|
+
# Pipe JSON via stdin
|
|
49
|
+
echo '{"title": "Fundus images", "description": "DR screening"}' | envision-classifier classify
|
|
50
|
+
|
|
51
|
+
# Train a new model from built-in training data
|
|
52
|
+
envision-classifier train --output ./my_model
|
|
53
|
+
|
|
54
|
+
# Show model info and training data counts
|
|
55
|
+
envision-classifier info
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Classification Labels
|
|
59
|
+
|
|
60
|
+
| Label | Description |
|
|
61
|
+
|-------|-------------|
|
|
62
|
+
| **EYE_IMAGING** | Actual eye imaging datasets (fundus, OCT, OCTA, cornea) |
|
|
63
|
+
| **EYE_SOFTWARE** | Code, tools, models for eye imaging (no actual data) |
|
|
64
|
+
| **EDGE_CASE** | Eye research papers, reviews, non-imaging data |
|
|
65
|
+
| **NEGATIVE** | Not eye-related |
|
|
66
|
+
|
|
67
|
+
## Model
|
|
68
|
+
|
|
69
|
+
- **Base model**: `sentence-transformers/all-mpnet-base-v2` (768-dim)
|
|
70
|
+
- **Training data**: 474 curated examples (77 EYE_IMAGING, 48 EYE_SOFTWARE, 79 EDGE_CASE, 270 NEGATIVE)
|
|
71
|
+
- **Test accuracy**: 0.937, **macro F1**: 0.902
|
|
72
|
+
- **Spot-check**: 29/33 (87.9%)
|
|
73
|
+
- **Model weights**: [fairdataihub/envision-eye-imaging-classifier](https://huggingface.co/fairdataihub/envision-eye-imaging-classifier)
|
|
74
|
+
|
|
75
|
+
## Related
|
|
76
|
+
|
|
77
|
+
- [envision-discovery](https://github.com/EyeACT/envision-discovery) -- Full pipeline (scraping + classification + export)
|
|
78
|
+
- [Model on HuggingFace](https://huggingface.co/fairdataihub/envision-eye-imaging-classifier)
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
envision-classifier: Eye Imaging Dataset Classifier
|
|
3
|
+
|
|
4
|
+
A 4-class SetFit classifier for detecting eye imaging datasets:
|
|
5
|
+
- EYE_IMAGING: Actual eye imaging datasets (fundus, OCT, OCTA, etc.)
|
|
6
|
+
- EYE_SOFTWARE: Code, models, tools for eye imaging
|
|
7
|
+
- EDGE_CASE: Eye research papers, reviews, borderline items
|
|
8
|
+
- NEGATIVE: Unrelated domains
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
>>> from envision_classifier import EyeImagingClassifier
|
|
12
|
+
>>> clf = EyeImagingClassifier()
|
|
13
|
+
>>> clf.classify("Retinal OCT dataset for diabetic retinopathy")
|
|
14
|
+
{'label': 'EYE_IMAGING', 'confidence': 0.999, 'probabilities': {...}}
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
|
18
|
+
__author__ = "James O'Neill"
|
|
19
|
+
|
|
20
|
+
from .classifier import EyeImagingClassifier, LABELS
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"EyeImagingClassifier",
|
|
24
|
+
"LABELS",
|
|
25
|
+
]
|
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ENVISION: Eye Imaging Dataset Classification
|
|
3
|
+
|
|
4
|
+
SetFit Few-Shot Classifier for Eye Imaging Dataset Detection
|
|
5
|
+
Uses sentence-transformers/all-mpnet-base-v2 sentence transformer with 4-class classification:
|
|
6
|
+
- 3: EYE_IMAGING - Actual eye imaging datasets (fundus, OCT, OCTA, cornea, etc.)
|
|
7
|
+
- 2: EYE_SOFTWARE - Code, tools, models for eye imaging (no actual data)
|
|
8
|
+
- 1: EDGE_CASE - Eye research (papers, reviews, non-imaging data)
|
|
9
|
+
- 0: NEGATIVE - Not eye-related at all
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
import warnings
|
|
15
|
+
from html import unescape
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
import torch
|
|
19
|
+
|
|
20
|
+
warnings.filterwarnings("ignore")
|
|
21
|
+
|
|
22
|
+
# Model configuration
|
|
23
|
+
BASE_MODEL_NAME = "sentence-transformers/all-mpnet-base-v2"
|
|
24
|
+
HF_MODEL_REPO = "fairdataihub/envision-eye-imaging-classifier"
|
|
25
|
+
LABELS = ["NEGATIVE", "EDGE_CASE", "EYE_SOFTWARE", "EYE_IMAGING"]
|
|
26
|
+
|
|
27
|
+
# ============================================================
|
|
28
|
+
# TRAINING DATA - Curated examples for few-shot learning
|
|
29
|
+
# ============================================================
|
|
30
|
+
|
|
31
|
+
# EYE_IMAGING (label=3): Actual eye imaging datasets with real image data
|
|
32
|
+
# Cleaned: removed 21 misplaced examples (reviews, software, stats, metabolomics)
|
|
33
|
+
EYE_IMAGING_EXAMPLES = [
|
|
34
|
+
"Dataset from fundus images for the study of diabetic retinopathy progression",
|
|
35
|
+
"Optical Coherence Tomography Angiography-OCTA Dataset for Diabetic Retinopathy",
|
|
36
|
+
"Indian Diabetic Retinopathy Image Dataset (IDRiD) — Segmentation and Grading Challenge",
|
|
37
|
+
"Retinal Fundus Multi-Disease Image Dataset (RFMiD) 2.0",
|
|
38
|
+
"Rotterdam EyePACS AIROGS train set - fundus images for glaucoma detection",
|
|
39
|
+
"JustRAIGS challenge training data set - Justified Referral in AI Glaucoma Screening",
|
|
40
|
+
"OLIVES Dataset: Ophthalmic Labels for Investigating Visual Eye Semantics",
|
|
41
|
+
"RVD: A Handheld Device-Based Fundus Video Dataset for Retinal Vessel Segmentation",
|
|
42
|
+
"High-resolution structural and functional retinal imaging in mice",
|
|
43
|
+
"Multi-modal spatiotemporal phenotyping of human retinal organoid development",
|
|
44
|
+
"2023 IEEE SPS Video and Image Processing (VIP) Cup: Ophthalmic Biomarker Detection",
|
|
45
|
+
"DERMA-OCTA: OCT Angiography images for skin microvascular analysis",
|
|
46
|
+
"Abca4 inhibition in a cone-rich rodent leads to Stargardt Disease OCT and fundus images",
|
|
47
|
+
"Diabetic Glaucoma dataset combining ORIGA, REFUGE, ACRIMA fundus images",
|
|
48
|
+
"OCT-A mosaicking dataset for retinal vessel analysis",
|
|
49
|
+
"UTHealth - Fundus and Synthetic OCT-A Dataset (UT-FSOCTA)",
|
|
50
|
+
"Myopic Maculopathy Analysis Challenge 2023 - fundus image dataset",
|
|
51
|
+
"Retinal vessel segmentation challenge dataset DRIVE STARE CHASE_DB1",
|
|
52
|
+
"Glaucoma OCT dataset with RNFL thickness measurements",
|
|
53
|
+
"Age-related macular degeneration OCT B-scan image dataset",
|
|
54
|
+
"Heidelberg Spectralis OCT scans for diabetic macular edema",
|
|
55
|
+
"Zeiss Cirrus HD-OCT dataset for glaucoma progression analysis",
|
|
56
|
+
"Topcon 3D OCT fundus and cross-sectional images",
|
|
57
|
+
"Fluorescein angiography dataset for choroidal neovascularization",
|
|
58
|
+
"Fundus photography dataset for optic disc and cup segmentation",
|
|
59
|
+
"Retinal OCT images with drusen and geographic atrophy labels",
|
|
60
|
+
"OCTA dataset showing foveal avascular zone measurements",
|
|
61
|
+
"Corneal topography images for keratoconus detection",
|
|
62
|
+
"Anterior segment OCT dataset for angle closure glaucoma",
|
|
63
|
+
"Slit lamp photography dataset for cataract grading",
|
|
64
|
+
"Multi-Disease Detection in Retinal Imaging dataset",
|
|
65
|
+
"Retinal Wave Dataset - calcium imaging of developing retina",
|
|
66
|
+
"Evaluation benchmark for natural robustness of retinal vessel segmentation",
|
|
67
|
+
"Probabilistic volumetric speckle suppression in OCT using deep learning",
|
|
68
|
+
"Optical coherence tomography radiation cataract image dataset",
|
|
69
|
+
"HRF-Seg+: A Multi-Structure Annotated Fundus Image Dataset",
|
|
70
|
+
"Multimodal OCTA and Fundus Image dataset for diabetic retinopathy detection",
|
|
71
|
+
"Iraqi Retinal Fundus Diabetic Retinopathy Dataset IRFDRD",
|
|
72
|
+
"OCT Fundus Registration dataset for multimodal retinal analysis",
|
|
73
|
+
"Topological characterization of the retinal microvascular network",
|
|
74
|
+
"JRC-Multi-Modal Retinal Vessel Segmentation dataset",
|
|
75
|
+
"A Fundus Image Dataset for Domain Generalization in Joint Optic Disc and Cup Segmentation",
|
|
76
|
+
"CeraMIRScan: Mid-infrared OCT Scan Dataset for ophthalmic applications",
|
|
77
|
+
"qtOCT: quantitative transmission optical coherence tomography dataset",
|
|
78
|
+
"Mammalian animal and human retinal organ culture imaging data",
|
|
79
|
+
"Spontaneous retinal reperfusion of capillary nonperfusion OCT and fundus",
|
|
80
|
+
"Analysis on Multimodal Imaging of stealth Choroidal Neovascularization OCTA",
|
|
81
|
+
"Longitudinal changes in retinal microstructures OCT imaging data",
|
|
82
|
+
"Macular Drusen histology and OCT correlation dataset",
|
|
83
|
+
"Generalized Analysis of Vessels in Eye GAVE Challenge dataset",
|
|
84
|
+
"Automated fundus image quality assessment and segmentation dataset",
|
|
85
|
+
"Diabetic Retinopathy Detection using Retinal Images dataset",
|
|
86
|
+
"Optic disc localization using graph traversal algorithm dataset",
|
|
87
|
+
"An Image Processing Algorithm to Detect Exudates in Fundus Images",
|
|
88
|
+
"Binary operation based hard exudate detection fundus dataset",
|
|
89
|
+
"EXUDATES DETECTION FROM DIGITAL FUNDUS IMAGE dataset",
|
|
90
|
+
"COMPARATIVE STUDY OF DIABETIC RETINOPATHY K-NN dataset",
|
|
91
|
+
"AN AUTOMATIC SCREENING METHOD TO DETECT OPTIC DISC dataset",
|
|
92
|
+
"Fundus Fluorescein Angiography imaging dataset",
|
|
93
|
+
"Structural-Functional Transition in Glaucoma Assessment imaging data",
|
|
94
|
+
"Identification of ocular disease from fundus images using deep learning",
|
|
95
|
+
"To Assess Characteristics of Individuals with Disc Hemorrhage fundus imaging",
|
|
96
|
+
"Prevalence Risk Factors Clinical Correlates Age-related Macular Degeneration imaging",
|
|
97
|
+
"ResNet-n/DR Automated diagnosis of diabetic retinopathy fundus dataset",
|
|
98
|
+
"Eye fundus oxygenation mapping from color retinographs dataset",
|
|
99
|
+
"Machine learning classifiers for detection of glaucoma OCT dataset",
|
|
100
|
+
"Enhancing Retinal Disease Detection with Swin Transformer fundus dataset",
|
|
101
|
+
"Development of hybrid framework to characterize red lesions in fundus images",
|
|
102
|
+
"Diabetic retinopathy classification using deep convolutional neural networks fundus",
|
|
103
|
+
"EARLY DETECTION OF HIGH BLOOD PRESSURE AND DIABETIC RETINOPATHY fundus images",
|
|
104
|
+
"Diagnosis Of Diabetic Retinopathy: fundus image analysis dataset",
|
|
105
|
+
"FUNDUS IMAGES FOR DIAGNOSIS OF DIABETIC RETINOPATHY dataset",
|
|
106
|
+
"Retinal status analysis method based on feature extraction OCT dataset",
|
|
107
|
+
"Data from Inactivation of adenosine receptor retinal imaging",
|
|
108
|
+
"Polarisation camera dSTORM datasets of retinal cells",
|
|
109
|
+
"Scanning dynamic light scattering optical coherence tomography retinal flow",
|
|
110
|
+
"MedIMeta: multi-domain medical imaging including retinal fundus",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
# EYE_SOFTWARE (label=2): Code, tools, models for eye imaging (NOT actual data)
|
|
114
|
+
# Added: misplaced software from EYE_IMAGING + EDGE_CASE, spot-check examples
|
|
115
|
+
EYE_SOFTWARE_EXAMPLES = [
|
|
116
|
+
"linchundan88/Fundus-image-preprocessing: fundus image preprocessing Python code",
|
|
117
|
+
"NIH-NEI/oct-image-segmentation-models: v0.8.2 trained model weights",
|
|
118
|
+
"optic-nerve-cnn: First version of the software neural network",
|
|
119
|
+
"Corneal-Endothelium-Data-Annotation-Tool: annotation labeling software",
|
|
120
|
+
"FundusImageToolbox: Python package fundus image processing library",
|
|
121
|
+
"OCTAVA: open-source toolbox quantitative analysis OCT angiography",
|
|
122
|
+
"RetinoNet-DR-Classification: deep learning code diabetic retinopathy",
|
|
123
|
+
"oct-to-tiff: command line tool OCT angiography converter",
|
|
124
|
+
"optic-disc-segmentation-drishtigs: segmentation algorithm implementation",
|
|
125
|
+
"QiYanPitt/AMDprogressCNN: Late AMD Fundus Image Prediction model",
|
|
126
|
+
"Deep learning model weights trained on fundus images PyTorch",
|
|
127
|
+
"Pretrained neural network OCT segmentation model weights only",
|
|
128
|
+
"ResNet-50 classifiers trained on retinal fundus model weights",
|
|
129
|
+
"ONNX model weights retinal vessel segmentation inference",
|
|
130
|
+
"PyTorch checkpoint OCT layer segmentation neural network",
|
|
131
|
+
"Segmentation model weights diabetic retinopathy detection",
|
|
132
|
+
"Python package retinal image preprocessing pip install",
|
|
133
|
+
"MATLAB toolbox fundus image analysis code only",
|
|
134
|
+
"ImageJ plugin OCT visualization and measurement",
|
|
135
|
+
"Fiji macro optic nerve fiber layer analysis",
|
|
136
|
+
"R package macular thickness statistical analysis",
|
|
137
|
+
"Source code implementation retinal vessel extraction",
|
|
138
|
+
"Algorithm implementation optic disc detection CNN",
|
|
139
|
+
"Code repository deep learning diabetic retinopathy",
|
|
140
|
+
"GitHub release fundus segmentation neural network",
|
|
141
|
+
"Jupyter notebook tutorial OCT image classification",
|
|
142
|
+
"Caserel: Open Source Software Computer-aided Segmentation Retinal Layers",
|
|
143
|
+
"duke-lungmap-team/odifmap: image processing code publication",
|
|
144
|
+
"young-oct/OCT-denoising: denoising algorithm code repository",
|
|
145
|
+
"costapt/vess2ret: vessel to retina synthesis code",
|
|
146
|
+
# Moved from EYE_IMAGING (software/tools, not datasets)
|
|
147
|
+
"EyeLab: Python package for OCT and fundus image processing",
|
|
148
|
+
"Fiji-mCNVImageAnalysisTool for choroidal neovascularization in OCTA",
|
|
149
|
+
"Automatic Choroid Vascularity Index Calculation in OCT Images",
|
|
150
|
+
"ResNet-50 classifiers and diffusion models trained on retinal fundus images",
|
|
151
|
+
"AMikroulis/octopus OCT image processing dataset",
|
|
152
|
+
"anithaj17/RetinoNet-DR-Classification fundus image dataset",
|
|
153
|
+
# Moved from EDGE_CASE (clearly software/tools)
|
|
154
|
+
"Python package for retinal image preprocessing",
|
|
155
|
+
"Deep learning framework for fundus image segmentation code only",
|
|
156
|
+
"OCT image reconstruction algorithm implementation",
|
|
157
|
+
"Retinal vessel extraction software repository",
|
|
158
|
+
"Optic disc detection neural network model weights",
|
|
159
|
+
"Diabetic retinopathy grading API documentation",
|
|
160
|
+
"Fundus image augmentation library code",
|
|
161
|
+
"DICOM viewer for ophthalmic images software",
|
|
162
|
+
"OCT visualization toolkit implementation",
|
|
163
|
+
"Retinal layer segmentation algorithm code repository",
|
|
164
|
+
# Spot-check derived (model weights / recording device code)
|
|
165
|
+
"ANNs pre-trained on Retinal Waves model weights",
|
|
166
|
+
"Flexible corneal neurotechnology reveals in-vivo pathological retinal oscillations recording device",
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
# EDGE_CASE (label=1): Eye/vision research but NOT actual imaging datasets
|
|
170
|
+
# Cleaned: removed misplaced software→EYE_SOFTWARE, non-eye→NEGATIVE; added eye metabolomics
|
|
171
|
+
EDGE_CASE_EXAMPLES = [
|
|
172
|
+
"A Review of Deep Learning Methods for Diabetic Retinopathy Detection",
|
|
173
|
+
"Survey of Machine Learning Techniques for Glaucoma Diagnosis",
|
|
174
|
+
"Advances in Optical Coherence Tomography Technology Review Article",
|
|
175
|
+
"Clinical Guidelines for Diabetic Eye Screening",
|
|
176
|
+
"Comparison of OCT Devices: A Systematic Review",
|
|
177
|
+
"Deep Learning in Ophthalmology: A Comprehensive Review",
|
|
178
|
+
"Artificial Intelligence in Retinal Disease Detection Review",
|
|
179
|
+
"State of the Art in Fundus Image Analysis Survey",
|
|
180
|
+
"Future Directions in Ophthalmic Imaging Technology",
|
|
181
|
+
"Machine Learning for Age-Related Macular Degeneration: A Review",
|
|
182
|
+
"Genetic factors in age-related macular degeneration GWAS meta-analysis",
|
|
183
|
+
"Molecular mechanisms of retinal ganglion cell death in glaucoma",
|
|
184
|
+
"Pharmacological treatment options for diabetic macular edema",
|
|
185
|
+
"Risk factors for progression of diabetic retinopathy clinical study",
|
|
186
|
+
"Visual acuity outcomes after anti-VEGF therapy clinical trial",
|
|
187
|
+
"Intraocular pressure measurement techniques comparison study",
|
|
188
|
+
"Epidemiology of myopia in Asian populations survey",
|
|
189
|
+
"Cataract surgery outcomes in diabetic patients retrospective analysis",
|
|
190
|
+
"Color vision deficiency prevalence in school children",
|
|
191
|
+
"Visual field testing protocols for glaucoma clinical practice",
|
|
192
|
+
"Electronic health records analysis of glaucoma treatment patterns",
|
|
193
|
+
"Patient-reported outcomes in dry eye disease questionnaire data",
|
|
194
|
+
"Healthcare costs of diabetic eye disease economic analysis",
|
|
195
|
+
"Ophthalmologist workforce distribution geographic study",
|
|
196
|
+
"Barriers to diabetic eye screening qualitative interview data",
|
|
197
|
+
"Adherence to glaucoma medication patient diary data",
|
|
198
|
+
"Visual impairment and quality of life survey responses",
|
|
199
|
+
"Telemedicine in ophthalmology implementation analysis",
|
|
200
|
+
"Eye care access in rural communities demographic data",
|
|
201
|
+
"Waiting times for cataract surgery administrative data",
|
|
202
|
+
# Eye tracking / gaze (eye-related but not imaging datasets)
|
|
203
|
+
"Eye tracking data for attention research",
|
|
204
|
+
"Gaze estimation dataset for human-computer interaction",
|
|
205
|
+
"Pupil dilation response to emotional stimuli",
|
|
206
|
+
"Saccade patterns in reading comprehension study",
|
|
207
|
+
"Visual search behavior eye movement data",
|
|
208
|
+
"Fixation duration analysis for cognitive load",
|
|
209
|
+
"Eye blink detection for drowsiness monitoring",
|
|
210
|
+
"Iris recognition biometric dataset",
|
|
211
|
+
"Facial expression analysis including eye region",
|
|
212
|
+
"Driver attention monitoring eye tracking",
|
|
213
|
+
# Animal eye development (eye-related but not human imaging)
|
|
214
|
+
"Drosophila compound eye development gene expression",
|
|
215
|
+
"Zebrafish eye regeneration molecular analysis",
|
|
216
|
+
"Mouse retinal development transcriptomics",
|
|
217
|
+
"Chicken embryo eye formation RNA sequencing",
|
|
218
|
+
"Frog photoreceptor electrophysiology recordings",
|
|
219
|
+
"Squid giant axon eye homolog studies",
|
|
220
|
+
"Insect compound eye optics physics modeling",
|
|
221
|
+
"Cephalopod camera eye evolution genomics",
|
|
222
|
+
"Spider eye arrangement morphological analysis",
|
|
223
|
+
"Mantis shrimp visual system spectral analysis",
|
|
224
|
+
# Other eye measurements (not imaging)
|
|
225
|
+
"Digital fundus thermometry for fever screening",
|
|
226
|
+
"Ocular surface temperature measurement",
|
|
227
|
+
"Tear film stability analysis without imaging",
|
|
228
|
+
"Contrast sensitivity function psychophysics",
|
|
229
|
+
"Dark adaptation curve measurements",
|
|
230
|
+
"Electroretinography signal analysis only",
|
|
231
|
+
"Visual evoked potential recordings",
|
|
232
|
+
"Optical properties of crystalline lens in vitro",
|
|
233
|
+
"Corneal biomechanics simulation data",
|
|
234
|
+
"Aqueous humor proteomics analysis",
|
|
235
|
+
# Moved from EYE_IMAGING (eye-related but not imaging datasets)
|
|
236
|
+
"GWAS Summary Statistics For Eye Imaging Traits",
|
|
237
|
+
"Fundus vessel phenotypes quantitative trait dataset",
|
|
238
|
+
"Retinal S-cone specific anatomical and physiological data",
|
|
239
|
+
"Nonlinear spatial integration allows the retina to detect the direction of motion",
|
|
240
|
+
"Thrombospondin-1 Mediates Axon Regeneration in Retinal Ganglion Cells",
|
|
241
|
+
"Optic nerve injury impairs intrinsic mechanisms underlying early eye imaging",
|
|
242
|
+
"Circuit mechanisms underlying embryonic retinal waves dataset",
|
|
243
|
+
"Data from Analysis of potential ischemic effect of intravitreal anti-VEGF OCT",
|
|
244
|
+
"Photodynamic Ocular Drug Delivery System with OCT monitoring",
|
|
245
|
+
"Data to Choroidal changes in intermediate age-related macular degeneration",
|
|
246
|
+
# Spot-check derived (eye-related but not imaging)
|
|
247
|
+
"Perspectives and Limitations of Mesenchymal Stem Cell-Based Therapy for Corneal injuries",
|
|
248
|
+
"Mesoporous Silica Nanocarriers of siRNA for Retinal Delivery drug mechanism",
|
|
249
|
+
# Eye metabolomics (eye tissue but metabolomics, not imaging)
|
|
250
|
+
"Metabolomics of mouse retina and optic nerve",
|
|
251
|
+
"Metabolomics of ocular hypertensive rat optic nerve",
|
|
252
|
+
"NMR spectroscopy-based metabolomics of organotypic retinal explants",
|
|
253
|
+
"Vitreous humor metabolomics profiling in diabetic retinopathy and retinal detachment",
|
|
254
|
+
"Spatial metabolomics of primate retina macula and periphery regions",
|
|
255
|
+
"Aqueous humor metabolome analysis in glaucoma patients",
|
|
256
|
+
"Lipidomics of retinal pigment epithelium in age-related macular degeneration",
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
# NEGATIVE (label=0): Clearly not eye-related
|
|
260
|
+
# Added: non-eye medical imaging from EDGE_CASE, spot-check confounders
|
|
261
|
+
NEGATIVE_EXAMPLES = [
|
|
262
|
+
"Climate change impact on coral reef ecosystems dataset",
|
|
263
|
+
"COVID-19 genome sequencing and variant analysis",
|
|
264
|
+
"Electric vehicle battery performance testing data",
|
|
265
|
+
"Social media sentiment analysis Twitter dataset",
|
|
266
|
+
"Stock market prediction historical price data",
|
|
267
|
+
"Natural language processing benchmark dataset",
|
|
268
|
+
"Robot navigation and path planning simulation",
|
|
269
|
+
"Music genre classification audio features",
|
|
270
|
+
"Speech recognition multilingual corpus",
|
|
271
|
+
"Protein structure prediction AlphaFold data",
|
|
272
|
+
"Urban traffic flow optimization dataset",
|
|
273
|
+
"Earthquake seismic wave recordings",
|
|
274
|
+
"Satellite imagery land use classification",
|
|
275
|
+
"Agricultural crop yield prediction dataset",
|
|
276
|
+
"Air quality monitoring sensor data",
|
|
277
|
+
"Ocean temperature salinity measurements",
|
|
278
|
+
"Forest fire detection and spread modeling",
|
|
279
|
+
"Wind turbine power output dataset",
|
|
280
|
+
"Solar panel efficiency measurements",
|
|
281
|
+
"Smart grid energy consumption patterns",
|
|
282
|
+
"Human gut microbiome metagenomic sequencing",
|
|
283
|
+
"Cancer cell line drug response screening",
|
|
284
|
+
"Plant root architecture phenotyping images",
|
|
285
|
+
"Bacterial biofilm formation time lapse",
|
|
286
|
+
"Yeast protein interaction network",
|
|
287
|
+
"Mouse brain connectome neural tracing",
|
|
288
|
+
"Human genome whole exome sequencing",
|
|
289
|
+
"Single cell RNA sequencing pancreas",
|
|
290
|
+
"Epigenome methylation profiling data",
|
|
291
|
+
"Metabolomics of liver disease samples",
|
|
292
|
+
"Image classification benchmark ImageNet",
|
|
293
|
+
"Object detection COCO dataset",
|
|
294
|
+
"Face recognition LFW dataset",
|
|
295
|
+
"Handwriting recognition MNIST digits",
|
|
296
|
+
"Autonomous driving perception dataset",
|
|
297
|
+
"Video action recognition UCF101",
|
|
298
|
+
"3D point cloud semantic segmentation",
|
|
299
|
+
"Document layout analysis dataset",
|
|
300
|
+
"Scene text recognition benchmark",
|
|
301
|
+
"Pose estimation human keypoints",
|
|
302
|
+
"Compiler optimization benchmark suite",
|
|
303
|
+
"Database query performance testing",
|
|
304
|
+
"Network intrusion detection logs",
|
|
305
|
+
"Software bug report classification",
|
|
306
|
+
"Code review comment sentiment",
|
|
307
|
+
"API usage pattern analysis",
|
|
308
|
+
"Container orchestration metrics",
|
|
309
|
+
"Microservice latency measurements",
|
|
310
|
+
"Cloud resource utilization data",
|
|
311
|
+
"DevOps pipeline performance metrics",
|
|
312
|
+
"Historical newspaper digitization project",
|
|
313
|
+
"Archaeological site survey mapping",
|
|
314
|
+
"Linguistic corpus for dialect analysis",
|
|
315
|
+
"Museum artifact catalog metadata",
|
|
316
|
+
"Legal case document classification",
|
|
317
|
+
"Political speech transcript analysis",
|
|
318
|
+
"Immigration policy document corpus",
|
|
319
|
+
"Educational assessment score data",
|
|
320
|
+
"Survey responses on housing affordability",
|
|
321
|
+
"Census demographic statistics",
|
|
322
|
+
"Weather forecast model output data",
|
|
323
|
+
"Cryptocurrency transaction network",
|
|
324
|
+
"Hotel review sentiment dataset",
|
|
325
|
+
"Recipe ingredient network analysis",
|
|
326
|
+
"Movie recommendation collaborative filtering",
|
|
327
|
+
"Book summary text generation",
|
|
328
|
+
"News article topic classification",
|
|
329
|
+
"Sports statistics player performance",
|
|
330
|
+
"FIGURES 1-10 in Taxonomic revision of genus species description",
|
|
331
|
+
"Figs 12-19 in Review of insect family Hemiptera Pentatomidae",
|
|
332
|
+
"FIGURES 45-53 in Introduction to Scydmaeninae Coleoptera beetles",
|
|
333
|
+
"FIGURE 6 in Additions to the description of new beetle species",
|
|
334
|
+
"Figs 7-11 in Review of Parachinavia insect taxonomy",
|
|
335
|
+
"FIGURES 14-19 in World genera of arthropod taxonomy review",
|
|
336
|
+
"FIGURE 15 in Combining morphological and molecular data new species",
|
|
337
|
+
"Figure 4 in The neurocranium of fish species morphology anatomy",
|
|
338
|
+
"FIGURES 64-68 in Franz and Nogunius genus description taxonomy",
|
|
339
|
+
"FIGURES 211-215 in Introduction to beetle family Coleoptera",
|
|
340
|
+
"Figs 1-5 in New species description and taxonomic placement",
|
|
341
|
+
"FIGURES 102-104 in curse of Horaeomorphus taxonomy revision",
|
|
342
|
+
"FIGURE 33 in Kirkegaardia polychaete worm new species",
|
|
343
|
+
"lymph node ultrasound image dataset pathology",
|
|
344
|
+
"PDAC tumour and vessel segmentation pancreatic cancer",
|
|
345
|
+
"Aortic valve calcification CT scan imaging",
|
|
346
|
+
"Atherosclerotic plaque OCT cardiovascular imaging",
|
|
347
|
+
"Lung nodule detection chest X-ray dataset",
|
|
348
|
+
"Brain MRI Alzheimer disease classification",
|
|
349
|
+
"Cardiac ultrasound echocardiography dataset",
|
|
350
|
+
"Mammography breast cancer detection images",
|
|
351
|
+
"Skin lesion dermoscopy melanoma dataset",
|
|
352
|
+
"Liver CT segmentation dataset",
|
|
353
|
+
"Fosil bivalvo fossil bivalve specimen",
|
|
354
|
+
"Fossil shell morphology museum specimen",
|
|
355
|
+
"Paleontology specimen 3D scan dataset",
|
|
356
|
+
"Hand-eye camera calibration robotics dataset",
|
|
357
|
+
"Robot eye camera sensor data manipulation",
|
|
358
|
+
"Machine vision inspection camera system",
|
|
359
|
+
"NAH rectangular plate Nearfield Acoustic Holography",
|
|
360
|
+
"Ultrasound transducer beam pattern dataset",
|
|
361
|
+
"Sonar imaging underwater acoustic data",
|
|
362
|
+
"Gaming leaderboard historical data",
|
|
363
|
+
"E-commerce product catalog data",
|
|
364
|
+
"Tourism destination visitor statistics",
|
|
365
|
+
"Fashion image style classification",
|
|
366
|
+
"Food image recognition dataset",
|
|
367
|
+
"Indoor scene recognition benchmark",
|
|
368
|
+
"Texture classification material images",
|
|
369
|
+
"Furniture detection room layout",
|
|
370
|
+
"Vehicle make model classification",
|
|
371
|
+
"Bird species identification dataset",
|
|
372
|
+
"Flower recognition 102 categories",
|
|
373
|
+
"Dog breed classification Stanford Dogs",
|
|
374
|
+
"Butterfly species identification images",
|
|
375
|
+
"Insect pest detection agricultural",
|
|
376
|
+
"Fish species classification underwater",
|
|
377
|
+
"Wildlife camera trap image dataset",
|
|
378
|
+
"Plankton microscopy classification",
|
|
379
|
+
"Cell microscopy segmentation HeLa",
|
|
380
|
+
"Pollen grain identification dataset",
|
|
381
|
+
"Mineral classification geological samples",
|
|
382
|
+
"Timber species identification wood",
|
|
383
|
+
"Fabric defect detection textile",
|
|
384
|
+
"Broadband acousto-optic modulators on Silicon Nitride photonics",
|
|
385
|
+
"Artifacts in Optical Projection Tomography general imaging",
|
|
386
|
+
"Optic flow and odometry data from intelrealsense camera robotics",
|
|
387
|
+
"Interstitial null-distance time-domain diffuse optical spectroscopy",
|
|
388
|
+
"iris-esmf-regrid Earth System Modeling Framework climate software",
|
|
389
|
+
"Altotiberina Low-angle normal fault seismic seismology",
|
|
390
|
+
"Refined Terrace Extraction Method geography terrain analysis",
|
|
391
|
+
"Lithospheric structure geological analysis dataset",
|
|
392
|
+
"integrated multi-scale approach to habitat modelling ecology",
|
|
393
|
+
"global variations in directional solar radiation exposure geography",
|
|
394
|
+
"IRIS Carbon Mapping Project carbon emissions dataset",
|
|
395
|
+
"Improved River Slope Datasets United States Hydrofabrics hydrology",
|
|
396
|
+
"Tracking Carboplatin Chemoresistance in Ovarian Cancer dataset",
|
|
397
|
+
"Subtype identification clear cell renal cell carcinoma kidney cancer",
|
|
398
|
+
"aortic dataset cardiovascular vessel segmentation",
|
|
399
|
+
"Deep learning aneurysm detection CT angiography brain vessels",
|
|
400
|
+
"Images from carotid artery patients cardiovascular disease",
|
|
401
|
+
"post-dive precordial subclavian Doppler ultrasound diving medicine",
|
|
402
|
+
"Deep Learning Segmentation Atherosclerotic Plaque cardiovascular",
|
|
403
|
+
"pLGG Radioimmunomics pediatric low-grade glioma brain tumor",
|
|
404
|
+
"Ex Vivo MRI Frontotemporal Lobar Degeneration brain imaging",
|
|
405
|
+
"Intracranial Sonodynamic Therapy brain treatment dataset",
|
|
406
|
+
"Adult female Aedes albopictus mosquito specimen imaging",
|
|
407
|
+
"Female pupa Aedes albopictus mosquito developmental imaging",
|
|
408
|
+
"Comparative larval ontogeny fish species developmental anatomy",
|
|
409
|
+
"Hadzinia ferrani Opiliones Nemastomatidae spider taxonomy",
|
|
410
|
+
"First record genus Tanaostigma Hymenoptera Chalcidoidea wasp taxonomy",
|
|
411
|
+
"Refractive index tomography chitin bristles chaetae marine worms",
|
|
412
|
+
"Methodology labeled image datasets entomological specimens insects",
|
|
413
|
+
"Newman-planar-elasticity computational physics simulation",
|
|
414
|
+
"Enhanced Photoactivity Carbon Nanodots Zinc Phthalocyanine photochemistry",
|
|
415
|
+
"Fluorescein-switching lateral flow assay chemistry biosensor",
|
|
416
|
+
"CtBP2 MD trajectories molecular dynamics protein simulation",
|
|
417
|
+
"All-atom accelerated molecular dynamics Filamin-A protein",
|
|
418
|
+
"QuantumScents molecular chemistry scent compound dataset",
|
|
419
|
+
"Influence Firing Temperature Silver-Aluminium Paste solar cell fabrication",
|
|
420
|
+
"Boron-Emitter Development TOPCon c-Si Solar Cells photovoltaics",
|
|
421
|
+
"Photo-physical characterization brominated fluorophore chemistry",
|
|
422
|
+
"MicroED datasets hemin biotin electron crystallography",
|
|
423
|
+
"Quantifying impact electric field computational physics",
|
|
424
|
+
"Accurate Modeling Bromide Iodide Hydration molecular chemistry",
|
|
425
|
+
"Carrier Diffusion Recombination semiconductor physics perovskite",
|
|
426
|
+
"Nanoparticle doping molten-core fiber optics materials",
|
|
427
|
+
"Grain orientation angle incidence beam polarization materials",
|
|
428
|
+
"Observing impacts luminescence spectroscopy materials",
|
|
429
|
+
"magnetic topology neutral trapping plasma physics tokamak",
|
|
430
|
+
"Unraveling hierarchical structure saturated monoacid triglycerides lipids",
|
|
431
|
+
"Training data bead stacks Zeiss microscope calibration beads",
|
|
432
|
+
"COLMAP outputs Gaussian Splatting Reconstruction 3D computer vision",
|
|
433
|
+
"Direct STORM imaging transcription element microscopy super-resolution",
|
|
434
|
+
"Cross-polarized light microscopy Coccospheres marine microfossils",
|
|
435
|
+
"Cryo-electron microscopy thin vitreous biological samples cryoEM",
|
|
436
|
+
"Raw confocal imaging FRAP protein dynamics general microscopy",
|
|
437
|
+
"Evaluation strategy image acquisition protocols confocal microscopy",
|
|
438
|
+
"STORM Vectashield datasets Tubulin cytoskeleton microscopy",
|
|
439
|
+
"Objective evaluation image quality planning CT radiation therapy",
|
|
440
|
+
"In Situ Volumetric Imaging FRESH 3D Bioprinted Constructs bioprinting",
|
|
441
|
+
"Thermal-plex fluidic-free rapid sequential multiplexed imaging proteomics",
|
|
442
|
+
"Histological validation per-bundle water diffusion brain tractography",
|
|
443
|
+
"Large-scale in vivo acquisition brain vasculature cerebral vessels",
|
|
444
|
+
"Chronic social defeat stress meningeal neutrophilia brain inflammation",
|
|
445
|
+
"Tracing pathways high-resolution tractography brain connectivity",
|
|
446
|
+
"BRAVE-NET Fully Automated Arterial Brain Vessel segmentation",
|
|
447
|
+
"Correlated variability primate superior colliculus brain neural",
|
|
448
|
+
"Widefield time-lapse Drosophila embryos developmental biology fly",
|
|
449
|
+
"Transcriptomic profiling immune cells pleural effusions lung cancer",
|
|
450
|
+
"3D-printed adapters standardized radiometric photometric calibration equipment",
|
|
451
|
+
"Patterns Gene Expression Splicing Allele-Specific Expression genomics",
|
|
452
|
+
"Modular Tunable Gene Expression Sensing synthetic biology circuits",
|
|
453
|
+
"FIGURE characterisation stem proliferating cells generic figure",
|
|
454
|
+
"Project Gap Junctions microelectrode array electrophysiology",
|
|
455
|
+
"Objective Autonomic Signatures Tinnitus hearing audiology",
|
|
456
|
+
"IML-DKFZ/fd-shifts machine learning code repository",
|
|
457
|
+
"Aspergillus flavus germination fungal pathogen imaging",
|
|
458
|
+
"Intrapartum Ultrasound Grand Challenge obstetric fetal imaging",
|
|
459
|
+
"Correlating Spectral Properties complex mineral samples mineralogy",
|
|
460
|
+
"YOLO Based Machine Learning general object detection computer vision",
|
|
461
|
+
"Freehand ultrasound without external trackers general ultrasound imaging",
|
|
462
|
+
"scRNAseq datasets cranial myogenic progenitors muscle development",
|
|
463
|
+
"Confocal fluorescence microscopy dentinal porosity dental imaging",
|
|
464
|
+
"Circadian rapid eye movement sleep expression sleep research polysomnography",
|
|
465
|
+
"Label-free metabolic fingerprinting motile mammalian spermatozoa fertility",
|
|
466
|
+
"OCT IMAGE DATASET RADIATION DERMATITIS skin dermatology",
|
|
467
|
+
"Tissue-Level Dimerization Analysis AtLEA proteins Arabidopsis plant biology",
|
|
468
|
+
"Ear Datasets hearing auditory speech recognition",
|
|
469
|
+
"Exchange interaction FAD biradical magnetic resonance chemistry",
|
|
470
|
+
"AF driver detection pulmonary vein area cardiac arrhythmia",
|
|
471
|
+
"Roman-Multi-Planetary-data astronomy exoplanet detection",
|
|
472
|
+
"Compatible interaction experiment Aegilops cylindrica wheat pathogen plant",
|
|
473
|
+
"Raw EOG Data electrooculography electrical eye movement recording",
|
|
474
|
+
"CEAP-360VR Continuous Physiological Behavioral Emotion VR annotation",
|
|
475
|
+
"Pultruded carbon fiber profiles 3D x-ray tomography composites materials",
|
|
476
|
+
"Optical electronic signal stabilization plasmonic fiber optic gas sensor",
|
|
477
|
+
"Propulsion nano microcones traveling ultrasound wave acoustic manipulation",
|
|
478
|
+
"Shear Shock Waves Haptic Holography Focused Ultrasound haptics",
|
|
479
|
+
"CeraMIRScan Mid-infrared OCT Ceramic Quality industrial inspection",
|
|
480
|
+
"Dosage effect Copy Number Variation Epilepsy genetic neurology",
|
|
481
|
+
"Field-Effect Transistor Plasmonic Fiber Optic Gate Electrode electronics",
|
|
482
|
+
"Early Onset TAAD cohort genetic cardiovascular aortic disease",
|
|
483
|
+
"Transcriptomic profiling of immune cells in pleural effusions identifies macrophages",
|
|
484
|
+
"fqjin/skin-segmentation skin lesion segmentation code",
|
|
485
|
+
"Subtype identification and clinical application of clear cell renal cell carcinoma",
|
|
486
|
+
"A dataset of global variations in directional solar radiation exposure for ocular surface",
|
|
487
|
+
"Pre-training with simulated ultrasound images for breast mass segmentation",
|
|
488
|
+
"aortic dataset for DB-SNet cardiovascular aortic segmentation",
|
|
489
|
+
"Ground truth labels for BRAVE-NET Fully Automated Arterial Brain Vessel Segmentation",
|
|
490
|
+
"AstroFatheddin/Roman-Multi-Planetary-data astronomy exoplanet",
|
|
491
|
+
"Dataset for Segmentation and Multi-Timepoint Tracking of 3D Cancer Organoids",
|
|
492
|
+
"Dataset_1 of AF driver detection in pulmonary vein area cardiac arrhythmia",
|
|
493
|
+
"Data from Dichoptic metacontrast masking functions to infer transmission delay",
|
|
494
|
+
"IRIS Carbon Mapping Project Curated Dataset carbon emissions",
|
|
495
|
+
# Moved from EDGE_CASE (non-eye medical imaging — clearly NEGATIVE)
|
|
496
|
+
"Brain MRI analysis for Alzheimer's disease detection",
|
|
497
|
+
"Cardiac CT angiography for coronary artery disease",
|
|
498
|
+
"Dermatology skin lesion classification dataset",
|
|
499
|
+
"Dental X-ray caries detection images",
|
|
500
|
+
"Chest X-ray pneumonia detection dataset",
|
|
501
|
+
"Mammography breast cancer screening images",
|
|
502
|
+
"Histopathology slide analysis for cancer diagnosis",
|
|
503
|
+
"Ultrasound imaging for liver disease assessment",
|
|
504
|
+
"PET scan analysis for neurological disorders",
|
|
505
|
+
"Spine MRI for degenerative disc disease",
|
|
506
|
+
# Moved from EDGE_CASE (non-eye OCT — clearly NEGATIVE)
|
|
507
|
+
"OCT for industrial material inspection dataset",
|
|
508
|
+
"Optical coherence tomography in dermatology skin imaging",
|
|
509
|
+
"OCT imaging of atherosclerotic plaque in arteries",
|
|
510
|
+
"Dental OCT for tooth structure analysis",
|
|
511
|
+
"OCT for art conservation painting analysis",
|
|
512
|
+
"Industrial OCT for semiconductor inspection",
|
|
513
|
+
"OCT in cardiology intravascular imaging",
|
|
514
|
+
"Non-destructive testing using OCT",
|
|
515
|
+
"OCT for pharmaceutical tablet coating analysis",
|
|
516
|
+
"Ceramic quality inspection using OCT",
|
|
517
|
+
# Spot-check confounders: brain/neuro segmentation (use "segmentation" vocabulary)
|
|
518
|
+
"ASHS-OAP atlas for automatic entorhinal cortex segmentation brain Alzheimer",
|
|
519
|
+
"FastSurferVINN Checkpoints brain segmentation model weights",
|
|
520
|
+
"Phospho-seq integrated multi-modal profiling intracellular protein dynamics brain organoid",
|
|
521
|
+
# Spot-check confounders: non-eye segmentation (use "segmentation" vocabulary)
|
|
522
|
+
"Doodleverse building and flood segmentation satellite imagery",
|
|
523
|
+
"Doodleverse water segmentation remote sensing",
|
|
524
|
+
"Beach sediment detection and segmentation coastal imagery",
|
|
525
|
+
"DTL-IceNet ice segmentation polar remote sensing",
|
|
526
|
+
"Vine Trunk Semantic Segmentation using Individual Vine Trunks agriculture",
|
|
527
|
+
# Spot-check confounders: plant OCT (use "OCT" vocabulary but not eye)
|
|
528
|
+
"Quantification of plant morphology and leaf thickness with OCT",
|
|
529
|
+
"Revealing real-time 3D in vivo pathogen dynamics in plants by label-free optical",
|
|
530
|
+
# Spot-check confounders: other misclassified records
|
|
531
|
+
"Knowledge-Guided ML can improve carbon cycle predictions in agriculture",
|
|
532
|
+
"PomerFish dataset for fishes across Pomerania freshwater waterbodies underwater",
|
|
533
|
+
"Integrating time-series analysis and deep learning to reconstruct RTS dynamics remote sensing",
|
|
534
|
+
# Spot-check: 4 additional missing NEGATIVE confounders
|
|
535
|
+
"Voronoi segmentation tutorial generic image processing",
|
|
536
|
+
"Audio-visual segmentation multimodal learning benchmark",
|
|
537
|
+
"Exploring high PT experimental charges through the lens of phase maps geology",
|
|
538
|
+
"SF Bay Area Coda Calibration Example Dataset seismology",
|
|
539
|
+
]
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
class EyeImagingClassifier:
|
|
543
|
+
"""Eye imaging dataset classifier using SetFit few-shot learning.
|
|
544
|
+
|
|
545
|
+
Classifies metadata records into 4 classes:
|
|
546
|
+
- EYE_IMAGING: Actual eye imaging datasets (fundus, OCT, OCTA, etc.)
|
|
547
|
+
- EYE_SOFTWARE: Code, tools, models for eye imaging (no actual data)
|
|
548
|
+
- EDGE_CASE: Eye research papers, reviews, borderline items
|
|
549
|
+
- NEGATIVE: Unrelated domains
|
|
550
|
+
|
|
551
|
+
Usage:
|
|
552
|
+
>>> from envision_classifier import EyeImagingClassifier
|
|
553
|
+
>>> clf = EyeImagingClassifier()
|
|
554
|
+
>>> clf.classify("Retinal OCT dataset for diabetic retinopathy")
|
|
555
|
+
{'label': 'EYE_IMAGING', 'confidence': 0.999, 'probabilities': {...}}
|
|
556
|
+
"""
|
|
557
|
+
|
|
558
|
+
LABELS = LABELS
|
|
559
|
+
|
|
560
|
+
def __init__(self, model_path=None, device=None):
|
|
561
|
+
"""Load a trained classifier model.
|
|
562
|
+
|
|
563
|
+
Args:
|
|
564
|
+
model_path: Path to saved model directory, HuggingFace repo ID,
|
|
565
|
+
or None to auto-download from HuggingFace.
|
|
566
|
+
device: "cuda", "cpu", or None for auto-selection.
|
|
567
|
+
"""
|
|
568
|
+
if device is None:
|
|
569
|
+
device = self._select_device()
|
|
570
|
+
self._device = device
|
|
571
|
+
|
|
572
|
+
if model_path is None:
|
|
573
|
+
model_path = self._download_model()
|
|
574
|
+
else:
|
|
575
|
+
model_path = Path(model_path)
|
|
576
|
+
|
|
577
|
+
self._load_local(model_path)
|
|
578
|
+
self._base_model_name = None # set during train()
|
|
579
|
+
|
|
580
|
+
def _download_model(self):
|
|
581
|
+
"""Download model from HuggingFace Hub, using cache."""
|
|
582
|
+
from huggingface_hub import snapshot_download
|
|
583
|
+
|
|
584
|
+
local_dir = snapshot_download(
|
|
585
|
+
repo_id=HF_MODEL_REPO,
|
|
586
|
+
cache_dir=None, # uses default HF cache
|
|
587
|
+
)
|
|
588
|
+
return Path(local_dir)
|
|
589
|
+
|
|
590
|
+
def _load_local(self, model_path):
|
|
591
|
+
"""Load model from local directory."""
|
|
592
|
+
from sentence_transformers import SentenceTransformer
|
|
593
|
+
import joblib
|
|
594
|
+
|
|
595
|
+
model_path = Path(model_path)
|
|
596
|
+
self._encoder = SentenceTransformer(str(model_path), trust_remote_code=True)
|
|
597
|
+
self._encoder = self._encoder.to(self._device)
|
|
598
|
+
self._head = joblib.load(model_path / "model_head.pkl")
|
|
599
|
+
|
|
600
|
+
@staticmethod
|
|
601
|
+
def _select_device():
|
|
602
|
+
"""Auto-select best available GPU or fall back to CPU."""
|
|
603
|
+
import subprocess
|
|
604
|
+
|
|
605
|
+
try:
|
|
606
|
+
result = subprocess.run(
|
|
607
|
+
[
|
|
608
|
+
"nvidia-smi",
|
|
609
|
+
"--query-gpu=index,memory.free",
|
|
610
|
+
"--format=csv,noheader,nounits",
|
|
611
|
+
],
|
|
612
|
+
capture_output=True,
|
|
613
|
+
text=True,
|
|
614
|
+
)
|
|
615
|
+
gpus = [
|
|
616
|
+
(int(line.split(",")[0]), int(line.split(",")[1]))
|
|
617
|
+
for line in result.stdout.strip().split("\n")
|
|
618
|
+
]
|
|
619
|
+
best_gpu = max(gpus, key=lambda x: x[1])[0]
|
|
620
|
+
os.environ["CUDA_VISIBLE_DEVICES"] = str(best_gpu)
|
|
621
|
+
except Exception:
|
|
622
|
+
os.environ.setdefault("CUDA_VISIBLE_DEVICES", "0")
|
|
623
|
+
return "cuda" if torch.cuda.is_available() else "cpu"
|
|
624
|
+
|
|
625
|
+
def classify(self, metadata):
|
|
626
|
+
"""Classify a single metadata record.
|
|
627
|
+
|
|
628
|
+
Args:
|
|
629
|
+
metadata: dict with 'title', 'description', and/or 'keywords',
|
|
630
|
+
or a plain text string.
|
|
631
|
+
|
|
632
|
+
Returns:
|
|
633
|
+
dict with 'label', 'confidence', and 'probabilities'.
|
|
634
|
+
"""
|
|
635
|
+
if isinstance(metadata, str):
|
|
636
|
+
text = metadata
|
|
637
|
+
else:
|
|
638
|
+
text = self.extract_text(metadata)
|
|
639
|
+
return self._predict_batch([text])[0]
|
|
640
|
+
|
|
641
|
+
def classify_batch(self, records, batch_size=16):
|
|
642
|
+
"""Classify multiple metadata records.
|
|
643
|
+
|
|
644
|
+
Args:
|
|
645
|
+
records: list of dicts (with title/description/keywords) or strings.
|
|
646
|
+
batch_size: batch size for inference.
|
|
647
|
+
|
|
648
|
+
Returns:
|
|
649
|
+
list of classification result dicts.
|
|
650
|
+
"""
|
|
651
|
+
texts = []
|
|
652
|
+
for r in records:
|
|
653
|
+
if isinstance(r, str):
|
|
654
|
+
texts.append(r)
|
|
655
|
+
else:
|
|
656
|
+
texts.append(self.extract_text(r))
|
|
657
|
+
|
|
658
|
+
all_results = []
|
|
659
|
+
for i in range(0, len(texts), batch_size):
|
|
660
|
+
batch = texts[i : i + batch_size]
|
|
661
|
+
all_results.extend(self._predict_batch(batch))
|
|
662
|
+
return all_results
|
|
663
|
+
|
|
664
|
+
def _predict_batch(self, texts):
|
|
665
|
+
"""Run prediction on a batch of text strings."""
|
|
666
|
+
import numpy as np
|
|
667
|
+
|
|
668
|
+
embeddings = self._encoder.encode(texts, convert_to_numpy=True)
|
|
669
|
+
predictions = self._head.predict(embeddings)
|
|
670
|
+
probabilities = self._head.predict_proba(embeddings)
|
|
671
|
+
|
|
672
|
+
results = []
|
|
673
|
+
for i in range(len(texts)):
|
|
674
|
+
pred = predictions[i]
|
|
675
|
+
probs = probabilities[i]
|
|
676
|
+
|
|
677
|
+
if isinstance(pred, (int, float, np.integer)):
|
|
678
|
+
pred_int = int(pred)
|
|
679
|
+
else:
|
|
680
|
+
pred_int = {
|
|
681
|
+
"NEGATIVE": 0,
|
|
682
|
+
"EDGE_CASE": 1,
|
|
683
|
+
"EYE_SOFTWARE": 2,
|
|
684
|
+
"EYE_IMAGING": 3,
|
|
685
|
+
}.get(str(pred), 0)
|
|
686
|
+
|
|
687
|
+
label = self.LABELS[pred_int]
|
|
688
|
+
|
|
689
|
+
results.append(
|
|
690
|
+
{
|
|
691
|
+
"label": label,
|
|
692
|
+
"confidence": float(max(probs)),
|
|
693
|
+
"probabilities": {
|
|
694
|
+
"NEGATIVE": float(probs[0]),
|
|
695
|
+
"EDGE_CASE": float(probs[1]),
|
|
696
|
+
"EYE_SOFTWARE": float(probs[2]),
|
|
697
|
+
"EYE_IMAGING": float(probs[3]),
|
|
698
|
+
},
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
return results
|
|
702
|
+
|
|
703
|
+
@classmethod
|
|
704
|
+
def train(cls, output_dir=None, device=None, base_model_name=None,
|
|
705
|
+
num_epochs=2, batch_size=16):
|
|
706
|
+
"""Train a new classifier from the built-in training data.
|
|
707
|
+
|
|
708
|
+
Args:
|
|
709
|
+
output_dir: Directory to save the model.
|
|
710
|
+
device: Device for training. None for auto-selection.
|
|
711
|
+
base_model_name: Sentence transformer backbone model name.
|
|
712
|
+
Defaults to BASE_MODEL_NAME (sentence-transformers/all-mpnet-base-v2).
|
|
713
|
+
num_epochs: Number of training epochs (default: 2).
|
|
714
|
+
batch_size: Training batch size (default: 16).
|
|
715
|
+
|
|
716
|
+
Returns:
|
|
717
|
+
EyeImagingClassifier instance with the trained model.
|
|
718
|
+
"""
|
|
719
|
+
from setfit import SetFitModel, Trainer, TrainingArguments
|
|
720
|
+
from datasets import Dataset
|
|
721
|
+
|
|
722
|
+
if device is None:
|
|
723
|
+
device = cls._select_device()
|
|
724
|
+
|
|
725
|
+
if base_model_name is None:
|
|
726
|
+
base_model_name = BASE_MODEL_NAME
|
|
727
|
+
|
|
728
|
+
if output_dir is None:
|
|
729
|
+
output_dir = Path.cwd() / "models" / "setfit_v7"
|
|
730
|
+
else:
|
|
731
|
+
output_dir = Path(output_dir)
|
|
732
|
+
|
|
733
|
+
train_texts = (
|
|
734
|
+
EYE_IMAGING_EXAMPLES
|
|
735
|
+
+ EYE_SOFTWARE_EXAMPLES
|
|
736
|
+
+ EDGE_CASE_EXAMPLES
|
|
737
|
+
+ NEGATIVE_EXAMPLES
|
|
738
|
+
)
|
|
739
|
+
train_labels = (
|
|
740
|
+
[3] * len(EYE_IMAGING_EXAMPLES)
|
|
741
|
+
+ [2] * len(EYE_SOFTWARE_EXAMPLES)
|
|
742
|
+
+ [1] * len(EDGE_CASE_EXAMPLES)
|
|
743
|
+
+ [0] * len(NEGATIVE_EXAMPLES)
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
train_dataset = Dataset.from_dict(
|
|
747
|
+
{
|
|
748
|
+
"text": train_texts,
|
|
749
|
+
"label": train_labels,
|
|
750
|
+
}
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
print(f"Training SetFit model with {base_model_name}")
|
|
754
|
+
print(f" Training examples: {len(train_dataset)}")
|
|
755
|
+
print(f" Device: {device}")
|
|
756
|
+
|
|
757
|
+
model = SetFitModel.from_pretrained(
|
|
758
|
+
base_model_name,
|
|
759
|
+
labels=LABELS,
|
|
760
|
+
device=device,
|
|
761
|
+
trust_remote_code=True,
|
|
762
|
+
)
|
|
763
|
+
|
|
764
|
+
args = TrainingArguments(
|
|
765
|
+
output_dir=str(output_dir / "checkpoints"),
|
|
766
|
+
batch_size=batch_size,
|
|
767
|
+
num_epochs=num_epochs,
|
|
768
|
+
evaluation_strategy="no",
|
|
769
|
+
save_strategy="no",
|
|
770
|
+
logging_steps=50,
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
trainer = Trainer(
|
|
774
|
+
model=model,
|
|
775
|
+
args=args,
|
|
776
|
+
train_dataset=train_dataset,
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
print("Starting training...")
|
|
780
|
+
trainer.train()
|
|
781
|
+
|
|
782
|
+
output_dir.mkdir(exist_ok=True, parents=True)
|
|
783
|
+
model.save_pretrained(str(output_dir))
|
|
784
|
+
print(f"Model saved to: {output_dir}")
|
|
785
|
+
|
|
786
|
+
instance = cls(model_path=output_dir, device=device)
|
|
787
|
+
instance._base_model_name = base_model_name
|
|
788
|
+
return instance
|
|
789
|
+
|
|
790
|
+
@staticmethod
|
|
791
|
+
def extract_text(metadata):
|
|
792
|
+
"""Compose classification text from metadata fields.
|
|
793
|
+
|
|
794
|
+
Args:
|
|
795
|
+
metadata: dict with 'title', 'description', and/or 'keywords'.
|
|
796
|
+
|
|
797
|
+
Returns:
|
|
798
|
+
Combined text string.
|
|
799
|
+
"""
|
|
800
|
+
title = metadata.get("title", "")
|
|
801
|
+
desc = EyeImagingClassifier.strip_html(metadata.get("description", ""))
|
|
802
|
+
keywords = metadata.get("keywords", [])
|
|
803
|
+
if isinstance(keywords, list):
|
|
804
|
+
keywords = " ".join(keywords)
|
|
805
|
+
return f"{title} {desc} {keywords}".strip()
|
|
806
|
+
|
|
807
|
+
@staticmethod
|
|
808
|
+
def strip_html(text):
|
|
809
|
+
"""Remove HTML tags from text."""
|
|
810
|
+
if not text:
|
|
811
|
+
return ""
|
|
812
|
+
clean = re.sub("<[^<]+?>", " ", text)
|
|
813
|
+
return unescape(clean).strip()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""
|
|
2
|
+
envision-classifier CLI
|
|
3
|
+
|
|
4
|
+
Command-line interface for classifying eye imaging datasets.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
import click
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.group()
|
|
14
|
+
@click.version_option(package_name="envision-classifier")
|
|
15
|
+
def cli():
|
|
16
|
+
"""ENVISION: Eye imaging dataset classifier."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@cli.command()
|
|
20
|
+
@click.argument("input_file", required=False, type=click.Path(exists=True))
|
|
21
|
+
@click.option("--text", "-t", help="Classify a text string directly.")
|
|
22
|
+
@click.option("--model", "-m", help="Path to trained model directory.")
|
|
23
|
+
@click.option("--device", "-d", help="Device (cuda/cpu).")
|
|
24
|
+
@click.option("--pretty/--compact", default=True, help="Pretty-print JSON output.")
|
|
25
|
+
def classify(input_file, text, model, device, pretty):
|
|
26
|
+
"""Classify metadata as eye imaging datasets.
|
|
27
|
+
|
|
28
|
+
Accepts a JSON file, --text string, or stdin.
|
|
29
|
+
"""
|
|
30
|
+
from .classifier import EyeImagingClassifier
|
|
31
|
+
|
|
32
|
+
classifier = EyeImagingClassifier(model_path=model, device=device)
|
|
33
|
+
indent = 2 if pretty else None
|
|
34
|
+
|
|
35
|
+
if text:
|
|
36
|
+
result = classifier.classify(text)
|
|
37
|
+
click.echo(json.dumps(result, indent=indent))
|
|
38
|
+
elif input_file:
|
|
39
|
+
with open(input_file) as f:
|
|
40
|
+
data = json.load(f)
|
|
41
|
+
if isinstance(data, list):
|
|
42
|
+
results = classifier.classify_batch(data)
|
|
43
|
+
else:
|
|
44
|
+
results = classifier.classify(data)
|
|
45
|
+
click.echo(json.dumps(results, indent=indent))
|
|
46
|
+
elif not sys.stdin.isatty():
|
|
47
|
+
data = json.load(sys.stdin)
|
|
48
|
+
if isinstance(data, list):
|
|
49
|
+
results = classifier.classify_batch(data)
|
|
50
|
+
else:
|
|
51
|
+
results = classifier.classify(data)
|
|
52
|
+
click.echo(json.dumps(results, indent=indent))
|
|
53
|
+
else:
|
|
54
|
+
click.echo("Provide a JSON file, --text, or pipe JSON via stdin.", err=True)
|
|
55
|
+
raise SystemExit(1)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@cli.command()
|
|
59
|
+
@click.option("--output", "-o", help="Output directory for trained model.")
|
|
60
|
+
@click.option("--device", "-d", help="Device (cuda/cpu).")
|
|
61
|
+
def train(output, device):
|
|
62
|
+
"""Train a new classifier from built-in training data."""
|
|
63
|
+
from .classifier import EyeImagingClassifier
|
|
64
|
+
|
|
65
|
+
classifier = EyeImagingClassifier.train(output_dir=output, device=device)
|
|
66
|
+
click.echo(f"\nModel ready. Labels: {classifier.LABELS}")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@cli.command()
|
|
70
|
+
def info():
|
|
71
|
+
"""Display classifier information."""
|
|
72
|
+
from . import __version__
|
|
73
|
+
from .classifier import (
|
|
74
|
+
BASE_MODEL_NAME,
|
|
75
|
+
HF_MODEL_REPO,
|
|
76
|
+
LABELS,
|
|
77
|
+
EYE_IMAGING_EXAMPLES,
|
|
78
|
+
EYE_SOFTWARE_EXAMPLES,
|
|
79
|
+
EDGE_CASE_EXAMPLES,
|
|
80
|
+
NEGATIVE_EXAMPLES,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
click.echo(f"envision-classifier v{__version__}")
|
|
84
|
+
click.echo(f"Base model: {BASE_MODEL_NAME}")
|
|
85
|
+
click.echo(f"HuggingFace repo: {HF_MODEL_REPO}")
|
|
86
|
+
click.echo(f"Labels: {', '.join(LABELS)}")
|
|
87
|
+
click.echo(f"Training data: {len(EYE_IMAGING_EXAMPLES)} eye_imaging, "
|
|
88
|
+
f"{len(EYE_SOFTWARE_EXAMPLES)} eye_software, "
|
|
89
|
+
f"{len(EDGE_CASE_EXAMPLES)} edge_case, "
|
|
90
|
+
f"{len(NEGATIVE_EXAMPLES)} negative")
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
|
|
3
|
+
name = "envision-classifier"
|
|
4
|
+
version = "0.1.0"
|
|
5
|
+
description = "Few-shot classifier for detecting eye imaging datasets"
|
|
6
|
+
|
|
7
|
+
packages = [{ include = "envision_classifier" }]
|
|
8
|
+
|
|
9
|
+
license = "MIT"
|
|
10
|
+
authors = [
|
|
11
|
+
"FAIR Data Innovations Hub <contact@fairdataihub.org>",
|
|
12
|
+
"James O'Neill <joneill@calmi2.org>",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
homepage = "https://github.com/EyeACT/envision-classifier"
|
|
17
|
+
documentation = "https://envision-classifier.readthedocs.io"
|
|
18
|
+
repository = "https://github.com/EyeACT/envision-classifier"
|
|
19
|
+
|
|
20
|
+
keywords = [
|
|
21
|
+
"eye imaging",
|
|
22
|
+
"ophthalmology",
|
|
23
|
+
"OCT",
|
|
24
|
+
"fundus",
|
|
25
|
+
"retina",
|
|
26
|
+
"machine learning",
|
|
27
|
+
"dataset discovery",
|
|
28
|
+
"classification",
|
|
29
|
+
"setfit",
|
|
30
|
+
"few-shot",
|
|
31
|
+
"fair-data",
|
|
32
|
+
]
|
|
33
|
+
classifiers = [
|
|
34
|
+
"Development Status :: 4 - Beta",
|
|
35
|
+
"Intended Audience :: Science/Research",
|
|
36
|
+
"Intended Audience :: Developers",
|
|
37
|
+
"License :: OSI Approved :: MIT License",
|
|
38
|
+
"Natural Language :: English",
|
|
39
|
+
"Operating System :: OS Independent",
|
|
40
|
+
"Programming Language :: Python",
|
|
41
|
+
"Programming Language :: Python :: 3",
|
|
42
|
+
"Programming Language :: Python :: 3.10",
|
|
43
|
+
"Programming Language :: Python :: 3.11",
|
|
44
|
+
"Programming Language :: Python :: 3.12",
|
|
45
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
46
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.poetry.dependencies]
|
|
50
|
+
|
|
51
|
+
python = "^3.10"
|
|
52
|
+
|
|
53
|
+
click = "^8.0"
|
|
54
|
+
|
|
55
|
+
# ML/AI dependencies
|
|
56
|
+
torch = ">=2.0.0"
|
|
57
|
+
transformers = ">=4.35.0"
|
|
58
|
+
setfit = ">=1.0.0"
|
|
59
|
+
datasets = ">=2.14.0"
|
|
60
|
+
scikit-learn = ">=1.3.0"
|
|
61
|
+
huggingface-hub = ">=0.20.0"
|
|
62
|
+
|
|
63
|
+
[tool.poetry.group.dev.dependencies]
|
|
64
|
+
|
|
65
|
+
# Formatters
|
|
66
|
+
black = "^22.1"
|
|
67
|
+
tomli = "*"
|
|
68
|
+
isort = "^5.10"
|
|
69
|
+
|
|
70
|
+
# Linters
|
|
71
|
+
mypy = "^1.0"
|
|
72
|
+
pydocstyle = "^6.1"
|
|
73
|
+
pylint = "~2.15"
|
|
74
|
+
wrapt = "*"
|
|
75
|
+
|
|
76
|
+
# Testing
|
|
77
|
+
pytest = "^7.1"
|
|
78
|
+
pytest-describe = "^2.0"
|
|
79
|
+
pytest-cov = "^3.0"
|
|
80
|
+
|
|
81
|
+
# Documentation
|
|
82
|
+
mkdocs = "~1.3"
|
|
83
|
+
pygments = "^2.11.1"
|
|
84
|
+
|
|
85
|
+
# Tooling
|
|
86
|
+
poethepoet = "^0.20.0"
|
|
87
|
+
|
|
88
|
+
[tool.poetry.scripts]
|
|
89
|
+
|
|
90
|
+
envision-classifier = "envision_classifier.cli:cli"
|
|
91
|
+
|
|
92
|
+
[tool.poe.tasks]
|
|
93
|
+
|
|
94
|
+
docs = "mkdocs serve"
|
|
95
|
+
format_with_isort = "isort envision_classifier tests"
|
|
96
|
+
format_with_black = "black envision_classifier tests"
|
|
97
|
+
format = ["format_with_isort", "format_with_black"]
|
|
98
|
+
typecheck = "mypy envision_classifier tests"
|
|
99
|
+
pylint = "pylint envision_classifier tests --rcfile=.pylint.ini"
|
|
100
|
+
precommit = ["format", "typecheck", "pylint"]
|
|
101
|
+
test = "pytest -rx -W ignore::DeprecationWarning"
|
|
102
|
+
|
|
103
|
+
[tool.black]
|
|
104
|
+
|
|
105
|
+
quiet = true
|
|
106
|
+
line-length = 100
|
|
107
|
+
|
|
108
|
+
[tool.isort]
|
|
109
|
+
|
|
110
|
+
profile = "black"
|
|
111
|
+
line_length = 100
|
|
112
|
+
|
|
113
|
+
[tool.mypy]
|
|
114
|
+
|
|
115
|
+
ignore_missing_imports = true
|
|
116
|
+
no_implicit_optional = true
|
|
117
|
+
check_untyped_defs = true
|
|
118
|
+
cache_dir = ".cache/mypy/"
|
|
119
|
+
|
|
120
|
+
[tool.pytest.ini_options]
|
|
121
|
+
|
|
122
|
+
addopts = """
|
|
123
|
+
--strict-markers
|
|
124
|
+
|
|
125
|
+
-r sxX
|
|
126
|
+
--show-capture=log
|
|
127
|
+
|
|
128
|
+
--cov-report=html
|
|
129
|
+
--cov-report=term-missing:skip-covered
|
|
130
|
+
--no-cov-on-fail
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
cache_dir = ".cache/pytest/"
|
|
134
|
+
|
|
135
|
+
markers = []
|
|
136
|
+
|
|
137
|
+
[build-system]
|
|
138
|
+
|
|
139
|
+
requires = ["poetry-core>=1.0.0"]
|
|
140
|
+
build-backend = "poetry.core.masonry.api"
|