RetroArch Local AI Service - Japanese to Romaji / Kana / English
By baka-neko / neko.works

Version 1.003 (2025-10-24)
- Added Kana output
- Added custom fonts

Version 1.002 (2025-10-24)
- Fixed cache reading

Version 1.001 (2025-10-24)
- Added English machine translation

Version 1.000 (2025-10-24)
- Initial Release

Features:
- Japanese to Japanese (text extraction, high accuracy).
- Japanese to Romaji / Kana (easier to read, average accuracy).
- Japanese to English (average quality local machine translation).
- Cache system:
  Can be manually edited / translated, then shared skipping OCR completely.
  The cache only works on static screens - no scrolling etc.
  When shared, only the .txt files are needed. The .png are just helpers for eventual manual edits.

Recommended local AI OCR server: "nanonets/Nanonets-OCR2-3B" (near 100% accuracy). Smaller model also available: "nanonets/Nanonets-OCR2-1.5B-exp".
Japanese to Romaji / Kana conversion: pykakasi (average accuracy).
Japanese to English local machine translation: argostranslate (average accuracy).

Installation:
- Start a local AI OCR server on your PC - also possible to use cloud based API such as OpenAI.
- Edit the .py script "parameters" section, set the correct "ocr_base_url" etc.
- Install the requirements with: pip install -r requirements.txt
- Start the service with:
  For Romaji: python retroarch_ai_service_romaji.py
  For Kana: python retroarch_ai_service_kana.py
  For English: python retroarch_ai_service_english.py

- Setup RetroArch - tested on the AYN Thor on the same local network as the PC server:
  Accessibility > AI Service
  AI Service Enabled: ON
  AI Service Output: Image Mode
  AI Service URL: http://PC-URL:4404
  Source Language: Japanese
  Target Language: English
  
  Set the AI Service hotkey in Inputs.

- Press the AI Service hotkey in-game, a romaji overlay is displayed.

Feel free to extend / share - implementing various languages translation etc. Enjoy!