基于TensorFlow实现图片鉴黄

上传者: xixixixixixixi21 | 上传时间: 2022-05-09 21:03:28 | 文件大小: 7.19MB | 文件类型: ZIP
图片鉴黄主要思路是通过nsfw.tflite模型文件生成Interpreter,然后通过Interpreter获取python中定义的入口ByteBuffer的张量(Tensor),然后把要鉴别的文件做归一化处理,输入到ByteBuffer中,通过运行Interpreter获取结果即可,其流程如下图所示: image 2.2 实现步骤 2.2.1 添加依赖 在build.gradle中添加TensorFlow依赖: implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly' implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly' 2.2.2 拷贝训练模型文件 将resources目录下的nsfw.tflite文件拷贝到手机SD存储卡上。 2.2.3 加载训练模型文件 public void init() { File file = new File(Environment.getExternalStorageDirectory() +

文件下载

资源详情

[{"title":"( 49 个子文件 7.19MB ) 基于TensorFlow实现图片鉴黄","children":[{"title":"TensorFlowPornIdentifier-master","children":[{"title":"gradlew.bat <span style='color:#111;'> 2.21KB </span>","children":null,"spread":false},{"title":"gradlew <span style='color:#111;'> 5.17KB </span>","children":null,"spread":false},{"title":"show","children":[{"title":"show.png <span style='color:#111;'> 218.58KB </span>","children":null,"spread":false},{"title":"tensorflow_picture_porn_process.png <span style='color:#111;'> 26.46KB </span>","children":null,"spread":false}],"spread":true},{"title":"gradle.properties <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false},{"title":"resources","children":[{"title":"nsfw.tflite <span style='color:#111;'> 5.68MB </span>","children":null,"spread":false}],"spread":true},{"title":"app","children":[{"title":"proguard-rules.pro <span style='color:#111;'> 751B </span>","children":null,"spread":false},{"title":"src","children":[{"title":"test","children":[{"title":"java","children":[{"title":"com","children":[{"title":"sty","children":[{"title":"tensorflow","children":[{"title":"pornidentifier","children":[{"title":"ExampleUnitTest.java <span style='color:#111;'> 394B </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":"androidTest","children":[{"title":"java","children":[{"title":"com","children":[{"title":"sty","children":[{"title":"tensorflow","children":[{"title":"pornidentifier","children":[{"title":"ExampleInstrumentedTest.java <span style='color:#111;'> 782B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":"main","children":[{"title":"res","children":[{"title":"mipmap-xxxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 8.91KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 14.78KB </span>","children":null,"spread":false}],"spread":true},{"title":"drawable","children":[{"title":"nsfw_test_17.jpeg <span style='color:#111;'> 34.11KB </span>","children":null,"spread":false},{"title":"nsfw_test_15.jpg <span style='color:#111;'> 110.14KB </span>","children":null,"spread":false},{"title":"nsfw_test_50.jpg <span style='color:#111;'> 68.37KB </span>","children":null,"spread":false},{"title":"nsfw01.jpg <span style='color:#111;'> 33.05KB </span>","children":null,"spread":false},{"title":"nsfw_test_16.jpeg <span style='color:#111;'> 105.00KB </span>","children":null,"spread":false},{"title":"nsfw_test_02.png <span style='color:#111;'> 1.92MB </span>","children":null,"spread":false},{"title":"nsfw_test_10.jpeg <span style='color:#111;'> 208.94KB </span>","children":null,"spread":false},{"title":"nsfw_test_05.jpg <span style='color:#111;'> 266.99KB </span>","children":null,"spread":false},{"title":"timg.jpg <span style='color:#111;'> 223.29KB </span>","children":null,"spread":false},{"title":"ic_launcher_background.xml <span style='color:#111;'> 5.47KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-hdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.89KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 4.79KB </span>","children":null,"spread":false}],"spread":false},{"title":"drawable-v24","children":[{"title":"ic_launcher_foreground.xml <span style='color:#111;'> 1.84KB </span>","children":null,"spread":false}],"spread":false},{"title":"values","children":[{"title":"colors.xml <span style='color:#111;'> 208B </span>","children":null,"spread":false},{"title":"strings.xml <span style='color:#111;'> 87B </span>","children":null,"spread":false},{"title":"styles.xml <span style='color:#111;'> 383B </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 6.24KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 10.17KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-mdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.01KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 2.72KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 4.38KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 6.73KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-anydpi-v26","children":[{"title":"ic_launcher_round.xml <span style='color:#111;'> 272B </span>","children":null,"spread":false},{"title":"ic_launcher.xml <span style='color:#111;'> 272B </span>","children":null,"spread":false}],"spread":false},{"title":"layout","children":[{"title":"activity_main.xml <span style='color:#111;'> 720B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"java","children":[{"title":"com","children":[{"title":"sty","children":[{"title":"tensorflow","children":[{"title":"pornidentifier","children":[{"title":"MainActivity.java <span style='color:#111;'> 2.94KB </span>","children":null,"spread":false},{"title":"utils","children":[{"title":"PermissionUtils.java <span style='color:#111;'> 5.44KB </span>","children":null,"spread":false},{"title":"ToastUtil.java <span style='color:#111;'> 723B </span>","children":null,"spread":false}],"spread":false},{"title":"PornManager.java <span style='color:#111;'> 3.10KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":"AndroidManifest.xml <span style='color:#111;'> 886B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false}],"spread":true},{"title":"gradle","children":[{"title":"wrapper","children":[{"title":"gradle-wrapper.jar <span style='color:#111;'> 53.06KB </span>","children":null,"spread":false},{"title":"gradle-wrapper.properties <span style='color:#111;'> 232B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".gitignore <span style='color:#111;'> 215B </span>","children":null,"spread":false},{"title":"README.md <span style='color:#111;'> 4.15KB </span>","children":null,"spread":false},{"title":"settings.gradle <span style='color:#111;'> 59B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 558B </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明