# Confusion Matrix MMPretrain provides `tools/analysis_tools/confusion_matrix.py` tool to calculate and visualize the confusion matrix. For an introduction to the confusion matrix, see [link](https://en.wikipedia.org/wiki/Confusion_matrix). ## Command-line Usage **Command**: ```shell python tools/analysis_tools/confusion_matrix.py \ ${CONFIG_FILE} \ ${CHECKPOINT} \ [--show] \ [--show-path] \ [--include-values] \ [--cmap ${CMAP}] \ [--cfg-options ${CFG-OPTIONS}] ``` **Description of all arguments**: - `config`: The path of the model config file. - `checkpoint`: The path of the checkpoint. - `--show`: If or not to show the matplotlib visualization result of the confusion matrix, the default is `False`. - `--show-path`: If `show` is True, the path where the results are saved is visualized. - `--include-values`: Whether to add values to the visualization results. - `--cmap`: The color map used for visualization results, `cmap`, which defaults to `viridis`. * `--cfg-options`: Modifications to the configuration file, refer to [Learn about Configs](../user_guides/config.md). **Examples of use**: ```shell python tools/analysis_tools/confusion_matrix.py \ configs/resnet/resnet50_8xb16_cifar10.py \ https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_b16x8_cifar10_20210528-f54bfad9.pth \ --show ``` **output image**: