3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

日本語手書き文字認識システム

Posted at

日本語手書き文字認識システム

これは、ユーザーがアップロードした画像を使用して、日本語の手書き文字または印刷文字(ひらがな、カタカナ)を認識するシンプルなOCRベースのツールです。

コード

import gradio as gr
import easyocr
import cv2
import numpy as np
from PIL import Image

#Initialize OCR once (loads model)
reader = easyocr.Reader(['ja'], gpu=False)

def ocr_image(image):
    # Convert PIL to OpenCV format
    image_cv = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
    results = reader.readtext(image_cv)
    if results:
        return "\n".join([f"{text} (confidence: {prob:.2f})" for _, text, prob in results])
    return "No text detected."

#Gradio interface
iface = gr.Interface(
    fn=ocr_image,
    inputs=gr.Image(type="pil"),
    outputs=gr.Textbox(label="Detected Text")
)

iface.launch()

コードの出力

image.png
image.png

ウェブサイトへのリンク :
https://huggingface.co/spaces/nikisded/japanese-using-opencv

締めくくりの言葉

カスタムの手書きデータセットを用いてCNN(またはRNN)で学習させることで、分析結果を改善できる可能性がある。

読んでいただきありがとうございます!もし試してみたら感想を聞かせてください!

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?