Deep learning 如何使用AWS Rekognion开发python人脸和情绪识别

Deep learning 如何使用AWS Rekognion开发python人脸和情绪识别,deep-learning,computer-vision,face-detection,amazon-rekognition,Deep Learning,Computer Vision,Face Detection,Amazon Rekognition,我正在尝试使用Amazon Rekognion构建人脸情感检测模型,但我知道唯一的图像,如何使用Amazon recognition开发实时情感检测模型 我在这里试过: photo='Faces.png' client = boto3.client('rekognition', aws_access_key_id=access_key_id, aws_secret_access_key=secert_key_id)

我正在尝试使用Amazon Rekognion构建人脸情感检测模型,但我知道唯一的图像,如何使用Amazon recognition开发实时情感检测模型

我在这里试过:

  photo='Faces.png'
    client = boto3.client('rekognition',
                aws_access_key_id=access_key_id,
                aws_secret_access_key=secert_key_id)
    
    response=client.detect_faces(Image={'S3Object' : {
        'Bucket': 'suribucket28',
        'Name': photo
    }},
                Attributes=['ALL'])
    
        
    for key,value in response.items():
        if key=='FaceDetails':
            for people_att in value:
                print(people_att)
                print("=========")
 from PIL import Image
image = Image.open(photo)
image_width, image_height = image.size
i = 1
for item in response.get('FaceDetails'):
    bounding_box = item['BoundingBox']
    print('Bounding box {}'.format(bounding_box))
    width = image_width * bounding_box['Width']
    height = image_height * bounding_box['Height']
    left = image_width * bounding_box['Left']
    top = image_height * bounding_box['Top']

    left = int(left)
    top = int(top)
    width = int(width) + left
    height = int(height) + top

    box = (left, top, width, height)
    box_string = (str(left), str(top), str(width), str(height))
    print(box)
    cropped_image = image.crop(box)
    thumbnail_name = '{}.png'.format(i)
    i += 1
    cropped_image.save(thumbnail_name, 'PNG')
i = 1
for item in response.get('FaceDetails'):
    bounding_box = item['BoundingBox']
    print('Bounding box {}'.format(bounding_box))
    width = image_width * bounding_box['Width']
    height = image_height * bounding_box['Height']
    left = image_width * bounding_box['Left']
    top = image_height * bounding_box['Top']

    left = int(left)
    top = int(top)
    width = int(width) + left
    height = int(height) + top

    box = (left, top, width, height)
    box_string = (str(left), str(top), str(width), str(height))
    print(box)
    cropped_image = image.crop(box)
    thumbnail_name = '{}.png'.format(i)
    i += 1
    cropped_image.save(thumbnail_name, 'PNG')

    face_emotion_confidence = 0
    face_emotion = None
    for emotion in item.get('Emotions'):
        if emotion.get('Confidence') >= face_emotion_confidence:
            face_emotion_confidence = emotion['Confidence']
            face_emotion = emotion.get('Type')
    print('{} - {}'.format(thumbnail_name, face_emotion))
这里是我的输出:

Bounding box {'Width': 0.13178056478500366, 'Height': 0.2530011236667633, 'Left': 0.7722635865211487, 'Top': 0.37612420320510864}
(791, 289, 926, 483)
1.png - SURPRISED
Bounding box {'Width': 0.134864941239357, 'Height': 0.2344525009393692, 'Left': 0.4367245137691498, 'Top': 0.3717467486858368}
(447, 285, 585, 465)
2.png - SAD
Bounding box {'Width': 0.13294337689876556, 'Height': 0.23467060923576355, 'Left': 0.1052195206284523, 'Top': 0.3740139603614807}
(107, 287, 243, 467)
3.png - CONFUSED
Bounding box {'Width': 0.13649782538414001, 'Height': 0.20612865686416626, 'Left': 0.7694841027259827, 'Top': 0.8176292777061462}
(788, 628, 927, 786)
4.png - CONFUSED
Bounding box {'Width': 0.1355026364326477, 'Height': 0.2037850320339203, 'Left': 0.4373941123485565, 'Top': 0.8160727620124817}
(448, 627, 586, 783)
5.png - ANGRY
Bounding box {'Width': 0.13273616135120392, 'Height': 0.20781883597373962, 'Left': 0.10480319708585739, 'Top': 0.8161987066268921}
(107, 627, 243, 786)
6.png - SURPRISED
Bounding box {'Width': 0.12567317485809326, 'Height': 0.1828324794769287, 'Left': 0.7689046859741211, 'Top': -0.0052058761939406395}
(788, -4, 916, 136)
7.png - ANGRY
Bounding box {'Width': 0.12488202005624771, 'Height': 0.15474408864974976, 'Left': 0.10545777529478073, 'Top': -0.00658864201977849}
(108, -5, 236, 113)
8.png - ANGRY
Bounding box {'Width': 0.12722793221473694, 'Height': 0.1467084288597107, 'Left': 0.4370303452014923, 'Top': -0.008225122466683388}
(447, -6, 577, 106)
9.png - HAPPY
这是我的图片:

请帮助我如何使用aws reckognition开发实时情绪检测