response = rekognition_client.start_label_detection( Video={ 'S3Object': { 'Bucket': bucket, 'Name': video } }, NotificationChannel={ 'SNSTopicArn': sns_topic_arn, 'RoleArn': iam_role_arn }, MinConfidence=min_confidence, JobTag=job_id, # Set this to 1 to get only the 'most likely' label per frame # Otherwise, leave it blank to get all labels. MaxLabels=1 )
将start_label_detection替换为start_person_tracking并指定要使用的标签数,例如:
response = rekognition_client.start_person_tracking( Video={ 'S3Object': { 'Bucket': bucket, 'Name': video } }, NotificationChannel={ 'SNSTopicArn': sns_topic_arn, 'RoleArn': iam_role_arn }, OutputConfig={ 'S3Bucket': output_s3_bucket, 'S3KeyPrefix': output_s3_prefix }, JobTag=job_id, # Set this to 1 to get only the 'most likely' label per frame # Otherwise, leave it blank to get all labels. LabelDetectionConfig={ 'MinConfidence': min_confidence, 'MaxLabels': 1 }, # Set this according to your requirements PersonTrackingConfig={ 'MinConfidence': 50.0, 'BoundingBox': 'ALL', 'Face': 'ALL' } )