#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
Asked
Active
Viewed 252 times
1

Pedram Parsian
- 3,750
- 3
- 19
- 34

transformer10
- 11
- 3
1 Answers
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)

Tallal habib
- 1
- 1