Visualize metrics
We are happy to announce that the first major release of Torchmetrics, version v1.0, is publicly available. We have
worked hard on a couple of new features for this milestone release, but for v1.0.0, we have also managed to implement
over 100 metrics in torchmetrics.
Plotting
The big new feature of v1.0 is a built-in plotting feature. As the old saying goes: "A picture is worth a thousand words". Within machine learning, this is definitely also true for many things.
Metrics are one area that, in some cases, is definitely better showcased in a figure than as a list of floats. The only requirement for getting started with the plotting feature is installing matplotlib. Either install with pip install matplotlib or pip install torchmetrics[visual] (the latter option also installs Scienceplots and uses that as the default plotting style).
The basic interface is the same for any metric. Just call the new .plot method:
metric = AnyMetricYouLike()
for _ in range(num_updates):
metric.update(preds[i], target[i])
fig, ax = metric.plot()The plot method by default does not require any arguments and will automatically call metric.compute internally on
whatever metric states have been accumulated.
[1.0.0] - 2022-07-04
Added
- Added
prefixandpostfixarguments toClasswiseWrapper(#1866) - Added speech-to-reverberation modulation energy ratio (SRMR) metric (#1792, #1872)
- Added new global arg
compute_with_cacheto control caching behaviour aftercomputemethod (#1754) - Added
ComplexScaleInvariantSignalNoiseRatiofor audio package (#1785) - Added
Runningwrapper for calculate running statistics (#1752) - Added
RelativeAverageSpectralErrorandRootMeanSquaredErrorUsingSlidingWindowto image package (#816) - Added support for
SpecificityAtSensitivityMetric (#1432) - Added support for plotting of metrics through
.plot()method (#1328, #1481, #1480, #1490, #1581, #1585, #1593, #1600, #1605, #1610, #1609, #1621, #1624, #1623, #1638, #1631, #1650, #1639, #1660, #1682, #1786) - Added support for plotting of audio metrics through
.plot()method (#1434) - Added
classesto output fromMAPmetric (#1419) - Added Binary group fairness metrics to classification package (#1404)
- Added
MinkowskiDistanceto regression package (#1362) - Added
pairwise_minkowski_distanceto pairwise package (#1362) - Added new detection metric
PanopticQuality(#929, #1527) - Added
PSNRBmetric (#1421) - Added
ClassificationTaskEnum and use in metrics (#1479) - Added
ignore_indexoption toexact_matchmetric (#1540) - Add parameter
top_ktoRetrievalMAP(#1501) - Added support for deterministic evaluation on GPU for metrics that uses
torch.cumsumoperator (#1499) - Added support for plotting of aggregation metrics through
.plot()method (#1485) - Added support for python 3.11 (#1612)
- Added support for auto clamping of input for metrics that uses the
data_range(#1606) - Added
ModifiedPanopticQualitymetric to detection package (#1627) - Added
PrecisionAtFixedRecallmetric to classification package (#1683) - Added multiple metrics to detection package (#1284)
IntersectionOverUnionGeneralizedIntersectionOverUnionCompleteIntersectionOverUnionDistanceIntersectionOverUnion
- Added
MultitaskWrapperto wrapper package (#1762) - Added
RelativeSquaredErrormetric to regression package (#1765) - Added
MemorizationInformedFrechetInceptionDistancemetric to image package (#1580)
Changed
- Changed
permutation_invariant_trainingto allow using a'permutation-wise'metric function (#1794) - Changed
update_countandupdate_calledfrom private to public methods (#1370) - Raise exception for invalid kwargs in Metric base class (#1427)
- Extend
EnumStrraisingValueErrorfor invalid value (#1479) - Improve speed and memory consumption of binned
PrecisionRecallCurvewith large number of samples (#1493) - Changed
__iter__method from raisingNotImplementedErrortoTypeErrorby setting toNone(#1538) FIDmetric will now raise an error if too few samples are provided (#1655)- Allowed FID with
torch.float64(#1628) - Changed
LPIPSimplementation to no more rely on third-party package (#1575) - Changed FID matrix square root calculation from
scipytotorch(#1708) - Changed calculation in
PearsonCorrCoeffto be more robust in certain cases (#1729) - Changed
MeanAveragePrecisiontopycocotoolsbackend (#1832)
Deprecated
Removed
- Support for python 3.7 (#1640)
Fixed
- Fixed support in
MetricTrackerforMultioutputWrapperand nested structures (#1608) - Fixed restrictive check in
PearsonCorrCoef(#1649) - Fixed integration with
jsonargparseandLightningCLI(#1651) - Fixed corner case in calibration error for zero confidence input (#1648)
- Fix precision-recall curve based computations for float target (#1642)
- Fixed missing kwarg squeeze in
MultiOutputWrapper(#1675) - Fixed padding removal for 3d input in
MSSSIM(#1674) - Fixed
max_det_thresholdin MAP detection (#1712) - Fixed states being saved in metrics that use
register_buffer(#1728) - Fixed states not being correctly synced and device transfered in
MeanAveragePrecisionforiou_type="segm"(#1763) - Fixed use of
prefixandpostfixin nestedMetricCollection(#1773) - Fixed
axplotting logging in `MetricCollection (#1783) - Fixed lookup for punkt sources being downloaded in
RougeScore(#1789) - Fixed integration with lightning for
CompositionalMetric(#1761) - Fixed several bugs in
SpectralDistortionIndexmetric (#1808) - Fixed bug for corner cases in
MatthewsCorrCoef(#1812, #1863) - Fixed support for half precision in
PearsonCorrCoef(#1819) - Fixed number of bugs related to
average="macro"in classification metrics (#1821) - Fixed off-by-one issue when
ignore_index = num_classes + 1in Multiclass-jaccard (#1860)
New Contributors
- @theja-vanka made their first contribution in #1372
- @wilderrodrigues made their first contribution in #1391
- @Freed-Wu made their first contribution in #1402
- @reaganjlee made their first contribution in #1405
- @davidgilbertson made their first contribution in #1412
- @ValerianRey made their first contribution in #1430
- @EPronovost made their first contribution in #1427
- @felixdivo made their first contribution in #1438
- @ivnvalex made their first contribution in #1447
- @PangLuo made their first contribution in #1452
- @JustinGoheen made their first contribution in #1463
- @DavidZhang73 made their first contribution in #1476
- @7shoe made their first contribution in #1474
- @srishti-git1110 made their first contribution in #1481
- @niberger made their first contribution in #929
- @shhs29 made their first contribution in #1434
- @ihowell made their first contribution in #1525
- @venomouscyanide made their first contribution in #1480
- @ItamarChinn made their first contribution in #1540
- @vincentvaroquauxads made their first contribution in #1521
- @Bomme made their first contribution in #1501
- @alexkrz made their first contribution in #1490
- @clay-curry made their first contribution in #1547
- @clueless-skywatcher made their first contribution in #1362
- @marcocaccin made their first contribution in #1527
- @Piyush-97 made their first contribution in #816
- @FarzanT made their first contribution in #1583
- @basveeling made their first contribution in #1651
- @YeaMerci made their first contribution in #1684
- @fkroeber made their first contribution in #1712
- @soma2000-lang made their first contribution in #1421
- @maxi-w made their first contribution in #1726
- @wbeardall made their first contribution in #1765
- @RistoAle97 made their first contribution in #1778
- @cdboer made their first contribution in #1820
- @bot66 made their first contribution in #1828
- @cs-mshah made their first contribution in #1849
- @bojobo made their first contribution in #1851
- @goldenfire6 made their first contribution in #1862
- @martinmeinke made their first contribution in #1860
- @Dibz15 made their first contribution in #1580
- @relativityhd made their first contribution in #1866
Contributors
@alexkrz, @AndresAlgaba, @basveeling, @Bomme, @Borda, @Callidior, @clueless-skywatcher, @Dibz15, @EPronovost, @fkroeber, @ItamarChinn, @marcocaccin, @martinmeinke, @niberger, @Piyush-97, @quancs, @relativityhd, @shenoynikhil, @shhs29, @SkafteNicki, @soma2000-lang, @srishti-git1110, @stancld, @twsl, @ValerianRey, @venomouscyanide, @wbeardall
If we forgot someone due to not matching commit email with GitHub account, let us know :]