open_nsfw_android
其中Python、C++均有两种数据喂入的方式,可根据需求选择pb模型或tfLite文件,详细请参考上面的链接.Java的目前只能加载pb模型。其他的平台可自行百度
Add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
Add the dependency
dependencies { //versionCode:上面小icon中最新版本号 implementation 'com.github.devzwy:open_nsfw_android:[versionCode]' }
扫描时报如下错误
java.lang.NullPointerException: Attempt to invoke virtual method 'com.zwy.nsfw.api.NsfwBean com.zwy.nsfw.Classifier.run(android.graphics.Bitmap)' on a null object reference
请添加
android { ... aaptOptions { noCompress "tflite" } }
使用
val nsfwHelper = NSFWHelper.init(NSFWConfig(assets)) val nsfwBean = nsfwHelper?.scanBitmap(bitmap)!! nsfwBean.sfw nsfwBean.nsfw if(nsfwBean.nsfw>0.3){ Log.e("NSFW","图片涉黄") }
kotlin可直接使用File.getNsfwScore(mAssetManager: AssetManager): NsfwBean 或 Bitmap.getNsfwScore(mAssetManager: AssetManager): NsfwBean 直接获取鉴定结果(NSFWHelper 1.2.9版本开始支持),比如:
val bitmap = BitmapFactory.decodeFile(path) val nsfwScore = bitmap.getNsfwScore(assets) if(nsfwBean.nsfw>0.3){ Log.e("NSFW","图片涉黄") }
或
val file = File(lm.path) val nsfwScore = file.getNsfwScore(assets) if(nsfwBean.nsfw>0.3){ Log.e("NSFW","图片涉黄") }
上一篇:xuebaoWeb
下一篇:tensorflow-open_nsfw
还没有评论,说两句吧!
热门资源
TensorFlow-Course
This repository aims to provide simple and read...
seetafaceJNI
项目介绍 基于中科院seetaface2进行封装的JAVA...
mxnet_VanillaCNN
This is a mxnet implementation of the Vanilla C...
DuReader_QANet_BiDAF
Machine Reading Comprehension on DuReader Usin...
Klukshu-Sockeye-...
KLUKSHU SOCKEYE PROJECTS 2016 This repositor...
智能在线
400-630-6780
聆听.建议反馈
E-mail: support@tusaishared.com