'Run multiple Firebase TextRecognition processes in parallel

i am trying to process more than 2 camera frames in parallel at the same time. So i have 2 text detectors initialized like this

TextRecognitionProcessor textRecognitionProcesso0 = FirebaseVision.getInstance(FirebaseApp.initializeApp(context, FirebaseOptions.fromResource(context), Integer.valueOf(0).toString())).getOnDeviceTextRecognizer();

TextRecognitionProcessor textRecognitionProcesso1 = FirebaseVision.getInstance(FirebaseApp.initializeApp(context, FirebaseOptions.fromResource(context), Integer.valueOf(1).toString())).getOnDeviceTextRecognizer();

textRecognitionProcesso0.processImage(frame1);
textRecognitionProcesso1.processImage(frame2);

Yet i don't see any performance improvement at all. When i do a profiling i see only one thread utilizing the CPU. It seems like ML kit runs them sequentially. Does firebase ML kit support running multiple OCR detectors in parallel ?



Solution 1:[1]

Maybe you can try to use standalone MLKit SDK, where you can set custom executor for each TextRecognizer

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jack