.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/vision/performance/plot_confusion_matrix.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_checks_gallery_vision_performance_plot_confusion_matrix.py: Confusion Matrix **************** This notebooks provides an overview for using and understanding the confusion matrix check. **Structure:** * `What is the purpose of the check? <#what-is-the-purpose-of-the-check>`__ * `Generate data & model <#generate-data-and-model>`__ * `Run the check <#run-the-check>`__ What is the purpose of the check? ================================= The confusion matrix check outputs a confusion matrix for both classification problems and object detection problems. In object detection problems, some predictions do not overlap on any label and can be classified as not found in the confusion matrix. .. GENERATED FROM PYTHON SOURCE LINES 22-26 Generate Data and Model ------------------------ We generate a sample dataset of 128 images from the `COCO dataset `__, and using the `YOLOv5 model `__. .. GENERATED FROM PYTHON SOURCE LINES 26-32 .. code-block:: default from deepchecks.vision.datasets.detection import coco yolo = coco.load_model(pretrained=True) train_ds = coco.load_dataset(object_type='VisionData') .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt to yolov5s.pt... 0%| | 0.00/14.1M [00:00

Confusion Matrix

Calculate the confusion matrix of the model on the given dataset.

Additional Outputs
Showing 10 of 80 classes:
"No overlapping" categories are labels and prediction which did not have a matching label/prediction.
For example a predictions that did not have a sufficiently overlapping label bounding box will appear under "No overlapping" category in the True Value axis (y-axis).


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 17.120 seconds) .. _sphx_glr_download_checks_gallery_vision_performance_plot_confusion_matrix.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_confusion_matrix.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_confusion_matrix.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_