Skip to content

Commit 8338ed2

Browse files
committed
Report mean and max
1 parent 2951f12 commit 8338ed2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/image/classify-image.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def main(argv):
7878
for grid_cell in res["result"]["visual_anomaly_grid"]:
7979
print('\t%s (%.2f): x=%d y=%d w=%d h=%d' % (grid_cell['label'], grid_cell['value'], grid_cell['x'], grid_cell['y'], grid_cell['width'], grid_cell['height']))
8080
cropped = cv2.rectangle(cropped, (grid_cell['x'], grid_cell['y']), (grid_cell['x'] + grid_cell['width'], grid_cell['y'] + grid_cell['height']), (255, 125, 0), 1)
81+
values = [grid_cell['value'] for grid_cell in res["result"]["visual_anomaly_grid"]]
82+
mean_value = sum(values) / len(values)
83+
max_value = max(values)
84+
print('Max value: %.2f' % max_value)
85+
print('Mean value: %.2f' % mean_value)
8186

8287
# the image will be resized and cropped, save a copy of the picture here
8388
# so you can see what's being passed into the classifier

0 commit comments

Comments
 (0)