{"record":{"id":"93c69bb4fbea8883","repo":"open-mmlab/mmdetection","slug":"please-run-pip-install-seaborn","errorCode":null,"errorMessage":"please run pip install seaborn","messagePattern":"please run pip install seaborn","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mmdet/utils/mot_error_visualize.py","lineNumber":70,"sourceCode":"            Defaults to 2.\n        font_scale (float, optional): Font scale to draw id and score.\n            Defaults to 0.4.\n        text_width (int, optional): Width to draw id and score.\n            Defaults to 10.\n        text_height (int, optional): Height to draw id and score.\n            Defaults to 15.\n        show (bool, optional): Whether to show the image on the fly.\n            Defaults to False.\n        wait_time (int, optional): Value of waitKey param.\n            Defaults to 100.\n        out_file (str, optional): The filename to write the image.\n            Defaults to None.\n\n    Returns:\n        ndarray: Visualized image.\n    \"\"\"\n    if sns is None:\n        raise ImportError('please run pip install seaborn')\n    assert bboxes.ndim == 2, \\\n        f' bboxes ndim should be 2, but its ndim is {bboxes.ndim}.'\n    assert ids.ndim == 1, \\\n        f' ids ndim should be 1, but its ndim is {ids.ndim}.'\n    assert error_types.ndim == 1, \\\n        f' error_types ndim should be 1, but its ndim is {error_types.ndim}.'\n    assert bboxes.shape[0] == ids.shape[0], \\\n        'bboxes.shape[0] and ids.shape[0] should have the same length.'\n    assert bboxes.shape[1] == 5, \\\n        f' bboxes.shape[1] should be 5, but its {bboxes.shape[1]}.'\n\n    bbox_colors = sns.color_palette()\n    # red, yellow, blue\n    bbox_colors = [bbox_colors[3], bbox_colors[1], bbox_colors[0]]\n    bbox_colors = [[int(255 * _c) for _c in bbox_color][::-1]\n                   for bbox_color in bbox_colors]\n\n    if isinstance(img, str):","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/utils/mot_error_visualize.py#L52-L88","documentation":"Raised by _cv2_show_tracks/imshow_mot_errors when seaborn is not importable. The MOT error visualization code uses seaborn color palettes to colorize ID switches/FN/FP tracks, so the module refuses to run without it.","triggerScenarios":"Calling imshow_mot_errors (or _cv2_show_wrong_tracks) in mmdet/utils/mot_error_visualize.py in an environment where `import seaborn` failed (sns is None).","commonSituations":"Using mmdet MOT visualization tools in a minimal install that only has mmdet core dependencies; seaborn is an extra, not a hard requirement.","solutions":["pip install seaborn","Or skip MOT error visualization and inspect result dumps instead"],"exampleFix":"// before\nimshow_mot_errors(img, bboxes, ids, error_types)  # ImportError\n// after\n# pip install seaborn\nimshow_mot_errors(img, bboxes, ids, error_types)","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('seaborn') is None:\n    raise SystemExit('seaborn required for MOT error visualization: pip install seaborn')","typeGuard":null,"tryCatchPattern":"try:\n    imshow_mot_errors(...)\nexcept ImportError as e:\n    if 'seaborn' in str(e):\n        print('skip MOT error vis:', e)","preventionTips":["Install mmdet extras for visualization components you use","Gate visualization features on find_spec('seaborn') before calling"],"tags":["python","dependency","visualization","mot","seaborn"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}