apple-ocr

Easy-to-Use Apple Vision wrapper for text extraction, scalar representation and clustering using K-means.

https://github.com/louisbrulenaudet/apple-ocr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

apple clustering kmeans nlp ocr ocr-recognition pyobjc python scatter-plot sklearn
Last synced: 6 months ago · JSON representation

Repository

Easy-to-Use Apple Vision wrapper for text extraction, scalar representation and clustering using K-means.

Basic Info
Statistics
  • Stars: 112
  • Watchers: 1
  • Forks: 5
  • Open Issues: 1
  • Releases: 4
Topics
apple clustering kmeans nlp ocr ocr-recognition pyobjc python scatter-plot sklearn
Created over 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme Funding License Code of conduct Citation Security

README.md

Easy-to-Use Apple Vision wrapper for text extraction and clustering

Python License Maintainer

apple_ocr is a utility for Optical Character Recognition (OCR) that facilitates the extraction of text from images. This Python-based tool is designed to help developers, researchers, and enthusiasts in the field of text extraction and clustering. It leverages a combination of various technologies to achieve this, including the Vision framework provided by Apple.

Plot

Features

  • Text Recognition: apple_ocr uses the Vision framework to recognize text within an image. It extracts recognized text and provides information about its confidence levels.

  • Clustering: The tool can perform K-Means clustering on the extracted data. It groups similar text elements together based on their coordinates.

  • Interactive 3D Visualization: apple_ocr offers an interactive 3D scatter plot using Plotly, displaying the clustered text elements. This visualization helps users gain insights into the distribution of text and text density.

Dependencies

The script relies on the following Python libraries: - Torch - NumPy - Pandas - Pillow - Scikit-learn - Plotly - Pyobjc

Usage

Here's how you can use apple_ocr:

  1. Installation: Install the required libraries, including Torch, NumPy, Pandas, Pillow, scikit-learn, and Plotly.

  2. Initialization: Create an instance of the OCR class, providing an image to be processed. ```python from apple_ocr.ocr import OCR from PIL import Image

image = Image.open("yourimage.png") ocrinstance = OCR(image=image) ```

  1. Text Recognition: Use the recognize method to perform text recognition. It will return a structured DataFrame containing recognized text, bounding box dimensions, text density, and centroid coordinates. python dataframe = ocr_instance.recognize()

  2. Clustering: Use the cluster method to perform K-Means clustering on the recognized text data. This method assigns cluster labels to each data point based on their coordinates. python cluster_labels = ocr_instance.cluster(dataframe, num_clusters=3)

  3. Visualization: Finally, use the scatter method to create an interactive 3D scatter plot. This plot visualizes the clustered text elements, including centroids, text density, and more. python ocr_instance.scatter()

Example

Here's an example of the entire process:

```python from apple_ocr.ocr import OCR from PIL import Image

image = Image.open("yourimage.png") ocrinstance = OCR(image=image) dataframe = ocrinstance.recognize() clusterlabels = ocrinstance.cluster(dataframe, numclusters=3) ocr_instance.scatter() ```

Citing this project

If you use this code in your research, please use the following BibTeX entry.

```BibTeX @misc{louisbrulenaudet2023, author = {Louis Brulé Naudet}, title = {Easy-to-Use Apple Vision wrapper for text extraction and clustering}, howpublished = {\url{https://github.com/louisbrulenaudet/apple-ocr}}, year = {2023} }

```

Feedback

If you have any feedback, please reach out at louisbrulenaudet@icloud.com.

Owner

  • Name: Louis Brulé Naudet
  • Login: louisbrulenaudet
  • Kind: user
  • Location: Paris
  • Company: Université Paris-Dauphine (Paris Sciences et Lettres - PSL)

Research in business taxation and development (NLP, LLM, Computer vision...), University Dauphine-PSL 📖 | Backed by the Microsoft for Startups Hub program

GitHub Events

Total
  • Issues event: 2
  • Watch event: 27
  • Fork event: 1
Last Year
  • Issues event: 2
  • Watch event: 27
  • Fork event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 8
  • Total Committers: 2
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.125
Past Year
  • Commits: 8
  • Committers: 2
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.125
Top Committers
Name Email Commits
Louis Brulé Naudet l****t@i****m 7
Shane Rogers s****e@r****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 minutes
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • EcosistemaISC (1)
  • jaydip-tss (1)
  • CesarLaimito (1)
Pull Request Authors
  • phoenixbox (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 116 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 9
  • Total maintainers: 1
pypi.org: apple-ocr

An OCR (Optical Character Recognition) utility for text extraction from images.

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 116 Last month
Rankings
Dependent packages count: 10.0%
Average: 37.8%
Dependent repos count: 65.7%
Maintainers (1)
Last synced: 6 months ago