GantMan / nsfw_model

Keras model of NSFW detector
Other
1.67k stars 267 forks source link

Tflite - android studio #151

Open Eyal-Elbaz opened 5 months ago

Eyal-Elbaz commented 5 months ago

Hi, I imported the tflite file in that last release using file > new > other > tflite model in android studio. an got this:

val model = NsfwModel.newInstance(context)

// Creates inputs for reference.
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 224, 224, 3), DataType.FLOAT32)
inputFeature0.loadBuffer(byteBuffer)

// Runs model inference and gets result.
val outputs = model.process(inputFeature0)
val outputFeature0 = outputs.outputFeature0AsTensorBuffer

// Releases model resources if no longer used.
model.close()

I assume that the order is: drawings - outputFeature0.getFloatValue(0) hentai - 1 neutral- 2 porn- 3 sexy- 4 And anyway I get first one to be the biggest on sfw and nsfw photos