Instructions to use floflo2148/Screenshot_detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use floflo2148/Screenshot_detector with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://floflo2148/Screenshot_detector") - Notebooks
- Google Colab
- Kaggle
Screenshot classifier
A lightweight binary classifier for screenshot detection.
Model
mobilenetv3_small_screenshot.kerasโ trained Keras model for screenshot / not_screenshot classification
Usage
import tensorflow as tf
from tensorflow import keras
model = keras.models.load_model("mobilenetv3_small_screenshot.keras")
# Example inference
img = keras.utils.load_img("image.png", target_size=(224, 224))
arr = keras.utils.img_to_array(img)
arr = tf.keras.applications.mobilenet_v3.preprocess_input(arr)
arr = arr[None, ...]
pred = model.predict(arr)
score = float(pred[0, 0])
label = "screenshot" if score >= 0.5 else "not_screenshot"
print(label, score)
Input format
- RGB images
- resized to
224x224 - model expects a single sigmoid score
Prediction threshold
score >= 0.5โscreenshotscore < 0.5โnot_screenshot
Notes
- Model backbone:
MobileNetV3Smallpretrained on ImageNet - Output activation:
sigmoid - Loss used during training:
binary_crossentropy
- Downloads last month
- 9