Free Support Forum - aspose.cloud

Error: AmazonS3 exception: Error 'The specified key does not exist


#1

I am new to ASPOSE Products.

My code is:

$omr = new Aspose\Omr\Api\OmrApi($appKey, $appSid);
$response = $omr->postRunOmrTask(" ans.txt “, “GenerateTemplate”);
file_put_contents(time().”.response.txt", $response);

I am getting following error:

Fatal error : Uncaught exception ‘Aspose\Omr\ApiException’ with message '[404] Client error: POST [https://api.aspose.cloud/v1.1/omr/ans.txt/runOmrTask?actionName=GenerateTemplate](https://api.aspose.cloud/v1.1/omr/ans.txt/runOmrTask?actionName=GenerateTemplate) resulted in a 404 Not Found response: {“Message”:"AmazonS3 exception: Error ‘The specified key does not exist.’, Bucket ‘afc-filestorage’, FilePath '82741/189 (truncated…) ’

Please tell me what should I place in ans.txt file

Why is this error coming?


#2

@ankurgupta555

Thanks for your inquiry. As per your code you are generating a template for OMR operation and as per error it seems the required template file is missing on the storage.

The text file should include template details. Please check following documentation for more details. You can find sample documents from PHP SDK.

Template Generation
Template Requirements


#3
  1. I have not configured that API to look for AWS S3 for storage. Then why is it looking for S3 Storage?
    Why we need S3. Can we use other Storage options? How?

  2. I had placed “ans.txt” (Which was placed in my local hdd) the following text:

?text=Name__________________________________ Date____________

#What is Aspose.OMR main function?
() OCR () Capture human-marked data
() There is no main function () Enhance images
#Can Aspose.OMR process not only scans, but also photos?
() Yes, indeed! () No
#Aspose.OMR is available on any platform, because it is:
() Cross-platform code () Cloud service
#Aspose.OMR works with any kind of OMR forms: tests, exams, questionnaires, surveys, etc.
() Yes, indeed! () No
#Excellent recognition results can be achieved only for filled bubbles at least for:
() 40% () 60% () 75% () 98%
#Does Aspose.OMR support bubbles mapping to any key names?
() No () Partially (only “A, B, C…” or “1, 2, 3…”) () Yes, any key names
#Do you have to mark up every question on the page?
(Yes) Yes, that will help a lot! (No) No
#Rate your preference from 0 to 9 with “0” being preference towards performance
and “9” being preference towards flexibility.
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
#I found aspose omr to be a useful tool. (5 - strongly agree, 1 - strongly disagree)
(5) (4) (3) (2) (1)

?text= Answer sheet section

?answer_sheet=MainQuestions
elements_count=100
columns_count=5

Is it incorrect?

  1. In dashboard it says
    https://dashboard.aspose.cloud/#/storages
    Storage type: Aspose Cloud Storage
    Then why is it looking for S3.

#4

@ankurgupta555,

Thanks for your inquiry. Please note our APIs are hosted at AWS S3, so you are getting the S3 in the error message.

Yes, you can use third party storage with Aspose Cloud APIs. Please check following article for details.

How to Configure 3rd Party Cloud Storages

For template, please use tab key to indent answers. Please find the updated template.
test.zip (783 Bytes)


#5

Thank you!
Finally I am able to generate OMR sheets from text files.
Now I want to process the answers given. I have created a jpg file and used GIMP to fill the dots and then uploaded to my dropbox account.

My code is:
$omr = new OmrApi($appKey, $appSid);
$response = $omr->postRunOmrTask(“answersheet.jpg”, “RecognizeImage”, null, “XStore”);
file_put_contents(time().".RecognizeImage.txt", $response);

I don’t know what “RecognizeImage” will do. But it returned the following error:

{
“Status”: “OK”,
“ErrorCode”: 3,
“ErrorText”: “join() argument must be str or bytes, not ‘NoneType’ Error reference ID 0357b1fa-eaf1-4684-a2ad-f21873a9f2b8”,
“Payload”: {
“Result”: {
“TemplateId”: “”,
“ExecutionTime”: 0,
“ResponseFiles”: [],
“Info”: {
“ProcessedTasksCount”: 0,
“SuccessfulTasksCount”: 0,
“Details”: {
“RecognitionStatistics”: []
}
}
}
},
“ServerStat”: {
“StorageDownloadTime”: “00:00:00.6445892”,
“OmrFunctionCallTime”: “00:00:01.7411521”
}
}

I need some kind of json/csv/text output about what students have answered for each question. What should I do? We have our software which will generate the result. We just want to know the answers given for each question.


#6

@ankurgupta555

Thanks for your inquiry. Please check PHP working demo for understanding the complete OMR workflow with Aspose.OMR Cloud.

Furthermore, for JSON output check response content detail of Recognize Image function, it provides JSON results within OmrResponse.Payload.Result.Info.Details .


#7

When I run the demo I get the following error:

php omr_demo.php

Starting OMR Demo
PHP Fatal error: Uncaught Exception: Config file not found: test_config.json in /home/ankurgupta/Server/websites/lab.nginx/omrdemo/omr_demo.php:189
Stack trace:
#0 /home/ankurgupta/Server/websites/lab.nginx/omrdemo/omr_demo.php(157): Aspose\Omr\Demo\OmrDemo->loadConfig()
#1 /home/ankurgupta/Server/websites/lab.nginx/omrdemo/omr_demo.php(469): Aspose\Omr\Demo\OmrDemo->__construct()
#2 {main}
thrown in /home/ankurgupta/Server/websites/lab.nginx/omrdemo/omr_demo.php on line 189

Where can I find test_config.json and where should I place this file? What this file should contain?


#8

@ankurgupta555

We are sorry for your inconvenience. Please make sure to update all the sub-modules, clone sub-modules as suggested in Readme. It will clone aspose-omr-cloud-demo-data module, it contains all the required sample data for demo.

Clone  `aspose-omr-cloud`   **with submodules** :

git clone https://github.com/aspose-omr-cloud/aspose-omr-cloud-php.git --recurse-submodules

#9

While studying the code, I saw the following methods:
GenerateTemplate
CorrectTemplate
FinalizeTemplate
RecognizeImage
ValidateTemplate

I only understand one of them: GenerateTemplate which is used to create template image from config file of answersheet.

What is difference among: CorrectTemplate, FinalizeTemplate and RecognizeImage

What they do? Which of them actually checks the filled (marked) omr sheet and create output?


#10

@ankurgupta555,

Thanks for your feedback. Please check OMR API specifications for your questions. It provides details with sample code.


#11

Actually I want to know what these words means or what these actions do. This is not explained in the link that you have given.
For example I know that “GenerateTemplate” creates a image of answersheet from the text specification we input. But I am confused about others, like what CorrectTemplate will do? Similarly what “FinalizeTemplate” will do? I think “RecognizeImage” will check the answers of student. Am I right?
and what is use of “ValidateTemplate”.


#12

@ankurgupta555
Thanks for sharing the additional information. I am looking into your questions and will update you shortly.


#13

@ankurgupta555

Please note, the template correction analyses position of all elements on the template image, corrects them and provides a more precise positioning. This is to cover cases when user provided input is imprecise, and to reduce possible future recognition errors caused by inaccurate positioning.

And template finalization is a process when template data required for the future recognition is calculated. This allows us to recognize actual photos faster, since most of the required information already processed in finalization. It takes quite a long time, but required only once per template.

Correction and Finalization are done only once per template, and then any amount of photos can be recognized. So this operation should be called when you are satisfied with your template and do not plan to add any changes to it. Hopefully it will answer your questions. Please feel free to ask if you still have any confusion.