我有收据的图像,我想分别在图像中存储文本.是否可以使用Amazon Rekognition从图像中检测文本?
我想尝试使用Rekognition的CompareFaces,但是我没有看到使用HTTP API的语法的完整示例.假设我有两个图像,我如何从Python调用此API来检索相似性得分?
我正在尝试比较从 Node.Js 应用程序调用 AWS Rekognition 的面孔。在比较 S3 存储桶上的两个图像时,一切顺利,但是当我尝试从客户端(React Native/Expo 应用程序)上传本地图像以与存储在该存储桶上的另一个图像进行比较时,出现错误InvalidImageFormatException: Request has invalid image format
。
该图像是 jpeg 250px 正方形,并作为有效的 base64 字符串发送(atob 测试)。显然,它满足此处提出的要求:https ://docs.aws.amazon.com/rekognition/latest/dg/limits.html 。
\n下面是一些代码片段:
\n捕获图像:
\nconst takeImgHandler = async () => {\n const img = await ImagePicker.launchCameraAsync(getImgProps);\n editImg(img);\n};\n
Run Code Online (Sandbox Code Playgroud)\n编辑图像:
\nconst editImg = async img => {\n ...\n const actions = [\n { resize: { 250, 250 } },\n ];\n\n const saveOptions = { \n base64: true,\n };\n\n const edited = …
Run Code Online (Sandbox Code Playgroud) 我正在尝试按照 AWS 文档中的说明,通过 Python boto3 使用 AWS Rekognition 来比较人脸。
我的 API 调用是:
client = boto3.client('rekognition', aws_access_key_id=key, aws_secret_access_key=secret, region_name=region )
source_bytes = open('source.jpg', 'rb')
target_bytes = open('target.jpg', 'rb')
response = client.compare_faces(
SourceImage = {
'Bytes':bytearray(source_bytes.read())
},
TargetImage = {
'Bytes':bytearray(target_bytes.read())
},
SimilarityThreshold = SIMILARITY_THRESHOLD
)
source_image.close()
target_image.close()
Run Code Online (Sandbox Code Playgroud)
但每次运行这个程序时,我都会收到以下错误:
botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the CompareFaces operation: Request has Invalid Parameters
Run Code Online (Sandbox Code Playgroud)
我已经正确指定了秘密、密钥、区域和阈值。如何清除此错误并使请求调用正常工作?
我正在使用 lambda 函数SearchFacesbyimage
我正在使用这个文档 https://aws.amazon.com/blogs/machine-learning/build-your-own-face-recognition-service-using-amazon-rekognition/
我在哪里使用这个进行比较
from PIL import Image
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
Unable to import module 'lambda_function': No module named PIL
amazon-s3 amazon-web-services python-imaging-library aws-lambda amazon-rekognition
我正在创建一个 DeepLens 项目来识别人,当相机扫描选定的一组人时。
该项目使用 lambda,它处理图像并触发“重新识别”aws api。
当我从本地机器触发 API 时 - 我得到了很好的响应
当我从 AWS 控制台触发 API 时 - 我收到失败的响应
问题
经过大量挖掘,我发现“boto3”(AWS python 库)的版本是:
1.9.62 - 在我的本地机器上
1.8.9 - 在 AWS 控制台上
题
我可以在 AWS lambda 控制台上升级“boto3”库版本吗??如果是这样,如何?
运行一些nodejs aws rekognition来检测mp4视频中的标签,但完成后不会发布到指定的SNS主题。使用主题/角色 arns 提交请求时,我没有收到任何权限错误。
const AWS = require('aws-sdk');
AWS.config.update(
{
region: 'us-west-2',
accessKeyId: "asdfadsf",
secretAccessKey: "asdfasdfasdfasd1234123423"
}
);
const params = {
Video: {
S3Object: {
Bucket: 'myvidebucket',
Name: '5d683b81760ec59c2015.mp4'
}
},
NotificationChannel: {
RoleArn: 'arn:aws:iam::xxxxxxxxxxxxx:role/AmazonRekognitionSNSSuccessFeedback',
SNSTopicArn: 'arn:aws:sns:us-west-2:xxxxxxxxxxxxx:recoknize',
},
MinConfidence: 60
};
rekognition.startLabelDetection(params).promise().then(data => {
console.log(JSON.stringify(data));
}).catch(error => {
console.log(error);
});
Run Code Online (Sandbox Code Playgroud)
该代码执行时没有错误,并且我得到了作业 ID。我的 SNS 主题订阅已确认,并且应该发布到我的 HTTPS 端点。但什么也没有到达,并且 AWS 控制台中的任何位置都没有与此相关的错误日志。
当我通过 jobid 手动访问重新识别时,数据正常返回,因此我知道它正确完成。IAM 权限肯定发生了一些奇怪的事情。
我已经尝试了很多方法,但是我无法成功。我尚未找到Android的任何源代码示例(关于rekognition)
在《开发人员指南》中的JAVA中有一个源代码,但是即使尝试了TT,我也无法实现该源代码
我尝试通过从外部存储(从仿真器)发送图像文件来检测人脸,但我不知道我做错了(我不擅长编码)这是我的代码
AmazonRekognitionClient amazonRekognitionClient;
Image getAmazonRekognitionImage;
DetectFacesRequest detectFaceRequest;
DetectFacesResult detectFaceResult;
File file = new File(Environment.getExternalStorageDirectory(),"sungyeol.jpg.jpg");
public void test_00(View view) {
ByteBuffer imageBytes;
try{
InputStream inputStream = new FileInputStream(file.getAbsolutePath().toString());
imageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
Log.e("InputStream: ",""+inputStream);
Log.e("imageBytes: ","");
getAmazonRekognitionImage.withBytes(imageBytes);
// Initialize the Amazon Cognito credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(),
"us-east-2:.......", // Identity Pool ID
Regions.US_EAST_2 // Region
);
//I want "ALL" attributes
amazonRekognitionClient = new AmazonRekognitionClient(credentialsProvider);
detectFaceRequest = new DetectFacesRequest()
.withAttributes(Attribute.ALL.toString())
.withImage(getAmazonRekognitionImage);
detectFaceResult = amazonRekognitionClient.detectFaces(detectFaceRequest);
detectFaceResult.getFaceDetails();
}
catch(Exception ex){ …
Run Code Online (Sandbox Code Playgroud) 在AWS Rekognition的Javascript API规定,对于 rekognition.compareFaces(params,...)
法,SourceImage
并TargetImage
可以采取Bytes
或S3Object
.我想用Bytes
哪个可以
"字节 - (缓冲区,类型数组,Blob,字符串)"
图像字节的Blob最多5 MB.
当我传递Base64
图像的编码字符串时,JS SDK再次重新编码(即双重编码).因此服务器响应错误说
{"__ type":"InvalidImageFormatException","消息":"无效的图像编码"}
有没有人设法使用base64编码图像(而不是)使用compareFaces JS SDK APIS3Object
?或使用Bytes
param的任何JavaScript示例都会有所帮助.
javascript sdk base64 amazon-web-services amazon-rekognition
我正在构建一个基于 OCR 的解决方案来从某些财务文件中提取信息。根据我国(印度)的规定,这些数据不能离开印度。
是否可以找到 Google Cloud Vision 服务器所在的区域?或者,是否可以从 GCP 控制台限制服务区域?
这是我尝试过的:
我浏览了 GCP 数据使用常见问题解答:https : //cloud.google.com/vision/docs/data-usage
GCP 服务条款:https : //cloud.google.com/terms/ (查看此页面上的第 1.4 点数据位置)
与 GCP 销售代表交谈。他不知道答案。
我知道我可以与 Google 支持人员交谈,但这需要 100 美元才能激活,这对我来说很多。
任何帮助,将不胜感激。我也浏览了 Rekognition 的文档,但它似乎将一些数据发送到外部进行训练,因此目前不考虑它。
PS - 编辑以使我尝试过的事情更清楚。
google-cloud-platform google-cloud-vision amazon-rekognition
aws-lambda ×2
boto3 ×2
node.js ×2
python ×2
amazon-s3 ×1
amazon-sns ×1
base64 ×1
java ×1
javascript ×1
react-native ×1
sdk ×1