.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "vision/auto_checks/model_evaluation/plot_confusion_matrix.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_vision_auto_checks_model_evaluation_plot_confusion_matrix.py: .. _vision__confusion_matrix: 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 Dataset <#generate-dataset>`__ * `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 24-34 Generate Dataset ---------------- We generate a sample dataset of 128 images from the `COCO dataset `__, and using the `YOLOv5 model `__. .. note:: In this example, we use the pytorch version of the coco dataset and model. In order to run this example using tensorflow, please change the import statements to:: from deepchecks.vision.datasets.detection import coco_tensorflow as coco .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. code-block:: default from deepchecks.vision.datasets.detection import coco_torch as coco train_ds = coco.load_dataset(object_type='VisionData') .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5s.pt to yolov5s.pt... 0%| | 0.00/14.1M [00:00 Confusion Matrix

.. GENERATED FROM PYTHON SOURCE LINES 50-51 To display the results in an IDE like PyCharm, you can use the following code: .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: default # result.show_in_window() .. GENERATED FROM PYTHON SOURCE LINES 54-55 The result will be displayed in a new window. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.561 seconds) .. _sphx_glr_download_vision_auto_checks_model_evaluation_plot_confusion_matrix.py: .. only:: html .. container:: sphx-glr-footer 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 `_