Unfinished Codes
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
#####################################################
|
||||
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020.04 #
|
||||
#####################################################
|
||||
import abc
|
||||
|
||||
def obtain_accuracy(output, target, topk=(1,)):
|
||||
"""Computes the precision@k for the specified values of k"""
|
||||
maxk = max(topk)
|
||||
@@ -12,3 +17,12 @@ def obtain_accuracy(output, target, topk=(1,)):
|
||||
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
|
||||
res.append(correct_k.mul_(100.0 / batch_size))
|
||||
return res
|
||||
|
||||
|
||||
class EvaluationMetric(abc.ABC):
|
||||
|
||||
def __init__(self):
|
||||
self._total_metrics = 0
|
||||
|
||||
def __len__(self):
|
||||
return self._total_metrics
|
||||
|
Reference in New Issue
Block a user