Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Arcaea Offline OCR

Ruff

Example

Results from arcaea_offline_ocr 0.1.0b1

Build an image hash database (ihdb)

import sqlite3
from pathlib import Path

import cv2

from arcaea_offline_ocr.builders.ihdb import (
    ImageHashDatabaseBuildTask,
    ImageHashesDatabaseBuilder,
)
from arcaea_offline_ocr.providers import ImageCategory, ImageHashDatabaseIdProvider
from arcaea_offline_ocr.scenarios.device import DeviceScenario

def build():
    def _read_partner_icon(image_path: str):
        return DeviceScenario.preprocess_char_icon(
            cv2.cvtColor(cv2.imread(image_path, cv2.IMREAD_COLOR), cv2.COLOR_BGR2GRAY),
        )

    builder = ImageHashesDatabaseBuilder()
    tasks = [
        ImageHashDatabaseBuildTask(
            image_path=str(file),
            image_id=file.stem,
            category=ImageCategory.JACKET,
        )
        for file in Path("/path/to/some/jackets").glob("*.jpg")
    ]

    tasks.extend(
        [
            ImageHashDatabaseBuildTask(
                image_path=str(file),
                image_id=file.stem,
                category=ImageCategory.PARTNER_ICON,
                imread_function=_read_partner_icon,
            )
            for file in Path("/path/to/some/partner_icons").glob("*.png")
        ],
    )

    with sqlite3.connect("/path/to/ihdb-X.Y.Z.db") as conn:
        builder.build(conn, tasks)

Device OCR

import json
import sqlite3
from dataclasses import asdict

import cv2

from arcaea_offline_ocr.providers import (
    ImageHashDatabaseIdProvider,
    OcrCrnnTextProvider,
)
from arcaea_offline_ocr.scenarios.device import DeviceScenario


with sqlite3.connect("/path/to/ihdb-X.Y.Z.db") as conn:
    img = cv2.imread("/path/to/your/screenshot.jpg")

    scenario = DeviceScenario.for_image(
        img,
        crnn_provider=OcrCrnnTextProvider("/path/to/model_patched.onnx"),
        image_id_provider=ImageHashDatabaseIdProvider(conn),
    )
    result = scenario.result()

    with open("result.jsonc", "w", encoding="utf-8") as jf:
        json.dump(asdict(result), jf, indent=2, ensure_ascii=False)
// result.json
{
  "song_id": "vector",
  "rating_class": 1,
  "score": 9990996,
  "song_id_results": [
    {
      "image_id": "vector",
      "category": 0,
      "confidence": 1.0,
      "image_hash_type": 0
    },
    {
      "image_id": "clotho",
      "category": 0,
      "confidence": 0.71875,
      "image_hash_type": 0
    }
    // 28 more results omitted…
  ],
  "partner_id_results": [
    {
      "image_id": "23",
      "category": 1,
      "confidence": 0.90625,
      "image_hash_type": 0
    },
    {
      "image_id": "45",
      "category": 1,
      "confidence": 0.8828125,
      "image_hash_type": 0
    }
    // 28 more results omitted…
  ],
  "pure": 1000,
  "pure_inaccurate": null,
  "pure_early": null,
  "pure_late": null,
  "far": 2,
  "far_inaccurate": null,
  "far_early": null,
  "far_late": null,
  "lost": 0,
  "played_at": null,
  "max_recall": 1002,
  "clear_status": 2,
  "clear_type": null,
  "modifier": null
}

License

This file is part of arcaea-offline-ocr, as called "This program" below.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Credits

Metadata

Release files for arcaea-offline-ocr 0.1.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arcaea-offline-ocr 0.1.0b1
File Size Uploaded
arcaea_offline_ocr-0.1.0b1.tar.gz 57.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arcaea-offline-ocr 0.1.0b1
File Interpreter ABI Platform
arcaea_offline_ocr-0.1.0b1-py3-none-any.whl Python 3 none any Details

Total release size: 99.0 kB

Release files / arcaea_offline_ocr-0.1.0b1.tar.gz

Download URL arcaea_offline_ocr-0.1.0b1.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
94c603c267dc71f267f0d1109dc6155edd8c51b8eb67b27213687c0b5d90cee9
BLAKE2b-256 checksum
How to use checksums
35706946ac0953c38534a62602b28676f433d0636513cb2f4f3f2d5a29fd1e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

Release files / arcaea_offline_ocr-0.1.0b1-py3-none-any.whl

Download URL arcaea_offline_ocr-0.1.0b1-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
181f9536c2ce4864c103b18bcf6d6ee5eaf2af75ca1630d924790e6f3913cddb
BLAKE2b-256 checksum
How to use checksums
4602e72198bafae5fa028fd77aed9e8d2b899174b7ac4dc46fd3753806bbc1a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page