deepflip
v1.0.0
Published
Detect document image orientation (0/90/180/270) with a text-patch EfficientNetV2 INT8 ONNX model
Maintainers
Readme
deepflip
Detect the orientation of document images (0°, 90°, 180°, 270°) and turn them upright.
It classifies the most text-heavy patches of a page at full resolution and averages their votes. The INT8 ONNX model is bundled.
Install
npm install deepflipRequires Node.js 20.9 or later.
Usage
import { OrientationDetector, correctImage } from 'deepflip';
const detector = await OrientationDetector.create();
const result = await detector.detectImage('scan.jpg');
console.log(result.label); // "Rotate 90° CW"
console.log(result.correction); // 90 (degrees clockwise to make it upright)
console.log(result.confidence); // 0.97
const upright = await correctImage('scan.jpg', result.correction);detectImage accepts a file path, Buffer or Uint8Array. For raw RGB pixels, use detector.detect({ data, width, height }).
License
MIT
