描述
圖片鑒黃, 一般使用阿里或者騰訊的oss服務的時候, 可以選擇圖片識別中的鑒黃功能, 但是只能檢測服務器上的數(shù)據(jù), 并且阿里的服務只能用于國內(nèi)節(jié)點, 騰訊的沒了解
圖片識別本就是比較常見的機器學習功能, 網(wǎng)上也有不上開源的訓練模型
NsfwImgDetector 集成了雅虎開源的訓練模型, 準確率高于99.9%以上, 對比github上一個只有17k的model, 精確度有了保證, 但是文件也比價大(23M), 會使app的安裝包增加 50M以上
NsfwImgDetector 是swift開發(fā)的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'