2

我正在尝试调用 IndexFaces API 但出现错误:

*"exception":"com.amazonaws.services.rekognition.model.AmazonRekognitionException",
"message": "1 validation error detected: Value 'postman/postworld/postman_female.jpg' at 'externalImageId' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.\\-:]+ (Service: AmazonRekognition; Status Code: 400; Error Code: ValidationException; Request ID: 3ac46c4d-3358-11e8-abd5-d5fb3ad03e33)",
"path": "/enrolluser"*

我能够使用 S3 的所谓“文件夹结构”将我的文件成功上传到 S3 中。但是当我试图读取 IndexFaces 的相同文件时,它会提示与 éxternalImageId 相关的错误。

这是我上传文件的 S3 的快照:

http://xxxxxx.s3.amazonaws.com/postman/postworld/postman_automated.jpg

如果我摆脱文件夹结构并直接转储文件,例如:

http://xxxxxx.s3.amazonaws.com/postman_automated.jpg

然后 IndexFaces API 成功传递它。

当我确实有“文件夹结构”时,你能建议如何传递 externalImageId 吗?目前,我正在通过我的 java 代码传递 externalImageId,例如:

enrolledFileName = userName +"/"+myWorldName+"/"+enrolledFileName;
System.out.println("The FILE NAME MANIPULATED IS:"+enrolledFileName);
String generateAmazonFaceId = amazonRekognitionManagerObj.addToCollectionForEnrollment(collectionName, bucketName, enrolledFileName);
System.out.println("The Generated FaceId is:"+generateAmazonFaceId);**strong text**

上面的代码内部调用:

Image image=new Image().withS3Object(new S3Object().withBucket(bucketName)
                              .withName(fileName));

 IndexFacesRequest indexFacesRequest = new IndexFacesRequest()
                  .withImage(image)
                  .withCollectionId(collectionName)
                  .withExternalImageId(fileName)
                  .withDetectionAttributes("ALL");
4

0 回答 0