2026-08-24 · 4 min read

Neural OCR on Mobile Devices: CRAFT, CRNN, EasyOCR and ExecuTorch

Optical character recognition (OCR) has moved from traditional image filters to deep neural networks. In mobile apps, a two-stage pipeline is now standard: a detector finds the text locations, and a recognizer reads the characters. EasyOCR popularized this pattern, and the same architecture can be brought to the device itself. This article explains how CRAFT and CRNN work together, which image size limits appear on smartphones, and how to port the EasyOCR approach to mobile through ExecuTorch.

CRAFT and CRNN: the typical neural pair

CRAFT stands for Character Region Awareness for Text Detection. It predicts a character region map and an affinity map. The first map tells where individual character centers are located; the second map tells whether neighboring characters belong to the same word or line. This character-level design handles rotated, curved and dense text better than a conventional object detector because it does not depend on predefined anchor boxes.

Once the text region has been extracted, a CRNN, or Convolutional Recurrent Neural Network, recognizes the content. A convolutional backbone such as VGG or ResNet converts the crop into feature maps. Those features are then processed by a bidirectional LSTM, which sees the sequence in both directions. A CTC decoder turns the network output into a character sequence without requiring exact per-character alignment. This is a compact but effective way of reading short text fields on a phone.

Image size limits and mobile constraints

Mobile devices have limited RAM, no steady power supply, and a tight thermal budget. A full-resolution photo cannot be fed directly into CRAFT because the intermediate tensors become too large. Most mobile OCR implementations therefore restrict the input image to a fixed maximum side, for example 512, 768, or 960 pixels. The image is resized while keeping the aspect ratio, and the remaining space is padded with zeros.

A second constraint comes from the inference runtime. ExecuTorch often requires fixed tensor shapes because operators are compiled ahead of time for a known shape. If the developer changes the input width and height, the model must be re-exported. That is why CRAFT is usually exported with a fixed square profile, such as 1*3*768*768, while CRNN uses fixed-height crops, with a width of 32 pixels and a height that is kept as a fixed value such as 128, 256, or 512.

The most practical way to limit image size is to add a lightweight preprocessing step. This detector can be as simple as a contour finder, which identifies candidate text regions without running the full neural OCR. The heavy CRAFT and CRNN models then receive only small crops, which reduces latency and memory usage dramatically.

Porting the EasyOCR approach to ExecuTorch

EasyOCR is a Python library that uses CRAFT as the default text detector and trains lightweight recognizers that are close to a CRNN design. Its modular structure is easy to adapt for mobile deployment. The first step is to export both models from PyTorch into the format used by ExecuTorch. Because ExecuTorch is the native PyTorch runtime, no conversion to ONNX or TFLite is required, which avoids numerical mismatches and preserves the standard rewrite code.

The exported CRAFT model is given a fixed input size and a quantized version is built. Quantization converts the weights to float16 or int8, the model size and accelerating the computation on mobile neural processors. For the recognizer, developers can export several versions of CRNN, each with different fixed widths. That way, the app can select 128, 256, or 512 pixels depending on the detected text length.

The mobile app then handles the remaining work: resizing the camera frame, padding it to the fixed shape, running CRAFT, decoding its heatmaps into boxes, extracting the text boxes not an exact, and feeding those crops into CRNN. The result is a fully offline OCR experience with lower latency than a cloud call and complete protection of the user's privacy.

Comparison of the two model roles in a mobile OCR pipeline
AspectCRAFTCRNN
RoleText detectionText recognition
OutputCharacter maps + affinityCharacter sequence
Input used on mobileFixed square profileFixed width, variable height
Main costHighModerate on small crops
← Scroll right to see more →

In short, CRAFT and CRNN remain a solid reference design for text extraction from photos. Mobile deployment is challenged by fixed shapes, image size limit and thermal power. However, combining ExecuTorch with small preprocessing and quantization leaves a pragmatic and efficient solution for running OCR entirely on a smartphone.

Let's work together

Do you need more info, help with your project, or to develop an idea?

Whether it's an easy question, a quick doubt, or just a 5-minute chat, send me a message—it costs nothing and I'm always ready to help. I love discussing a problem to understand it, getting creative with solutions, and focusing on simple, reliable, and straightforward ideas that we can actuate quickly.

Contact me

Switch Topic

Choose a specialized topic to explore: