open-mmlab/mmdetection · error · RuntimeError
skimage is not installed, please install it
Error message
skimage is not installed, please install it by: pip install scikit-image
What it means
BatchSyncRandomResizeFlipColorJitter or similar data preprocessor (BatchAugment) requires scikit-image for its color-similarity augmentation (pairwise color term used by mask-aware photometric aug). If the optional import failed, __init__ raises RuntimeError with install instructions.
Source
Thrown at mmdet/models/data_preprocessors/data_preprocessor.py:699
"""
def __init__(self,
*arg,
mask_stride: int = 4,
pairwise_size: int = 3,
pairwise_dilation: int = 2,
pairwise_color_thresh: float = 0.3,
bottom_pixels_removed: int = 10,
**kwargs) -> None:
super().__init__(*arg, **kwargs)
self.mask_stride = mask_stride
self.pairwise_size = pairwise_size
self.pairwise_dilation = pairwise_dilation
self.pairwise_color_thresh = pairwise_color_thresh
self.bottom_pixels_removed = bottom_pixels_removed
if skimage is None:
raise RuntimeError('skimage is not installed,\
please install it by: pip install scikit-image')
def get_images_color_similarity(self, inputs: Tensor,
image_masks: Tensor) -> Tensor:
"""Compute the image color similarity in LAB color space."""
assert inputs.dim() == 4
assert inputs.size(0) == 1
unfolded_images = unfold_wo_center(
inputs,
kernel_size=self.pairwise_size,
dilation=self.pairwise_dilation)
diff = inputs[:, :, None] - unfolded_images
similarity = torch.exp(-torch.norm(diff, dim=1) * 0.5)
unfolded_weights = unfold_wo_center(
image_masks[None, None],
kernel_size=self.pairwise_size,View on GitHub (pinned to cfd5d3a985)
Solutions
- pip install scikit-image
- Or remove/disable the color-jitter preprocessor from the config
- Reinstall mmdet with extras: mim install 'mmdet[extra]' style dependency set
Example fix
// shell pip install scikit-image
Defensive patterns
Strategy: validation
Validate before calling
try:\n import skimage # noqa\nexcept ImportError:\n raise SystemExit('pip install scikit-image before using color-jitter preprocessor') Prevention
- Install optional extras when using augmentation preprocessors
- Pin scikit-image in training environment requirements
When it happens
Trigger: Constructing the data preprocessor with pairwise_color_thresh / photometric distortion options without scikit-image installed (pip install did not include the extra).
Common situations: Running RTMDet/SOLO training configs that use BatchSyncRandomResizeFlipColorJitter in a minimal env; fresh install without extras.
Related errors
- Please run "pip install openmim" and run "mim install mmpret
- panopticapi is not installed, please install it by: pip inst
- The annotation file of Open Images Challenge should be a txt
- Invalid text mode "{self.text_mode}".
- No sample in split "{self.split}".
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/19691e6d040b9243.
Report an issue: GitHub.