open-mmlab/mmdetection · error · RuntimeError
sscikit-learn is not installed, please insta
Error message
sscikit-learn is not installed, please install it by: pip install scikit-learn
What it means
The TrackletInterpolator (used for video instance/seg tracking interpolation between sparse keyframes) requires Gaussian-smoothed interpolation backed by scikit-learn. At import time mmdet tries to import sklearn; if it is missing, HAS_SKIKIT_LEARN is False and __init__ raises RuntimeError.
Source
Thrown at mmdet/models/task_modules/tracking/interpolation.py:34
"""Interpolate tracks to make tracks more complete.
Args:
min_num_frames (int, optional): The minimum length of a track that will
be interpolated. Defaults to 5.
max_num_frames (int, optional): The maximum disconnected length in
a track. Defaults to 20.
use_gsi (bool, optional): Whether to use the GSI (Gaussian-smoothed
interpolation) method. Defaults to False.
smooth_tau (int, optional): smoothing parameter in GSI. Defaults to 10.
"""
def __init__(self,
min_num_frames: int = 5,
max_num_frames: int = 20,
use_gsi: bool = False,
smooth_tau: int = 10):
if not HAS_SKIKIT_LEARN:
raise RuntimeError('sscikit-learn is not installed,\
please install it by: pip install scikit-learn')
self.min_num_frames = min_num_frames
self.max_num_frames = max_num_frames
self.use_gsi = use_gsi
self.smooth_tau = smooth_tau
def _interpolate_track(self,
track: np.ndarray,
track_id: int,
max_num_frames: int = 20) -> np.ndarray:
"""Interpolate a track linearly to make the track more complete.
This function is proposed in
"ByteTrack: Multi-Object Tracking by Associating Every Detection Box."
`ByteTrack<https://arxiv.org/abs/2110.06864>`_.
Args:
track (ndarray): With shape (N, 7). Each row denotesView on GitHub (pinned to cfd5d3a985)
Solutions
- pip install scikit-learn
- Or verify with 'python -c "import sklearn"' that it's importable in the same env as mmdet
- If using conda: conda install -c conda-forge scikit-learn
Example fix
# before: RuntimeError: scikit-learn is not installed # after pip install scikit-learn
Defensive patterns
Strategy: validation
Validate before calling
try:
import sklearn # noqa
ok = True
except ImportError:
ok = False
assert ok, 'pip install scikit-learn before using tracking interpolation' Try / catch
try:
interp = TrackletInterpolator(...)
except RuntimeError as e:
if 'scikit-learn' in str(e):
raise SystemExit('Missing dependency: run pip install scikit-learn')
raise Prevention
- Install extras upfront: pip install mmdet[mot]
- Check optional imports before building tracking configs
When it happens
Trigger: Instantiating TrackletInterpolator with use_gsi=True workflows or simply constructing it in any environment where 'import sklearn' failed (extra deps not installed).
Common situations: Installing mmdet with minimal deps (pip install mmdet without [extra]) and then running video tracking / VIS configs (e.g. Mask2Former video) that build this module.
Related errors
- trackeval is not installed,please install it by: pip install
- sscikit-learn is not installed, please insta
- lap is not installed, please install it by:
- lap is not installed, please install it by:
- motmetrics is not installed, please install
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/cb6f2c571969778e.
Report an issue: GitHub.