← all repositories
evilgix/Evil

OCR for Chinese bureaucracy: the ML model you didn't know you needed

A Swift wrapper that downloads Core ML models on demand to scan Chinese ID cards and bank cards without bloating your app bundle.

Evil
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does Evil is a thin Swift layer over Apple’s Vision framework that performs OCR on specific document types—currently Chinese second-generation ID cards and bank cards. You initialize a Recognizer, feed it an image conforming to the Recognizable protocol, and get back extracted text. The project also includes a PrepareBot tool in the Tools directory for training your own Core ML models.

The interesting bit The real trick is model delivery. Core ML models are bulky, so Evil lets you ship without them: it downloads and compiles .mlmodel files at runtime from a URL you configure in Info.plist, or you can drag a pre-compiled .mlmodelc into Xcode if you prefer the old-fashioned way. The README warns, sensibly, not to let your model filename collide with existing Swift classes—Xcode’s automatic code generation will step on your toes.

Key highlights

  • Targets iOS 11+ and macOS 10.13+, built with Swift 4 and Xcode 9.2 era tooling
  • Supports CocoaPods and Carthage
  • Provides a pre-trained Chinese ID card model (~linked from a third-party CDN, not hosted in the repo itself)
  • Includes PrepareBot for custom model training with Keras/TensorFlow workflows
  • Runtime model compilation via needComplie: true flag (note the charming typo)

Caveats

  • The README’s English is sparse; most usage detail and community discussion is in Chinese (QQ group provided)
  • Only one pre-trained model is actually linked; bank card and door-plate models are mentioned in the description but not supplied
  • The debug screenshot and logo are the only visual assets; no sample output or accuracy metrics are shown

Verdict Grab this if you’re building a Chinese-market app that needs ID verification and you want to avoid shipping a 50MB neural net to every user. Skip it if you need general-purpose OCR or if runtime model downloads feel too fragile for your compliance requirements.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.