Where do I run this AWS rekognition code and do I need to install anything else? What result will I get?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
`
import boto3
if __name__ == "__main__":
bucket='random_name'
photo='b4.png'
client=boto3.client('rekognition')
response=client.detect_text(Image={'S3Object':
{'random_name':bucket,'b4.png':photo}})
textDetections=response['TextDetections']
print(response)
print('Matching faces')
for text in textDetections:
print('Detected text:' + text['DetectedText'])
print('Confidence: ' + "{:.2f}".format(text['Confidence']) + "%")
print('Id: {}'.format(text['Id']))
if 'ParentId' in text:
print('Parent Id: {}'.format(text['ParentId']))
print('Type:' + text['Type'])
print()`
This is the code recognizing images(OCR) yet I do not know where I should paste this code to run. Do I run this in Jupyter notebooks and would I need to install extra things? Do I run it in the Anaconda Prompt? I've tried both. In Jupyter, I get an error: |ParamValidationError: Parameter validation failed: Unknown parameter in Image.S3Object: "random_name", must be one of: Bucket, Name, Version Unknown parameter in Image.S3Object: "b4.png", must be one of: Bucket, Name, Version| and Anaconda prompt has much more errors. I've installed AWS already and curious whether there is more to install. It would be greatly appreciated if anyone helped me.
python amazon-web-services machine-learning ocr
add a comment |
`
import boto3
if __name__ == "__main__":
bucket='random_name'
photo='b4.png'
client=boto3.client('rekognition')
response=client.detect_text(Image={'S3Object':
{'random_name':bucket,'b4.png':photo}})
textDetections=response['TextDetections']
print(response)
print('Matching faces')
for text in textDetections:
print('Detected text:' + text['DetectedText'])
print('Confidence: ' + "{:.2f}".format(text['Confidence']) + "%")
print('Id: {}'.format(text['Id']))
if 'ParentId' in text:
print('Parent Id: {}'.format(text['ParentId']))
print('Type:' + text['Type'])
print()`
This is the code recognizing images(OCR) yet I do not know where I should paste this code to run. Do I run this in Jupyter notebooks and would I need to install extra things? Do I run it in the Anaconda Prompt? I've tried both. In Jupyter, I get an error: |ParamValidationError: Parameter validation failed: Unknown parameter in Image.S3Object: "random_name", must be one of: Bucket, Name, Version Unknown parameter in Image.S3Object: "b4.png", must be one of: Bucket, Name, Version| and Anaconda prompt has much more errors. I've installed AWS already and curious whether there is more to install. It would be greatly appreciated if anyone helped me.
python amazon-web-services machine-learning ocr
add a comment |
`
import boto3
if __name__ == "__main__":
bucket='random_name'
photo='b4.png'
client=boto3.client('rekognition')
response=client.detect_text(Image={'S3Object':
{'random_name':bucket,'b4.png':photo}})
textDetections=response['TextDetections']
print(response)
print('Matching faces')
for text in textDetections:
print('Detected text:' + text['DetectedText'])
print('Confidence: ' + "{:.2f}".format(text['Confidence']) + "%")
print('Id: {}'.format(text['Id']))
if 'ParentId' in text:
print('Parent Id: {}'.format(text['ParentId']))
print('Type:' + text['Type'])
print()`
This is the code recognizing images(OCR) yet I do not know where I should paste this code to run. Do I run this in Jupyter notebooks and would I need to install extra things? Do I run it in the Anaconda Prompt? I've tried both. In Jupyter, I get an error: |ParamValidationError: Parameter validation failed: Unknown parameter in Image.S3Object: "random_name", must be one of: Bucket, Name, Version Unknown parameter in Image.S3Object: "b4.png", must be one of: Bucket, Name, Version| and Anaconda prompt has much more errors. I've installed AWS already and curious whether there is more to install. It would be greatly appreciated if anyone helped me.
python amazon-web-services machine-learning ocr
`
import boto3
if __name__ == "__main__":
bucket='random_name'
photo='b4.png'
client=boto3.client('rekognition')
response=client.detect_text(Image={'S3Object':
{'random_name':bucket,'b4.png':photo}})
textDetections=response['TextDetections']
print(response)
print('Matching faces')
for text in textDetections:
print('Detected text:' + text['DetectedText'])
print('Confidence: ' + "{:.2f}".format(text['Confidence']) + "%")
print('Id: {}'.format(text['Id']))
if 'ParentId' in text:
print('Parent Id: {}'.format(text['ParentId']))
print('Type:' + text['Type'])
print()`
This is the code recognizing images(OCR) yet I do not know where I should paste this code to run. Do I run this in Jupyter notebooks and would I need to install extra things? Do I run it in the Anaconda Prompt? I've tried both. In Jupyter, I get an error: |ParamValidationError: Parameter validation failed: Unknown parameter in Image.S3Object: "random_name", must be one of: Bucket, Name, Version Unknown parameter in Image.S3Object: "b4.png", must be one of: Bucket, Name, Version| and Anaconda prompt has much more errors. I've installed AWS already and curious whether there is more to install. It would be greatly appreciated if anyone helped me.
python amazon-web-services machine-learning ocr
python amazon-web-services machine-learning ocr
asked Nov 25 '18 at 2:57
SeanSean
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Code that calls an AWS API (such as client.detect_text()) can be run from anywhere on the Internet. You have shown some Python code that can be run on a server, on a laptop, an EC2 instance or as a Lambda function (with a bit of a cleanup).
The only additional thing it needs is a set of credentials so that it can connect to your AWS account.
- If you are running the code on an Amazon EC2 instance or as a lambda function, simply assign the instance/function an appropriate IAM Role and the code will automatically receive credentials.
- If you are running the code on your own computer, first run the
aws configurecommand and provide your IAM User credentials.
Also, please note that the format of detect_text() is:
response = client.detect_text(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
Therefore, your line of code should be:
response = client.detect_text(Image={'S3Object':{'Bucket':bucket, 'Name':photo}})
Also, I wouldn't say that this function is true OCR. Rather, it finds bits of text in a picture, such as words on a sign. It would not be suitable for reading a page full of text, which is done by traditional OCR methods.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464278%2fwhere-do-i-run-this-aws-rekognition-code-and-do-i-need-to-install-anything-else%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Code that calls an AWS API (such as client.detect_text()) can be run from anywhere on the Internet. You have shown some Python code that can be run on a server, on a laptop, an EC2 instance or as a Lambda function (with a bit of a cleanup).
The only additional thing it needs is a set of credentials so that it can connect to your AWS account.
- If you are running the code on an Amazon EC2 instance or as a lambda function, simply assign the instance/function an appropriate IAM Role and the code will automatically receive credentials.
- If you are running the code on your own computer, first run the
aws configurecommand and provide your IAM User credentials.
Also, please note that the format of detect_text() is:
response = client.detect_text(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
Therefore, your line of code should be:
response = client.detect_text(Image={'S3Object':{'Bucket':bucket, 'Name':photo}})
Also, I wouldn't say that this function is true OCR. Rather, it finds bits of text in a picture, such as words on a sign. It would not be suitable for reading a page full of text, which is done by traditional OCR methods.
add a comment |
Code that calls an AWS API (such as client.detect_text()) can be run from anywhere on the Internet. You have shown some Python code that can be run on a server, on a laptop, an EC2 instance or as a Lambda function (with a bit of a cleanup).
The only additional thing it needs is a set of credentials so that it can connect to your AWS account.
- If you are running the code on an Amazon EC2 instance or as a lambda function, simply assign the instance/function an appropriate IAM Role and the code will automatically receive credentials.
- If you are running the code on your own computer, first run the
aws configurecommand and provide your IAM User credentials.
Also, please note that the format of detect_text() is:
response = client.detect_text(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
Therefore, your line of code should be:
response = client.detect_text(Image={'S3Object':{'Bucket':bucket, 'Name':photo}})
Also, I wouldn't say that this function is true OCR. Rather, it finds bits of text in a picture, such as words on a sign. It would not be suitable for reading a page full of text, which is done by traditional OCR methods.
add a comment |
Code that calls an AWS API (such as client.detect_text()) can be run from anywhere on the Internet. You have shown some Python code that can be run on a server, on a laptop, an EC2 instance or as a Lambda function (with a bit of a cleanup).
The only additional thing it needs is a set of credentials so that it can connect to your AWS account.
- If you are running the code on an Amazon EC2 instance or as a lambda function, simply assign the instance/function an appropriate IAM Role and the code will automatically receive credentials.
- If you are running the code on your own computer, first run the
aws configurecommand and provide your IAM User credentials.
Also, please note that the format of detect_text() is:
response = client.detect_text(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
Therefore, your line of code should be:
response = client.detect_text(Image={'S3Object':{'Bucket':bucket, 'Name':photo}})
Also, I wouldn't say that this function is true OCR. Rather, it finds bits of text in a picture, such as words on a sign. It would not be suitable for reading a page full of text, which is done by traditional OCR methods.
Code that calls an AWS API (such as client.detect_text()) can be run from anywhere on the Internet. You have shown some Python code that can be run on a server, on a laptop, an EC2 instance or as a Lambda function (with a bit of a cleanup).
The only additional thing it needs is a set of credentials so that it can connect to your AWS account.
- If you are running the code on an Amazon EC2 instance or as a lambda function, simply assign the instance/function an appropriate IAM Role and the code will automatically receive credentials.
- If you are running the code on your own computer, first run the
aws configurecommand and provide your IAM User credentials.
Also, please note that the format of detect_text() is:
response = client.detect_text(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
Therefore, your line of code should be:
response = client.detect_text(Image={'S3Object':{'Bucket':bucket, 'Name':photo}})
Also, I wouldn't say that this function is true OCR. Rather, it finds bits of text in a picture, such as words on a sign. It would not be suitable for reading a page full of text, which is done by traditional OCR methods.
answered Nov 25 '18 at 5:10
John RotensteinJohn Rotenstein
80k791143
80k791143
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464278%2fwhere-do-i-run-this-aws-rekognition-code-and-do-i-need-to-install-anything-else%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown