googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.44k stars 2.9k forks source link

ML Kit Text Recognition Fails to Read Single Character Letter "B"? #596

Open ChefMachine opened 1 year ago

ChefMachine commented 1 year ago

Using ML Kit Vision Quickstart demo code downloaded from GitHub for text recognition of still images. Photos are sample game menus. Text Recognition Latin module fails to recognize the single capital letter "B" as either block, line or element. Screen shots below show recognized text overlaid in black on white.

To Reproduce

  1. Run Vision Quickstart app (either Java or Kotlin version)
  2. Select StillImageActivity button from menu
  3. Select still image from album
  4. Select Text Recognition Latin from Object Detection spinner
  5. Code displays recognized (or not) text lines on original still image using black on white overlays

** Sample emulator screen shots from Quickstart app

Does not recognize line with letter "B"

ML Kit Text Latin Demo6

Correctly identifies all four single character lines A, E, C, D

ML Kit Text Latin Demo5

Does not recognize line with single char "B "

ML Kit Text Latin Demo4

ML Kit Text Latin Demo3 ML Kit Text Latin Demo2 ML Kit Latin Text Demo1

Expected behavior Text Recognition Latin feature should recognize all large block Latin letters from sample game menus. Works OK for several menus, but fails to read standalone capital letter "B" as either block, line or element. Confirmed by inspection of LOGCAT file.

SDK Info: version unclear - here is list of imports from downloaded GitHub code

import com.google.mlkit.vision.text.Text import com.google.mlkit.vision.text.TextRecognition import com.google.mlkit.vision.text.TextRecognizer import com.google.mlkit.vision.text.TextRecognizerOptionsInterface

Smartphone:

Development Environment: Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 29, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

MacBook Pro (14-inch, 2021) macOS 12.6

Codestian commented 1 week ago

I also had this issue, but with the letters 'Q' and 'O'. These letters are ignored for some reason. I'm guessing the the ML kit is trained for words, not individual letters.