How to determine the category in a prediction?

I created a multicategory image classification model with many potential categories. I want to determine the confidence level of each category, but I can’t determine which prediction is which category. Does anyone know of a way to find this out?

`predictions = learn.predict(img)[2].tolist()
print(predictions)

[0.009425695985555649, 0.019373709335923195, 0.007478807587176561, 0.009022935293614864, 0.010886773467063904, 0.012588907964527607, 0.003459835657849908, 0.02438160963356495, 0.7511094808578491, 0.015189969912171364, 0.006333421915769577, 0.0440019890666008, 0.01520688459277153, 0.006530275102704763, 0.0016137179918587208, 0.0038368096575140953, 0.019443774595856667, 0.08209169656038284, 0.005832612048834562, 0.009274657815694809, 0.0038413978181779385, 0.006180445197969675, 0.0022636877838522196, 0.0019171158783137798]`

If you have a DataLoader (dls) made from a DataBlock you can try dls.vocab.

1 Like