Member-only story
PyTorch is a powerful open-source machine learning library written in Python. Unlike Keras’s tf.keras.metrics
, however, PyTorch does not have an out-of-the-box library for model evaluation metrics as illustrated in this github issue.
torch-metrics
is a library written for PyTorch model evaluation. To install torch-metrics
, simply run pip install --upgrade torch-metrics
and the latest version will be installed.
Available Metrics
At the time of writing, the following metrics are available:
- Accuracy
- R-squared
- Mean Absolute Error (MAE)
- Mean Squared Error (MSE)
- Root Mean Squared Error (RMSE)
- Precision
- Recall
- F1
- Mean IoU (Intersection over Union)
- Dice Similarity Coefficient (DSC)
- Hinge
- Structural Similarity (SSIM)
Usage
The goal is to eventually implement all the evaluation metrics available in the Keras metrics API. Below is an example of using torch-metrics
to evaluate two PyTorch tensors.
Contributions are welcome. Visit this github repo for source code and latest updates.