Science Score: 57.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: MohammadMahdiHassani
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 1.72 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 10 months ago · Last pushed 10 months ago
Metadata Files
Readme Funding License Citation

README.md

DTrOCR

logo Python application CodeQL Python Versions License GitHub stars

A PyTorch implementation of DTrOCR: Decoder-only Transformer for Optical Character Recognition.

[!NOTE]

The authors of this repository are not affiliated with the author of the DTrOCR paper. This implementation is independently developed, relying solely on the publicly available descriptions of the DTrOCR model architecture and its training methodologies, with a specific focus on printed and handwritten words.

Due to the project's inception as a personal endeavor with limited resources, the pre-trained weights for the model are not presently accessible. However, there is an ongoing commitment to pre-train the model and subsequently release the weights to the public. For detailed insights into the project's development and future milestones, please refer to the project roadmap.

The table below outlines the principal distinctions between the implementation described in the original paper and the current implementation.

| | Original implementation | Current implementation | |-------------------------------------------------------------| ---------------------------- |------------------------| | Maximum token length
(including 128 image patch tokens)| 512 | 256 | | Supported language(s) | English & Chinese | English | | Pre-training corpus (planned) | Scene, printed & handwritten | Printed & handwritten |

Installation

shell git clone https://github.com/arvindrajan92/DTrOCR cd DTrOCR pip install -r requirements.txt

Usage

```python from dtrocr.config import DTrOCRConfig from dtrocr.model import DTrOCRLMHeadModel from dtrocr.processor import DTrOCRProcessor

from PIL import Image

config = DTrOCRConfig() model = DTrOCRLMHeadModel(config) processor = DTrOCRProcessor(DTrOCRConfig())

model.eval() # set model to evaluation mode for deterministic behaviour pathtoimage = "" # path to image file

inputs = processor( images=Image.open(pathtoimage).convert('RGB'), texts=processor.tokeniser.bostoken, returntensors="pt" )

modeloutput = model.generate( inputs=inputs, processor=processor, numbeams=3, # defaults to 1 if not specified use_cache=True # defaults to True if not specified )

predictedtext = processor.tokeniser.decode(modeloutput[0], skipspecialtokens=True) ```

Acknowledgments

This project builds upon the original work presented in DTrOCR: Decoder-only Transformer for Optical Character Recognition, authored by Masato Fujitake. We extend our gratitude for their significant contributions to the field.

Additionally, we leverage the GPT-2 and Vision Transformer (ViT) models developed by Hugging Face, which have been instrumental in advancing our project's capabilities. Our sincere thanks go to the Hugging Face team for making such powerful tools accessible to the broader research community.

Owner

  • Name: Mohammad Mahdi Hassani
  • Login: MohammadMahdiHassani
  • Kind: user
  • Location: Tehran,Iran
  • Company: AmirKabir University Of Technology

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite using metadata below."
authors:
- family-names: "Rajan"
  given-names: "Arvind"
  orcid: "https://orcid.org/0000-0003-4829-5007"
title: "A PyTorch implementation of DTrOCR: Decoder-only Transformer for Optical Character Recognition"
repository-code: 'https://github.com/arvindrajan92/DTrOCR'
date-released: 2024-07-13
license: MIT

GitHub Events

Total
  • Push event: 5
  • Create event: 2
Last Year
  • Push event: 5
  • Create event: 2

Dependencies

.github/workflows/greetings.yml actions
  • actions/first-interaction v1 composite
.github/workflows/python-app.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/stale.yml actions
  • actions/stale v9 composite
requirements.txt pypi
  • Pillow ==10.4.0
  • torch ==2.3.1
  • transformers ==4.48.0