Giter VIP home page Giter VIP logo

evil's Introduction

Evil

Optical Character Recognition in Swift for iOS&macOS.


debug image

图片来自于网络,侵删

Requirements

  • iOS 11.0+ / macOS 10.13+
  • Xcode9.2+
  • Swift 4.0+

Installation

Basic Usage

Evil 使用 Vision 框架进行文字识别,因此你需要导入特定的MLModel到你的Xcode工程。例如识别身份证导入识别身份证的model,识别银行卡导入识别银行卡的model。

以下是目前已经训练好的模型

如何导入

首先从上面的地址下载或者自己训练得到模型文件(*.mlmodel),然后作为resource资源加入项目。但是模型文件size一般都比较大因此Evil还支持另外一种方式即:运行时从指定的服务器下载对应的模型。

  1. 获取对应的模型文件并重名命名为[name].mlmodel [name]可通过以下方法获取print(Recognizer.chineseIDCard.name)
  2. 将模型文件上传至自己的服务器或者CDN并获取下载链接
  3. info.plist 中配置下载链接如下

info.plist

初始化

lazy var evil = try? Evil(recognizer: .chineseIDCard)

或者 手动指定下载路径

let downloadURL = URL(string: "https://****/ChineseIDCard.mlmodel")!
let chineseIDCard = Recognizer.custom(name: "ChineseIDCard", model: downloadURL, needComplie: true, processor: Recognizer.cropChineseIDCardNumberArea)
let evil = try? Evil(recognizer: chineseIDCard)

或者直接将模型文件拖入 xcode 项目

let url = Bundle.main.url(forResource: "ChineseIDCard", withExtension: "mlmodelc")!
let evil = try? Evil(contentsOf: url, name: "ChineseIDCard")

注意Extension 为mlmodelc而不是mlmodel因为xcode会自动编译mlmodel文件,并且生成对应的class. 所以请务必注意Model文件不要和现有的class重名。

开始识别

let image: Recognizable = .....
let result = evil?.recognize(image)
print(result)

训练模型

参考Tools 目录下PrepareBot项目
参考博文掘金

交流讨论

1.github issue (推荐)
2.qq 群:641256202

LICENSE

 MIT

Copyright 2018 - 2019 Kevin.Gong aoxianglele#icloud.com

evil's People

Contributors

kevingong2013 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.