All Projects → devzwy → Open_nsfw_android

devzwy / Open_nsfw_android

Licence: apache-2.0
🔥🔥🔥色情图片离线识别,基于TensorFlow实现。识别只需20ms,可断网测试,成功率99%,调用只要一行代码,从雅虎的开源项目open_nsfw移植,该模型文件可用于iOS、java、C++等平台

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Open nsfw android

TensorFlow-Binary-Image-Classification-using-CNN-s
Binary Image Classification in TensorFlow
Stars: ✭ 26 (-98.36%)
Mutual labels:  tensorflow-models, tensorflow-examples, tensorflow-gpu
Age-Gender Estimation TF-Android
Age + Gender Estimation on Android with TensorFlow Lite
Stars: ✭ 34 (-97.86%)
Mutual labels:  tensorflow-models, tensorflow-examples, tensorflow-lite
TPU-MobilenetSSD
Edge TPU Accelerator / Multi-TPU + MobileNet-SSD v2 + Python + Async + LattePandaAlpha/RaspberryPi3/LaptopPC
Stars: ✭ 82 (-94.83%)
Mutual labels:  tensorflowlite, tensorflow-lite
face-detection-tflite
Face and iris detection for Python based on MediaPipe
Stars: ✭ 78 (-95.08%)
Mutual labels:  tensorflow-models, tensorflow-lite
Tensorflow-Wide-Deep-Local-Prediction
This project demonstrates how to run and save predictions locally using exported tensorflow estimator model
Stars: ✭ 28 (-98.23%)
Mutual labels:  tensorflow-models, tensorflow-examples
Androidtensorflowmachinelearningexample
Android TensorFlow MachineLearning Example (Building TensorFlow for Android)
Stars: ✭ 1,369 (-13.68%)
Mutual labels:  tensorflow-models, tensorflow-examples
content-moderation-image-api
An NSFW Image Classification REST API for effortless Content Moderation built with Node.js, Tensorflow, and Parse Server
Stars: ✭ 50 (-96.85%)
Mutual labels:  nsfw, tensorflow-examples
TensorFlow Lite SSD RPi 64-bits
TensorFlow Lite SSD on bare Raspberry Pi 4 with 64-bit OS at 24 FPS
Stars: ✭ 25 (-98.42%)
Mutual labels:  tensorflow-examples, tensorflow-lite
Tensorflow-lite-kotlin-samples
📌This repo contains the kotlin implementation of TensorflowLite Example Android Apps🚀
Stars: ✭ 17 (-98.93%)
Mutual labels:  tensorflow-examples, tensorflow-lite
Tf Object Detection
Simpler app for tensorflow object detection API
Stars: ✭ 91 (-94.26%)
Mutual labels:  tensorflow-models, tensorflow-examples
Free Tensorflow
Tensorflow 免费中文视频教程,开源代码,免费书籍.
Stars: ✭ 83 (-94.77%)
Mutual labels:  tensorflow-models, tensorflow-examples
Letslearnai.github.io
Lets Learn AI
Stars: ✭ 33 (-97.92%)
Mutual labels:  tensorflow-models, tensorflow-examples
Neural-Turing-Machine
TensorFlow implementation of a Neural Turing Machine
Stars: ✭ 23 (-98.55%)
Mutual labels:  tensorflow-models, tensorflow-examples
gans-2.0
Generative Adversarial Networks in TensorFlow 2.0
Stars: ✭ 76 (-95.21%)
Mutual labels:  tensorflow-models, tensorflow-examples
TensorFlow-Multiclass-Image-Classification-using-CNN-s
Balanced Multiclass Image Classification with TensorFlow on Python.
Stars: ✭ 57 (-96.41%)
Mutual labels:  tensorflow-models, tensorflow-gpu
Awesome-Tensorflow2
基于Tensorflow2开发的优秀扩展包及项目
Stars: ✭ 45 (-97.16%)
Mutual labels:  tensorflow-models, tensorflow-examples
Nsfw data scraper
Collection of scripts to aggregate image data for the purposes of training an NSFW Image Classifier
Stars: ✭ 11,429 (+620.62%)
Mutual labels:  nsfw, pornography
Android-Machine-Learning-With-TensorFlow
Tensor Flow implementation for Android
Stars: ✭ 17 (-98.93%)
Mutual labels:  tensorflow-models, tensorflow-examples
Cppflow
Run TensorFlow models in C++ without installation and without Bazel
Stars: ✭ 357 (-77.49%)
Mutual labels:  tensorflow-models, tensorflow-examples
Math object detection
An image recognition/object detection model that detects handwritten digits and simple math operators. The output of the predicted objects (numbers & math operators) is then evaluated and solved.
Stars: ✭ 52 (-96.72%)
Mutual labels:  tensorflow-models, tensorflow-examples

open_nsfw_android

Plugin on redmine.org

色情图片离线识别,基于TensorFlow实现。识别只需20ms,可断网测试,成功率99%,调用只要一行代码,从雅虎的开源项目open_nsfw移植,该模型文件可用于iOS、java、C++等平台

⚠️⚠️⚠️ 已从jCenter仓库迁移到Maven,原引用地址发生变更,建议所有老用户升级到新版本。新版本需要手动下载nsfw.tflite模型初始化使用

iOS请参考:issues13

Python参考:NSFW-PythonPython-TensorflowLite-ApiPython-Tensorflow-Api

Java参考:Tensorflow-Api

C++参考:TensorflowLite-Api

JavaScript参考JS相关文档

其中Python、C++均有两种数据喂入的方式,可根据需求选择pb模型或tfLite文件,详细请参考上面的链接.Java的目前只能加载pb模型。其他的平台可自行百度

本项目移除测试图片,请下载Demo后自行配图测试

测试图片

图片

开始使用

  • 🔥 下载模型文件,并放入assets目录下 图片

  • 🔥 开启tflite文件读取支持(解决模型放在assets目录下无法读取的问题。如果模型不放在assets目录下可跳过该步骤)

android {

    ...

    aaptOptions {
        noCompress "tflite"
    }
}
  • 🔥 引入依赖
    dependencies {
        ...
        implementation 'io.github.devzwy:nsfw:1.5.1'
    }

  • 🔥 初始化(建议在Application中进行)
    class KtApp : Application() {
        override fun onCreate() {
            super.onCreate()

            //开启日志输出,可选
            NSFWHelper.openDebugLog()

            //扫描前必须初始化
            NSFWHelper.initHelper(
                context = this)

            //初始化api原型
            /* NSFW初始化函数 内部日志默认关闭,调试环境可使用openDebugLog()开启日志*/
            fun initHelper(
                context: Context, //建议传入application,传入activity可能会有内存泄漏
                modelPath: String? = null,//模型文件路径,为空时将默认从Assets下读取
                isOpenGPU: Boolean = true, //是否开启GPU扫描加速,部分机型兼容不友好的可关闭。默认开启
                numThreads: Int = 4 //扫描数据时内部分配的线程 默认4
            )

        }
    }
  • 🔥 支持的api列表 带返回值的为同步,传入函数的为异步:

同步识别文件: NSFWHelper.getNSFWScore(file: File): NSFWScoreBean

异步识别文件: getNSFWScore(file: File, onResult: ((NSFWScoreBean) -> Unit))

同步识别文件: getNSFWScore(filePath: String): NSFWScoreBean

异步识别文件: getNSFWScore(filePath: String, onResult: ((NSFWScoreBean) -> Unit))

同步识别bitmap: getNSFWScore(bitmap: Bitmap): NSFWScoreBean

异步识别bitmap: getNSFWScore(bitmap: Bitmap, onResult: ((NSFWScoreBean) -> Unit))

  • 🔥 识别结果说明
    NSFWScoreBean.sfw   ... 非涉黄数值 数值越大约安全
    NSFWScoreBean.nsfw   ... 涉黄数值  数值越大约危险
    NSFWScoreBean.timeConsumingToLoadData  ... 装载数据耗时  单位ms
    NSFWScoreBean.timeConsumingToScanData  ... 扫描图片耗时  单位ms
  • 🔥 调用参考
    //异步方式
    NSFWHelper.getNSFWScore(item.bitmap) {
        this.text =
            "nsfw:${it.nsfwScore}\nsfw:${it.sfwScore}\n扫描耗时:${it.timeConsumingToScanData} ms"
        if (it.nsfwScore > 0.7) {
            this.setBackgroundColor(Color.parseColor("#C1FF0000"))
        } else if (it.nsfwScore > 0.5) {
            this.setBackgroundColor(Color.parseColor("#C1FF9800"))
        } else {
            this.setBackgroundColor(Color.parseColor("#803700B3"))
        }
    }

    //同步方式
    NSFWHelper.getNSFWScore(item.bitmap).let {
        this.text =
            "nsfw:${it.nsfwScore}\nsfw:${it.sfwScore}\n扫描耗时:${it.timeConsumingToScanData} ms"
        if (it.nsfwScore > 0.7) {
            this.setBackgroundColor(Color.parseColor("#C1FF0000"))
        } else if (it.nsfwScore > 0.5) {
            this.setBackgroundColor(Color.parseColor("#C1FF9800"))
        } else {
            this.setBackgroundColor(Color.parseColor("#803700B3"))
        }
    }

🔥 安卓手机直接点我安装

🔥 扫码下载

图片

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].