用Python解释对象识别代码

时间:2019-05-29 08:49:17

标签: python amazon-web-services

在aws机器学习中,json信息中的所有klass均为0.0。是s3的问题吗?

file_name = 'smoking.png'

with open(file_name, 'rb') as image:
f = image.read()
b = bytearray(f)
ne = open('n.txt','wb')
ne.write(b)

import json

object_detector.content_type = 'image/png'
results = object_detector.predict(b)
detections = json.loads(results)

print (detections)

结果:

'prediction': [
  [0.0, 0.72569340467453, 0.020846843719482422, 0.01528283953666687, 0.9779664874076843, 0.9825990200042725],
  [0.0, 0.15707983076572418, 0.0, 0.0, 0.2937577962875366, 0.30487072467803955], 
  [0.0, 0.15707983076572418, 0.08310790359973907, 0.0, 0.5437577962875366, 0.30487072467803955], 
  [0.0, 0.15707983076572418, 0.33310794830322266, 0.0, 0.7937577962875366, 0.30487072467803955],
  [0.0, 0.15707983076572418, 0.5831079483032227, 0.0, 1.0, 0.30487072467803955]...]

0 个答案:

没有答案