Hi, I want to edit classify.py in the python SDK. I deployed a model that classifies waste into either paper, glass, and compost on a Raspberry pi. Where is the result of the classification stored? What variable?
I want to use the variable in an if statement.
The results of the classification are stored in res['results']['classification']
If you want to grab the classification results with the highest probability you can do something like:
predicted_label = ''
acceptable_threshold = 0.8
if "classification" in res["result"].keys():
print('Result (%d ms.) ' % (res['timing']['dsp'] + res['timing']['classification']), end='')
for label in labels:
score = res['result']['classification'][label]
if res['result']['classification'][value] > acceptable_threshold:
predicted_value = res['result']['classification'][label]
print('%s: %.2f\t' % (label, score), end='')
print('', flush=True)