Datasets:
Laureηt
commited on
Commit
•
331d34f
0
Parent(s):
ahahah biotech go brrrrrrrrr
Browse files- .envrc +1 -0
- .gitattributes +54 -0
- .gitignore +163 -0
- README.md +3 -0
- flake.lock +61 -0
- flake.nix +19 -0
- nct-crc-he.py +102 -0
- test.py +7 -0
.envrc
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
use flake
|
.gitattributes
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
# Audio files - uncompressed
|
37 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
38 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
39 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
40 |
+
# Audio files - compressed
|
41 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
42 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
43 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
44 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
45 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
46 |
+
# Image files - uncompressed
|
47 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
48 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
49 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
50 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
51 |
+
# Image files - compressed
|
52 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.direnv
|
2 |
+
|
3 |
+
# https://github.com/github/gitignore/blob/main/Python.gitignore
|
4 |
+
# Byte-compiled / optimized / DLL files
|
5 |
+
__pycache__/
|
6 |
+
*.py[cod]
|
7 |
+
*$py.class
|
8 |
+
|
9 |
+
# C extensions
|
10 |
+
*.so
|
11 |
+
|
12 |
+
# Distribution / packaging
|
13 |
+
.Python
|
14 |
+
build/
|
15 |
+
develop-eggs/
|
16 |
+
dist/
|
17 |
+
downloads/
|
18 |
+
eggs/
|
19 |
+
.eggs/
|
20 |
+
lib/
|
21 |
+
lib64/
|
22 |
+
parts/
|
23 |
+
sdist/
|
24 |
+
var/
|
25 |
+
wheels/
|
26 |
+
share/python-wheels/
|
27 |
+
*.egg-info/
|
28 |
+
.installed.cfg
|
29 |
+
*.egg
|
30 |
+
MANIFEST
|
31 |
+
|
32 |
+
# PyInstaller
|
33 |
+
# Usually these files are written by a python script from a template
|
34 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
35 |
+
*.manifest
|
36 |
+
*.spec
|
37 |
+
|
38 |
+
# Installer logs
|
39 |
+
pip-log.txt
|
40 |
+
pip-delete-this-directory.txt
|
41 |
+
|
42 |
+
# Unit test / coverage reports
|
43 |
+
htmlcov/
|
44 |
+
.tox/
|
45 |
+
.nox/
|
46 |
+
.coverage
|
47 |
+
.coverage.*
|
48 |
+
.cache
|
49 |
+
nosetests.xml
|
50 |
+
coverage.xml
|
51 |
+
*.cover
|
52 |
+
*.py,cover
|
53 |
+
.hypothesis/
|
54 |
+
.pytest_cache/
|
55 |
+
cover/
|
56 |
+
|
57 |
+
# Translations
|
58 |
+
*.mo
|
59 |
+
*.pot
|
60 |
+
|
61 |
+
# Django stuff:
|
62 |
+
*.log
|
63 |
+
local_settings.py
|
64 |
+
db.sqlite3
|
65 |
+
db.sqlite3-journal
|
66 |
+
|
67 |
+
# Flask stuff:
|
68 |
+
instance/
|
69 |
+
.webassets-cache
|
70 |
+
|
71 |
+
# Scrapy stuff:
|
72 |
+
.scrapy
|
73 |
+
|
74 |
+
# Sphinx documentation
|
75 |
+
docs/_build/
|
76 |
+
|
77 |
+
# PyBuilder
|
78 |
+
.pybuilder/
|
79 |
+
target/
|
80 |
+
|
81 |
+
# Jupyter Notebook
|
82 |
+
.ipynb_checkpoints
|
83 |
+
|
84 |
+
# IPython
|
85 |
+
profile_default/
|
86 |
+
ipython_config.py
|
87 |
+
|
88 |
+
# pyenv
|
89 |
+
# For a library or package, you might want to ignore these files since the code is
|
90 |
+
# intended to run in multiple environments; otherwise, check them in:
|
91 |
+
# .python-version
|
92 |
+
|
93 |
+
# pipenv
|
94 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
95 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
96 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
97 |
+
# install all needed dependencies.
|
98 |
+
#Pipfile.lock
|
99 |
+
|
100 |
+
# poetry
|
101 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
102 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
103 |
+
# commonly ignored for libraries.
|
104 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
105 |
+
#poetry.lock
|
106 |
+
|
107 |
+
# pdm
|
108 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
109 |
+
#pdm.lock
|
110 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
111 |
+
# in version control.
|
112 |
+
# https://pdm.fming.dev/#use-with-ide
|
113 |
+
.pdm.toml
|
114 |
+
|
115 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
116 |
+
__pypackages__/
|
117 |
+
|
118 |
+
# Celery stuff
|
119 |
+
celerybeat-schedule
|
120 |
+
celerybeat.pid
|
121 |
+
|
122 |
+
# SageMath parsed files
|
123 |
+
*.sage.py
|
124 |
+
|
125 |
+
# Environments
|
126 |
+
.env
|
127 |
+
.venv
|
128 |
+
env/
|
129 |
+
venv/
|
130 |
+
ENV/
|
131 |
+
env.bak/
|
132 |
+
venv.bak/
|
133 |
+
|
134 |
+
# Spyder project settings
|
135 |
+
.spyderproject
|
136 |
+
.spyproject
|
137 |
+
|
138 |
+
# Rope project settings
|
139 |
+
.ropeproject
|
140 |
+
|
141 |
+
# mkdocs documentation
|
142 |
+
/site
|
143 |
+
|
144 |
+
# mypy
|
145 |
+
.mypy_cache/
|
146 |
+
.dmypy.json
|
147 |
+
dmypy.json
|
148 |
+
|
149 |
+
# Pyre type checker
|
150 |
+
.pyre/
|
151 |
+
|
152 |
+
# pytype static type analyzer
|
153 |
+
.pytype/
|
154 |
+
|
155 |
+
# Cython debug symbols
|
156 |
+
cython_debug/
|
157 |
+
|
158 |
+
# PyCharm
|
159 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
160 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
161 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
162 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
163 |
+
#.idea/
|
README.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
---
|
flake.lock
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nodes": {
|
3 |
+
"flake-utils": {
|
4 |
+
"inputs": {
|
5 |
+
"systems": "systems"
|
6 |
+
},
|
7 |
+
"locked": {
|
8 |
+
"lastModified": 1694529238,
|
9 |
+
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
10 |
+
"owner": "numtide",
|
11 |
+
"repo": "flake-utils",
|
12 |
+
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
13 |
+
"type": "github"
|
14 |
+
},
|
15 |
+
"original": {
|
16 |
+
"owner": "numtide",
|
17 |
+
"repo": "flake-utils",
|
18 |
+
"type": "github"
|
19 |
+
}
|
20 |
+
},
|
21 |
+
"nixpkgs": {
|
22 |
+
"locked": {
|
23 |
+
"lastModified": 1694767346,
|
24 |
+
"narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=",
|
25 |
+
"owner": "NixOS",
|
26 |
+
"repo": "nixpkgs",
|
27 |
+
"rev": "ace5093e36ab1e95cb9463863491bee90d5a4183",
|
28 |
+
"type": "github"
|
29 |
+
},
|
30 |
+
"original": {
|
31 |
+
"owner": "NixOS",
|
32 |
+
"ref": "nixos-unstable",
|
33 |
+
"repo": "nixpkgs",
|
34 |
+
"type": "github"
|
35 |
+
}
|
36 |
+
},
|
37 |
+
"root": {
|
38 |
+
"inputs": {
|
39 |
+
"flake-utils": "flake-utils",
|
40 |
+
"nixpkgs": "nixpkgs"
|
41 |
+
}
|
42 |
+
},
|
43 |
+
"systems": {
|
44 |
+
"locked": {
|
45 |
+
"lastModified": 1681028828,
|
46 |
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
47 |
+
"owner": "nix-systems",
|
48 |
+
"repo": "default",
|
49 |
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
50 |
+
"type": "github"
|
51 |
+
},
|
52 |
+
"original": {
|
53 |
+
"owner": "nix-systems",
|
54 |
+
"repo": "default",
|
55 |
+
"type": "github"
|
56 |
+
}
|
57 |
+
}
|
58 |
+
},
|
59 |
+
"root": "root",
|
60 |
+
"version": 7
|
61 |
+
}
|
flake.nix
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
inputs = {
|
3 |
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
4 |
+
flake-utils.url = "github:numtide/flake-utils";
|
5 |
+
};
|
6 |
+
|
7 |
+
outputs = { self, nixpkgs, flake-utils }:
|
8 |
+
flake-utils.lib.eachDefaultSystem (system:
|
9 |
+
let pkgs = nixpkgs.legacyPackages.${system};
|
10 |
+
in {
|
11 |
+
devShell = pkgs.mkShell {
|
12 |
+
buildInputs = with pkgs; [
|
13 |
+
python311
|
14 |
+
python311Packages.datasets
|
15 |
+
python311Packages.pillow
|
16 |
+
];
|
17 |
+
};
|
18 |
+
});
|
19 |
+
}
|
nct-crc-he.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pathlib
|
2 |
+
import datasets
|
3 |
+
|
4 |
+
_DL_URL = "https://zenodo.org/record/1214456/files/"
|
5 |
+
|
6 |
+
_BASE_URLS = {
|
7 |
+
"CRC_VAL_HE_7K": f"{_DL_URL}/CRC-VAL-HE-7K.zip",
|
8 |
+
"NCT_CRC_HE_100K": f"{_DL_URL}/NCT-CRC-HE-100K.zip",
|
9 |
+
"NCT_CRC_HE_100K_NONORM": f"{_DL_URL}/NCT-CRC-HE-100K-NONORM.zip",
|
10 |
+
}
|
11 |
+
|
12 |
+
# _MD5_CHECKSUMS = {
|
13 |
+
# "CRC_VAL_HE_7K": "2fd1651b4f94ebd818ebf90ad2b6ce06",
|
14 |
+
# "NCT_CRC_HE_100K": "035777cf327776a71a05c95da6d6325f",
|
15 |
+
# "NCT_CRC_HE_100K_NONORM": "6fd702d11df6292bc054397ae038a464",
|
16 |
+
# }
|
17 |
+
|
18 |
+
_HOMEPAGE = "https://zenodo.org/record/1214456"
|
19 |
+
|
20 |
+
_DESCRIPTION = """
|
21 |
+
This is a set of non-overlapping image patches from hematoxylin & eosin (H&E) stained histological images of human colorectal cancer (CRC) and normal tissue.
|
22 |
+
All images are 224x224 pixels (px) at 0.5 microns per pixel (MPP). All images are color-normalized using Macenko's method (http://ieeexplore.ieee.org/abstract/document/5193250/, DOI 10.1109/ISBI.2009.5193250).
|
23 |
+
Tissue classes are: Adipose (ADI), background (BACK), debris (DEB), lymphocytes (LYM), mucus (MUC), smooth muscle (MUS), normal colon mucosa (NORM), cancer-associated stroma (STR), colorectal adenocarcinoma epithelium (TUM).
|
24 |
+
These images were manually extracted from N=86 H&E stained human cancer tissue slides from formalin-fixed paraffin-embedded (FFPE) samples from the NCT Biobank (National Center for Tumor Diseases, Heidelberg, Germany) and the UMM pathology archive (University Medical Center Mannheim, Mannheim, Germany). Tissue samples contained CRC primary tumor slides and tumor tissue from CRC liver metastases; normal tissue classes were augmented with non-tumorous regions from gastrectomy specimen to increase variability.
|
25 |
+
"""
|
26 |
+
|
27 |
+
_LICENSE = "CC BY 4.0"
|
28 |
+
|
29 |
+
_VERSION = datasets.Version("0.1.0")
|
30 |
+
|
31 |
+
_CITATION = """
|
32 |
+
@dataset{kather_jakob_nikolas_2018_1214456,
|
33 |
+
author = {Kather, Jakob Nikolas and Halama, Niels and Marx, Alexander},
|
34 |
+
title = {{100,000 histological images of human colorectal cancer and healthy tissue}},
|
35 |
+
month = apr,
|
36 |
+
year = 2018,
|
37 |
+
publisher = {Zenodo},
|
38 |
+
version = {v0.1},
|
39 |
+
doi = {10.5281/zenodo.1214456},
|
40 |
+
url = {https://doi.org/10.5281/zenodo.1214456}
|
41 |
+
}
|
42 |
+
"""
|
43 |
+
|
44 |
+
_NAMES = [
|
45 |
+
"ADI", # Adipose
|
46 |
+
"BACK", # Background
|
47 |
+
"DEB", # Debris
|
48 |
+
"LYM", # Lymphocytes
|
49 |
+
"MUC", # Mucus
|
50 |
+
"MUS", # Smooth muscle
|
51 |
+
"NORM", # Normal colon mucosa
|
52 |
+
"STR", # Cancer-associated stroma
|
53 |
+
"TUM", # Colorectal adenocarcinoma epithelium
|
54 |
+
]
|
55 |
+
|
56 |
+
class NCT_CRC_HE(datasets.GeneratorBasedBuilder):
|
57 |
+
"""NCT-CRC-HE (7k, 100k, 100k_nonorm) dataset."""
|
58 |
+
|
59 |
+
def _info(self):
|
60 |
+
return datasets.DatasetInfo(
|
61 |
+
homepage=_HOMEPAGE,
|
62 |
+
description=_DESCRIPTION,
|
63 |
+
citation=_CITATION,
|
64 |
+
license=_LICENSE,
|
65 |
+
version=_VERSION,
|
66 |
+
features=datasets.Features(
|
67 |
+
{
|
68 |
+
"image": datasets.Image(),
|
69 |
+
"label": datasets.ClassLabel(names=_NAMES),
|
70 |
+
}
|
71 |
+
),
|
72 |
+
supervised_keys=(
|
73 |
+
"image",
|
74 |
+
"label",
|
75 |
+
),
|
76 |
+
task_templates=[
|
77 |
+
datasets.tasks.ImageClassification(
|
78 |
+
image_column="image",
|
79 |
+
label_column="label",
|
80 |
+
),
|
81 |
+
],
|
82 |
+
)
|
83 |
+
|
84 |
+
def _split_generators(self, dl_manager):
|
85 |
+
return [
|
86 |
+
datasets.SplitGenerator(
|
87 |
+
name=datasets.NamedSplit(name),
|
88 |
+
gen_kwargs={
|
89 |
+
"data_dir": pathlib.Path(dl_manager.download_and_extract(url))
|
90 |
+
},
|
91 |
+
)
|
92 |
+
for name, url in _BASE_URLS.items()
|
93 |
+
]
|
94 |
+
|
95 |
+
def _generate_examples(self, data_dir):
|
96 |
+
"""Generate images and labels for splits."""
|
97 |
+
tif_images = pathlib.Path(data_dir).rglob("*.tif")
|
98 |
+
for index, filepath in enumerate(tif_images):
|
99 |
+
yield index, {
|
100 |
+
"image": str(filepath),
|
101 |
+
"label": filepath.parent.name,
|
102 |
+
}
|
test.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
|
3 |
+
ds = datasets.load_dataset('./nct-crc-he.py')
|
4 |
+
|
5 |
+
print(ds)
|
6 |
+
|
7 |
+
print(ds['CRC_VAL_HE_7K'][0])
|