美文网首页
图片鉴黄 图片识别 nsfw ios framework

图片鉴黄 图片识别 nsfw ios framework

作者: iloverain | 来源:发表于2020-07-27 15:38 被阅读0次

    描述

    图片鉴黄, 一般使用阿里或者腾讯的oss服务的时候, 可以选择图片识别中的鉴黄功能, 但是只能检测服务器上的数据, 并且阿里的服务只能用于国内节点, 腾讯的没了解

    图片识别本就是比较常见的机器学习功能, 网上也有不上开源的训练模型

    NsfwImgDetector 集成了雅虎开源的训练模型, 准确率高于99.9%以上, 对比github上一个只有17k的model, 精确度有了保证, 但是文件也比价大(23M), 会使app的安装包增加 50M以上

    NsfwImgDetector 是swift开发的iOS framework

    使用方法

    @available(iOS 11.0, *)
    func filter(image:UIImage) {
    
     let detector = NsfwImgDetector()
    ​
     detector.check(image: image) { (isNoSafe, confidence) in
         print("isNoSafe:\(isNoSafe) confidence:\(confidence)")
         f isNoSafe == false {
         //safe
         }else if (confidence > 0.9) {
         // porn
         }else if (confidence > 0.5) {
         // sexy picture, may little porn
        }else {
        // sexy picture
        }
     }
    }
    

    安装

    NsfwImgDetector is available through CocoaPods. To install it, simply add the following line to your Podfile:

    pod 'NsfwImgDetector'
    

    github链接
    https://github.com/Zhulmin/NsfwImgDetector

    相关文章

      网友评论

          本文标题:图片鉴黄 图片识别 nsfw ios framework

          本文链接:https://www.haomeiwen.com/subject/crvzlktx.html