Keras
English
tensorflow
computer-vision
classroom-detection
background-validation
smart-attendance
mobilenetv1
Instructions to use prathamrajbhar/smart-attendance-background-validation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use prathamrajbhar/smart-attendance-background-validation with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://prathamrajbhar/smart-attendance-background-validation") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- tensorflow
|
| 6 |
+
- keras
|
| 7 |
+
- computer-vision
|
| 8 |
+
- classroom-detection
|
| 9 |
+
- background-validation
|
| 10 |
+
- smart-attendance
|
| 11 |
+
- mobilenetv1
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Smart Attendance - Background Validation Model
|
| 15 |
+
|
| 16 |
+
This repository contains the background validation model used in the **Smart Attendance System**. It is designed to verify the background context of an attendance submission to ensure the check-in occurs within a valid classroom setting, preventing spoofing attempts where users check in from home, dorm rooms, or external environments.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
- **Architecture**: MobileNetV1 base with classification head.
|
| 20 |
+
- **Task**: Context/Background Verification
|
| 21 |
+
- **Input Shape**: `(224, 224, 3)`
|
| 22 |
+
- **Preprocessing**:
|
| 23 |
+
- Image resized to `(224, 224)`.
|
| 24 |
+
- Preprocessed using standard MobileNet preprocessing (`tensorflow.keras.applications.mobilenet.preprocess_input`).
|
| 25 |
+
- **Output**: Softmax/classification score representing class probabilities of the background environment.
|
| 26 |
+
|
| 27 |
+
## How to Use
|
| 28 |
+
To load and run inference in Python:
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
import cv2
|
| 32 |
+
import numpy as np
|
| 33 |
+
import tensorflow as tf
|
| 34 |
+
from tensorflow.keras.applications.mobilenet import preprocess_input
|
| 35 |
+
|
| 36 |
+
# Load the model
|
| 37 |
+
model = tf.keras.models.load_model("background_mobilenet_v1.h5")
|
| 38 |
+
|
| 39 |
+
# Preprocessing
|
| 40 |
+
def preprocess_background(img_crop: np.ndarray) -> np.ndarray:
|
| 41 |
+
img_resized = cv2.resize(img_crop, (224, 224))
|
| 42 |
+
img_batch = np.expand_dims(img_resized, axis=0)
|
| 43 |
+
return preprocess_input(img_batch.astype(np.float32))
|
| 44 |
+
|
| 45 |
+
# Run inference
|
| 46 |
+
input_tensor = preprocess_background(image)
|
| 47 |
+
prediction = model.predict(input_tensor)
|
| 48 |
+
```
|