[PR #999] [MERGED] Re-introduce OCR for images #1003

Closed
opened 2026-02-15 15:57:28 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RPCS3/discord-bot/pull/999
Author: @13xforever
Created: 7/5/2025
Status: Merged
Merged: 7/7/2025
Merged by: @13xforever

Base: masterHead: feature/ocr


📝 Commits (4)

  • 2259feb implement pluggable ocr provider and add tesseract and florence2 impl
  • 4ecb64e unify some config params, and move datfile location to app data
  • a81d48f upgraded nlog back to v6, and it should work as expected now
  • e99e507 offer user input as one of the autocomplete choices for events and compat

📊 Changes

18 files changed (+421 additions, -118 deletions)

View changed files

📝 Clients/CompatApiClient/CompatApiClient.csproj (+1 -1)
📝 CompatBot/Commands/AutoCompleteProviders/EventNameAutoCompleteProvider.cs (+3 -1)
📝 CompatBot/Commands/AutoCompleteProviders/ProductCodeAutoCompleteProvider.cs (+5 -2)
📝 CompatBot/Commands/BotStatus.cs (+3 -5)
📝 CompatBot/Commands/Vision.cs (+15 -15)
📝 CompatBot/CompatBot.csproj (+4 -2)
📝 CompatBot/Config.cs (+15 -5)
📝 CompatBot/EventHandlers/ContentFilterMonitor.cs (+2 -0)
📝 CompatBot/EventHandlers/MediaScreenshotMonitor.cs (+60 -80)
CompatBot/Ocr/Backend/AzureVision.cs (+52 -0)
CompatBot/Ocr/Backend/BackendBase.cs (+33 -0)
CompatBot/Ocr/Backend/Florence2.cs (+65 -0)
CompatBot/Ocr/Backend/IOcrBackend.cs (+8 -0)
CompatBot/Ocr/Backend/Tesseract.cs (+81 -0)
CompatBot/Ocr/OcrProvider.cs (+59 -0)
📝 CompatBot/Program.cs (+3 -1)
📝 Dockerfile (+4 -5)
📝 README.md (+8 -1)

📄 Description

Refactored Azure Computer Vision OCR as one of the supported backends, and added Florence2 and Tesseract as alternatives.

There's a new config parameter OcrBackend, which is set to auto by default. Possible options:

  • azure: preferred when AzureComputerVisionKey is configured — best accuracy and speed; requires Azure sub
  • florence2: preferred for host with 4GB of ram or more — 2nd best accuracy, no native dependencies; slow, and requires more ram
  • tesseract: used as the last resort — ok accuracy, requires extra packages on Linux (see updated Readme); fast, low resource usage

Additionally, the reaction handler for message filter check now also checks image attachments.
And, as we're now not limited to the number of API calls, all channels are being checked.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RPCS3/discord-bot/pull/999 **Author:** [@13xforever](https://github.com/13xforever) **Created:** 7/5/2025 **Status:** ✅ Merged **Merged:** 7/7/2025 **Merged by:** [@13xforever](https://github.com/13xforever) **Base:** `master` ← **Head:** `feature/ocr` --- ### 📝 Commits (4) - [`2259feb`](https://github.com/RPCS3/discord-bot/commit/2259febe87e3f6fa5d42dfb5feafca600b86fc5e) implement pluggable ocr provider and add tesseract and florence2 impl - [`4ecb64e`](https://github.com/RPCS3/discord-bot/commit/4ecb64e1be7dede7eee6c44ff004a65759413642) unify some config params, and move datfile location to app data - [`a81d48f`](https://github.com/RPCS3/discord-bot/commit/a81d48fd4be28d838e2ed04fec5d1da6a916b871) upgraded nlog back to v6, and it should work as expected now - [`e99e507`](https://github.com/RPCS3/discord-bot/commit/e99e507452d49687e8927d10fe1b054e7cbfb408) offer user input as one of the autocomplete choices for events and compat ### 📊 Changes **18 files changed** (+421 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `Clients/CompatApiClient/CompatApiClient.csproj` (+1 -1) 📝 `CompatBot/Commands/AutoCompleteProviders/EventNameAutoCompleteProvider.cs` (+3 -1) 📝 `CompatBot/Commands/AutoCompleteProviders/ProductCodeAutoCompleteProvider.cs` (+5 -2) 📝 `CompatBot/Commands/BotStatus.cs` (+3 -5) 📝 `CompatBot/Commands/Vision.cs` (+15 -15) 📝 `CompatBot/CompatBot.csproj` (+4 -2) 📝 `CompatBot/Config.cs` (+15 -5) 📝 `CompatBot/EventHandlers/ContentFilterMonitor.cs` (+2 -0) 📝 `CompatBot/EventHandlers/MediaScreenshotMonitor.cs` (+60 -80) ➕ `CompatBot/Ocr/Backend/AzureVision.cs` (+52 -0) ➕ `CompatBot/Ocr/Backend/BackendBase.cs` (+33 -0) ➕ `CompatBot/Ocr/Backend/Florence2.cs` (+65 -0) ➕ `CompatBot/Ocr/Backend/IOcrBackend.cs` (+8 -0) ➕ `CompatBot/Ocr/Backend/Tesseract.cs` (+81 -0) ➕ `CompatBot/Ocr/OcrProvider.cs` (+59 -0) 📝 `CompatBot/Program.cs` (+3 -1) 📝 `Dockerfile` (+4 -5) 📝 `README.md` (+8 -1) </details> ### 📄 Description Refactored Azure Computer Vision OCR as one of the supported backends, and added [Florence2](https://github.com/curiosity-ai/florence2-sharp) and [Tesseract](https://github.com/Dynaruid/TesseractCSharp) as alternatives. There's a new config parameter `OcrBackend`, which is set to `auto` by default. Possible options: * `azure`: preferred when `AzureComputerVisionKey` is configured — best accuracy and speed; requires Azure sub * `florence2`: preferred for host with 4GB of ram or more — 2nd best accuracy, no native dependencies; slow, and requires more ram * `tesseract`: used as the last resort — ok accuracy, requires extra packages on Linux (see updated Readme); fast, low resource usage Additionally, the reaction handler for message filter check now also checks image attachments. And, as we're now not limited to the number of API calls, all channels are being checked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 15:57:28 -05:00
yindo closed this issue 2026-02-15 15:57:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RPCS3/discord-bot#1003