VNRecognizeTextRequest ios15 problem recognizing text

Hi,

I found a problem with the vision framework in my app using iOS15. I write recognized text in a string and under ios15 the result is not in the right order. Maybe a example would explain it better :-)

Text to scan:

Hello, my name is Michael and I am the programmer of an app named Scan2Clipboard. Now I've focused a problem with VNRecognizeTextRequest and iOS 15.

Result under iOS 14: Hello, my name is Michael and I am the programmer of an app named Scan2Clipboard. Now I've focused a problem with VNRecognizeTextRequest and iOS 15.

Result under iOS15: Hello, my name is Michael and I am the programmer of an app VNRecognizeTextRequest and iOS 15. named Scan2Clipboard. Now I've focused a problem with

I've tried some other app from the App Store (Scan&Copy, Quick Scan). They are showing the same behavior. They are using the vision framework to. Does anyone have this issue to?

If I change "recognizeTextRequest.recognitionLevel = .fast" from .accurate to .fast the error disappears. Maybe an error in VisionKit?

failure

If I change the maximumRecognitionCandidates from 1 to a higher number the results are getting better. With maximumRecognitionCandidates 3 or higher the result is in the right order and the value makes no difference until 9. With value 10 the result ist the same like value 1. This behavior only appears under iOS 15. So this is only a workaround and not a real solution yet, I suppose. Can you reproduce this unexpected behavior?

let maximumRecognitionCandidates = 9
            for observation in observations {
                guard let candidate = observation.topCandidates(maximumRecognitionCandidates).first else { continue }
                entireRecognizedText += "\(candidate.string)\n"

For what it's worth, we are having the same problem as well.

Using VNRecognizeTextRequest on a screenshot of Apple's Screen Time app used to return the text (a list of app names and duration used) ordered from top to bottom. For iOS 15, the ordering of the text is no longer from top to bottom.

For example:

iOS 14, correct order : ["YouTube","56m","Facebook","55m","Tumblr","45m"]
iOS 15, different order : ["56m","55m","YouTube","Facebook","45m","Tumblr"]

We've also tried the suggested work around to up the observation top candidates from 1 to 3-9 but none of those changed the order at which the text was picked up.

VNRecognizeTextRequest ios15 problem recognizing text
 
 
Q