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
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +48 -0
- mobilenetv3_small_screenshot.keras +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
mobilenetv3_small_screenshot.keras filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Screenshot classifier
|
| 2 |
+
|
| 3 |
+
A lightweight binary classifier for screenshot detection.
|
| 4 |
+
|
| 5 |
+
## Model
|
| 6 |
+
|
| 7 |
+
- `mobilenetv3_small_binary.keras` — trained Keras model for screenshot / not_screenshot classification
|
| 8 |
+
|
| 9 |
+
## Usage
|
| 10 |
+
|
| 11 |
+
```python
|
| 12 |
+
import tensorflow as tf
|
| 13 |
+
from tensorflow import keras
|
| 14 |
+
|
| 15 |
+
model = keras.models.load_model("mobilenetv3_small_binary.keras")
|
| 16 |
+
|
| 17 |
+
# Example inference
|
| 18 |
+
img = keras.utils.load_img("image.png", target_size=(224, 224))
|
| 19 |
+
arr = keras.utils.img_to_array(img)
|
| 20 |
+
arr = tf.keras.applications.mobilenet_v3.preprocess_input(arr)
|
| 21 |
+
arr = arr[None, ...]
|
| 22 |
+
pred = model.predict(arr)
|
| 23 |
+
score = float(pred[0, 0])
|
| 24 |
+
label = "screenshot" if score >= 0.5 else "not_screenshot"
|
| 25 |
+
print(label, score)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Input format
|
| 29 |
+
|
| 30 |
+
- RGB images
|
| 31 |
+
- resized to `224x224`
|
| 32 |
+
- model expects a single sigmoid score
|
| 33 |
+
|
| 34 |
+
## Prediction threshold
|
| 35 |
+
|
| 36 |
+
- `score >= 0.5` → `screenshot`
|
| 37 |
+
- `score < 0.5` → `not_screenshot`
|
| 38 |
+
|
| 39 |
+
## Notes
|
| 40 |
+
|
| 41 |
+
- Model backbone: `MobileNetV3Small` pretrained on ImageNet
|
| 42 |
+
- Output activation: `sigmoid`
|
| 43 |
+
- Loss used during training: `binary_crossentropy`
|
| 44 |
+
|
| 45 |
+
## File contents
|
| 46 |
+
|
| 47 |
+
- `mobilenetv3_small_binary.keras`
|
| 48 |
+
- `README.md`
|
mobilenetv3_small_screenshot.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e1c02d8c89127caafde70004d33c9b1c0bb303605ddc1fbe5041ef8c4f3fa8f
|
| 3 |
+
size 7157780
|