This page was generated from examples/cd_online_camelyon.ipynb.
Online drift detection for Camelyon17 medical imaging dataset
This notebook demonstrates a typical workflow for applying online drift detectors to streams of image data. For those unfamiliar with how the online drift detectors operate in
alibi_detect we recommend first checking out the more introductory example Online Drift Detection on the Wine Quality Dataset where online drift detection is performed for the wine quality dataset.
This notebook requires the
torchvision packages which can be installed via
!pip install wilds torch torchvision
from typing import Tuple, Generator, Callable, Optional import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn from torch.utils.data import TensorDataset, DataLoader import torchvision.transforms as transforms from wilds.common.data_loaders import get_train_loader from wilds import get_dataset torch.manual_seed(0) np.random.seed(0) device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') %matplotlib inline
We will use the Camelyon17 dataset, one of the WILDS datasets of Koh et al, (2020) that represent “in-the-wild” distribution shifts for various data modalities. It contains tissue scans to be classificatied as benign or cancerous. The pre-change distribution corresponds to scans from across three hospitals and the post-change distribution corresponds to scans from a new fourth hospital.