1
#pred_probas is probabilities of each class type
def find_class_idx(label):
    """
    Should return the class index of a particular label.

    :param label: label of class
    :type label: str

    :return: class index
    :rtype: int
    """
    #ind = mx.nd.argmax(label, axis=1).astype('int')
    topk_indices=mx.nd.topk(pred_probas,k=100)
    return max(topk_indices)*100
Pedram Parsian
  • 3,750
  • 3
  • 19
  • 34

1 Answers1

0

As the network output classes of GluonCV are of list type. We can access index of list using this function list.index(label)

def find_class_idx(label):
"""
Should return the class index of a particular label.

:param label: label of class
:type label: str

:return: class index
:rtype: int
"""

return network.classes.index(label)