← 开源
faustomorales

keras-ocr

A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model.

Model DevelopmentDomain-specific trainingTraining toolkitsPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
1.47k
Star
371
Fork
+2
本周
18
贡献者
创建于 2019-09-20 · 更新于 2026-10-15 · 今日第 10226 名
主要开发者
faustomoralesbayethiernodiopneverabsolute

faustomorales/keras-ocr 排名第 10,226,有 1,474 个星标。

同类别比较

faustomorales/keras-ocr 排名第 10,226,此处有 8 个同类条目;IBM/fhe-toolkit-linux 排名第 10,224。

同类别比较
名称排名指标
alxndrTL/mamba.py10,207
语言:
Python
星标数:
1,480
分叉数:
129
简介:
A simple and efficient Mamba implementation in pure PyTorch and MLX.
Lightning-AI/lightning-thunder10,219
语言:
Python
星标数:
1,475
分叉数:
121
简介:
PyTorch compiler that accelerates training and inference. Get built-in optimizations for performance, memory, parallelism, and easily write your own.
google-deepmind/jraph10,221
语言:
Python
星标数:
1,475
分叉数:
108
简介:
A Graph Neural Network Library in Jax
IBM/fhe-toolkit-linux10,224
语言:
C++
星标数:
1,474
分叉数:
155
简介:
IBM Fully Homomorphic Encryption Toolkit For Linux. This toolkit is a Linux based Docker container that demonstrates computing on encrypted data without decrypting it! The toolkit ships with two demos including a fully encrypted Machine Learning inference with a Neural Network and a Privacy-Preserving key-value search.
code-kern-ai/refinery10,229
语言:
Python
星标数:
1,473
分叉数:
74
简介:
The data scientist's open-source choice to scale, assess and maintain natural language data. Treat training data like a software artifact.
Om-Alve/smolGPT10,233
语言:
Python
星标数:
1,472
分叉数:
126
erwincoumans/motion_imitation10,236
语言:
Python
星标数:
1,471
分叉数:
316
简介:
Code accompanying the paper "Learning Agile Robotic Locomotion Skills by Imitating Animals"
lxztju/pytorch_classification10,240
语言:
Jupyter Notebook
星标数:
1,469
分叉数:
341
简介:
利用pytorch实现图像分类的一个完整的代码,训练,预测,TTA,模型融合,模型部署,cnn提取特征,svm或者随机森林等进行分类,模型蒸馏,一个完整的代码
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Domain-specific training,Training toolkits
关键词OCR
星标数1,474
分叉数371
贡献者18
创建日期2019-09-20
更新日期2026-10-15
1 天星标数0
7 天星标数2
排名10,226
上次排名5,667
排名变化-4,559
7 天星标排名8,041
上次 7 天星标排名8,082
7 天星标排名变化41
总星标排名8,202
上次总星标排名8,190
总星标排名变化-12
国家USA
README 摘录

This is a slightly polished and packaged version of the Keras CRNN implementation and the published CRAFT text detection model. It provides a high level API for training a text detection and OCR pipeline. Please see the documentation for more examples, including for training a custom model. Getting Started Installation supports Python >= 3. Using The package ships with an easy-to-use implementation of the CRAFT text detection model from this repository and the CRNN recognition model from this repository

. Comparing keras-ocr and other OCR approaches You may be wondering how the models in this package compare to existing cloud OCR APIs. We provide some metrics below and the notebook used to compute them using the first 1,000 images in the COCO-Text validation set. We limited it to 1,000 because the Google Cloud free tier is for 1,000 calls a month at the time of this writing. As of this writing, they should be considered

a very rough first draft. Please open an issue if you find a mistake. In particular, the cloud APIs have a variety of options that one can use to improve their performance and the responses can be parsed in different ways. It is possible that I made some error in configuration or parsing. Again, please open an issue if you find a mistake! We ignore punctuation and letter case because the out-of-the-box recognizer in keras-ocr (provided

by this independent repository) does not support either. Note that both AWS Rekognition and Google Cloud Vision support punctuation as well as upper and lowercase characters. 59 | Precision and recall were computed based on an intersection over union of 50% or higher and a text similarity to ground truth of 50% or higher. latency values were computed using a Tesla P4 GPU on Google Colab. refers to the argument provided to which determines the upscaling applied to the image prior

to inference. Latency for the cloud providers was measured with sequential requests, so you can obtain significant speed improvements by making multiple simultaneous API requests. Each of the entries provides a link to the JSON file containing the annotations made on each pass. You can use this with the notebook to compute metrics without having to make the API calls yourself (though you are encoraged to replicate it independently)! _ In every configuration I tried, Tesseract did very poorly on this

test. Tesseract performs best on scans of books, not on incidental scene text like that in this dataset. Advanced Configuration By default if a GPU is available Tensorflow tries to grab almost all of the available video memory, and this sucks if you're running multiple models with Tensorflow and Pytorch. Setting any value for the environment variable will force Tensorflow to dynamically allocate only as much GPU memory as is needed. You can also specify a limit per Tensorflow process

by setting the environment variable to any float, and this value is a float ratio of VRAM to the total

常见问题

记录了多少星标和分叉?

faustomorales/keras-ocr 有 1,474 个星标和 371 个分叉。

仓库排名是多少?

faustomorales/keras-ocr 排名第 10,226。

记录的语言和类别是什么?

faustomorales/keras-ocr 有 1,474 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

faustomorales/keras-ocr 与 IBM/fhe-toolkit-linux 比较,后者排名第 10,224,有 1,474 个星标。

README

keras-ocr

This is a slightly polished and packaged version of the Keras CRNN implementation and the published CRAFT text detection model. It provides a high level API for training a text detection and OCR pipeline.

Please see the documentation for more examples, including for training a custom model.

Getting Started

Installation

keras-ocr supports Python >= 3.6 and TensorFlow >= 2.0.0.

# To install from master
pip install git+https://github.com/faustomorales/keras-ocr.git#egg=keras-ocr

# To install from PyPi
pip install keras-ocr

Using

The package ships with an easy-to-use implementation of the CRAFT text detection model from this repository and the CRNN recognition model from this repository.

import matplotlib.pyplot as plt

import keras_ocr

# keras-ocr will automatically download pretrained
# weights for the detector and recognizer.
pipeline = keras_ocr.pipeline.Pipeline()

# Get a set of three example images
images = [
    keras_ocr.tools.read(url) for url in [
        'https://upload.wikimedia.org/wikipedia/commons/b/bd/Army_Reserves_Recruitment_Banner_MOD_45156284.jpg',
        'https://upload.wikimedia.org/wikipedia/commons/e/e8/FseeG2QeLXo.jpg',
        'https://upload.wikimedia.org/wikipedia/commons/b/b4/EUBanana-500x112.jpg'
    ]
]

# Each list of predictions in prediction_groups is a list of
# (word, box) tuples.
prediction_groups = pipeline.recognize(images)

# Plot the predictions
fig, axs = plt.subplots(nrows=len(images), figsize=(20, 20))
for ax, image, predictions in zip(axs, images, prediction_groups):
    keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax)

Comparing keras-ocr and other OCR approaches

You may be wondering how the models in this package compare to existing cloud OCR APIs. We provide some metrics below and the notebook used to compute them using the first 1,000 images in the COCO-Text validation set. We limited it to 1,000 because the Google Cloud free tier is for 1,000 calls a month at the time of this writing. As always, caveats apply:

  • No guarantees apply to these numbers -- please beware and compute your own metrics independently to verify them. As of this writing, they should be considered a very rough first draft. Please open an issue if you find a mistake. In particular, the cloud APIs have a variety of options that one can use to improve their performance and the responses can be parsed in different ways. It is possible that I made some error in configuration or parsing. Again, please open an issue if you find a mistake!
  • We ignore punctuation and letter case because the out-of-the-box recognizer in keras-ocr (provided by this independent repository) does not support either. Note that both AWS Rekognition and Google Cloud Vision support punctuation as well as upper and lowercase characters.
  • We ignore non-English text.
  • We ignore illegible text.
model latency precision recall
AWS 719ms 0.45 0.48
GCP 388ms 0.53 0.58
keras-ocr (scale=2) 417ms 0.53 0.54
keras-ocr (scale=3) 699ms 0.5 0.59
  • Precision and recall were computed based on an intersection over union of 50% or higher and a text similarity to ground truth of 50% or higher.
  • keras-ocr latency values were computed using a Tesla P4 GPU on Google Colab. scale refers to the argument provided to keras_ocr.pipelines.Pipeline() which determines the upscaling applied to the image prior to inference.
  • Latency for the cloud providers was measured with sequential requests, so you can obtain significant speed improvements by making multiple simultaneous API requests.
  • Each of the entries provides a link to the JSON file containing the annotations made on each pass. You can use this with the notebook to compute metrics without having to make the API calls yourself (though you are encoraged to replicate it independently)!

Why not compare to Tesseract? In every configuration I tried, Tesseract did very poorly on this test. Tesseract performs best on scans of books, not on incidental scene text like that in this dataset.

Advanced Configuration

By default if a GPU is available Tensorflow tries to grab almost all of the available video memory, and this sucks if you're running multiple models with Tensorflow and Pytorch. Setting any value for the environment variable MEMORY_GROWTH will force Tensorflow to dynamically allocate only as much GPU memory as is needed.

You can also specify a limit per Tensorflow process by setting the environment variable MEMORY_ALLOCATED to any float, and this value is a float ratio of VRAM to the total amount present.

To apply these changes, call keras_ocr.config.configure() at the top of your file where you import keras_ocr.

Contributing

To work on the project, start by doing the following. These instructions probably do not yet work for Windows but if a Windows user has some ideas for how to fix that it would be greatly appreciated (I don't have a Windows machine to test on at the moment).

# Install local dependencies for
# code completion, etc.
make init

# Build the Docker container to run
# tests and such.
make build
  • You can get a JupyterLab server running to experiment with using make lab.
  • To run checks before committing code, you can use make format-check type-check lint-check test.
  • To view the documentation, use make docs.

To implement new features, please first file an issue proposing your change for discussion.

To report problems, please file an issue with sample code, expected results, actual results, and a complete traceback.

Troubleshooting

  • This package is installing opencv-python-headless but I would prefer a different opencv flavor. This is due to aleju/imgaug#473. You can uninstall the unwanted OpenCV flavor after installing keras-ocr. We apologize for the inconvenience.
排名相邻
同类项目