--- dataset_info: features: - name: image_id dtype: string - name: image dtype: image - name: organ dtype: string - name: category dtype: string - name: finding dtype: string - name: label dtype: int32 splits: - name: train num_bytes: 2438255685 num_examples: 10662 download_size: 3935481324 dataset_size: 2438255685 configs: - config_name: default data_files: - split: train path: data/train-* license: cc-by-4.0 task_categories: - image-classification language: - en tags: - endoscopy - gastrointestinal - colonoscopy - gastroscopy - polyps - medical - classification pretty_name: HyperKvasir size_categories: - 10K///.jpg` - `label` is the index of `finding` in the alphabetically sorted list of the 23 classes - All labeled images were preserved ## πŸš€ Usage ```python from datasets import load_dataset import matplotlib.pyplot as plt ds = load_dataset("chehablab/HyperKvasir", split="train") # One example image per class findings = ds["finding"] classes = sorted(set(findings)) fig, axes = plt.subplots(4, 6, figsize=(16, 11)) for ax in axes.flat: ax.axis("off") for ax, c in zip(axes.flat, classes): sample = ds[findings.index(c)] ax.imshow(sample["image"]) ax.set_title(f"{c}\n{sample['organ']}", fontsize=8) plt.tight_layout() plt.show() # Filter by organ or category polyps = ds.filter(lambda x: x["finding"] == "polyps") upper_gi = ds.filter(lambda x: x["organ"] == "upper-gi-tract") print(f"Polyps: {len(polyps)}, upper GI: {len(upper_gi)}") # No split in this release: make a stratified train/test split split = ds.class_encode_column("label").train_test_split(test_size=0.2, stratify_by_column="label", seed=0) ``` --- ## 🏷️ Feature Descriptions ### Classes 23 classes, grouped by organ and category: Lower GI tract (colonoscopy) - *Anatomical landmarks* - Cecum β€” Most proximal part of the colon; reaching it confirms a complete colonoscopy - Ileum β€” Terminal ileum, reached through the ileocecal valve - Retroflex rectum β€” Retroflexed view of the distal rectum - *Pathological findings* - Hemorrhoids β€” Dilated vascular structures in the anal canal - Polyps β€” Mucosal growths, potential precursors of colorectal cancer - Ulcerative colitis, grade 0–1 / 1 / 1–2 / 2 / 2–3 / 3 β€” Inflammation graded by severity on the Mayo endoscopic score - *Quality of mucosal views* - BBPS 0–1 β€” Poor bowel preparation (Boston Bowel Preparation Scale 0–1) - BBPS 2–3 β€” Good bowel preparation (BBPS 2–3) - Impacted stool β€” Stool that blocks the view of the mucosa - *Therapeutic interventions* - Dyed lifted polyps β€” Polyps lifted by injection of dyed saline before removal - Dyed resection margins β€” Resection site after polyp removal Upper GI tract (gastroscopy) - *Anatomical landmarks* - Pylorus β€” Opening from the stomach into the duodenum - Retroflex stomach β€” Retroflexed view of the upper stomach and cardia - Z-line β€” Junction between the esophagus and the stomach - *Pathological findings* - Barrett's β€” Barrett's esophagus (metaplasia of the distal esophagus) - Barrett's, short segment β€” Short-segment Barrett's esophagus - Esophagitis A β€” Mild esophagitis (Los Angeles grade A) - Esophagitis B–D β€” More severe esophagitis (Los Angeles grades B–D) ### Image Specifications - Modality: White-light GI endoscopy (gastroscopy and colonoscopy) - Image size: Variable resolution, RGB, JPG - Content: Single endoscopy frames ### Acquisition Protocol - Procedures: Routine clinical gastroscopies and colonoscopies, Norway - Annotation: Labelled by experienced gastrointestinal endoscopists --- ## πŸ§ͺ Use Cases - Multi-class classification of GI endoscopy images - Polyp detection and classification - Grading of ulcerative colitis and esophagitis - Bowel-preparation quality assessment (BBPS) - Anatomical landmark recognition for automatic procedure reporting - Representation learning, feature extraction and self-supervised pretraining for endoscopy ## ⚠️ Important Notes - No split in this release: The dataset has a single `train` split. Make your own stratified train/validation/test split (see Usage). - No patient IDs: Images are named by UUID and the release does not say which images come from the same patient or procedure, so a random split can place frames from one examination in both training and evaluation. - Class imbalance: Class sizes vary widely. Use weighted sampling, class balancing or class merging as needed. - Fine-grained grades: Neighbouring ulcerative-colitis grades (e.g., `grade-1` vs `grade-1-2`) and Barrett's subtypes are hard to tell apart and are often merged in practice. ## πŸ“š Citation This dataset is derived from data originally published by Simula under a CC BY 4.0 license. If you use this dataset, please acknowledge [Chehab Lab](https://chehablab.com) and cite the original HyperKvasir dataset: ```bibtex @misc{Borgli2020HyperKvasirData, author = {Borgli, Hanna and Thambawita, Vajira and Smedsrud, Pia H. and Hicks, Steven and Jha, Debesh and Eskeland, Sigrun L. and Randel, Kristin Ranheim and Pogorelov, Konstantin and Lux, Mathias and Nguyen, Duc Tien Dang and Johansen, Dag and Griwodz, Carsten and Stensland, H{\aa}kon K. and Garcia-Ceja, Enrique and Schmidt, Peter T. and Hammer, Hugo L. and Riegler, Michael A. and Halvorsen, P{\aa}l and de Lange, Thomas}, title = {HyperKvasir [dataset]}, year = {2020}, publisher = {OSF}, doi = {10.17605/OSF.IO/MH9SJ} } ``` Additionally, cite the research paper that introduced this dataset: ```bibtex @article{Borgli2020HyperKvasir, author = {Borgli, Hanna and Thambawita, Vajira and Smedsrud, Pia H. and Hicks, Steven and Jha, Debesh and Eskeland, Sigrun L. and Randel, Kristin Ranheim and Pogorelov, Konstantin and Lux, Mathias and Nguyen, Duc Tien Dang and Johansen, Dag and Griwodz, Carsten and Stensland, H{\aa}kon K. and Garcia-Ceja, Enrique and Schmidt, Peter T. and Hammer, Hugo L. and Riegler, Michael A. and Halvorsen, P{\aa}l and de Lange, Thomas}, title = {HyperKvasir, a comprehensive multi-class image and video dataset for gastrointestinal endoscopy}, journal = {Scientific Data}, volume = {7}, pages = {283}, year = {2020}, doi = {10.1038/s41597-020-00622-y} } ``` ## βœ‰οΈ Original Authors Hanna Borgli, Vajira Thambawita, Pia H. Smedsrud, Steven Hicks, Debesh Jha, Sigrun L. Eskeland, Kristin Ranheim Randel, Konstantin Pogorelov, Mathias Lux, Duc Tien Dang Nguyen, Dag Johansen, Carsten Griwodz, HΓ₯kon K. Stensland, Enrique Garcia-Ceja, Peter T. Schmidt, Hugo L. Hammer, Michael A. Riegler, PΓ₯l Halvorsen, Thomas de Lange Simula Research Laboratory, Norway, with collaborating hospitals and universities Simula: https://datasets.simula.no/hyper-kvasir/ (original files) OSF mirror: https://osf.io/mh9sj/ ## πŸ“œ License This dataset is released under the Creative Commons Attribution 4.0 International (CC BY 4.0) license, consistent with the original HyperKvasir dataset. You may copy, modify, distribute, and use the data for any purpose (commercial or non-commercial), provided that appropriate credit is given to Borgli et al., Simula, and the original paper. [![CC BY 4.0](https://licensebuttons.net/l/by/4.0/88x31.png)](https://creativecommons.org/licenses/by/4.0/) **Chehab Lab @ 2026**