Downloads · 30 days
11
14% of all-time downloads
shifaazzz/mobilenet-v2-custom
mobilenet-v2-custom is a image classification model from shifaazzz. Use it when you need a label for an image. It is set up for keras. The card lists the license as apache-2.0.
This is a custom MobileNetV3-based model trained for image classification using TensorFlow/Keras.
Downloads · 30 days
11
14% of all-time downloads
All-time downloads
78
Public
Repo size
19.6 MB
Likes
0
Public
Click a slice to open those files.
.h519.6 MB · 100%
From the Hugging Face model README
This is a custom MobileNetV3-based model trained for image classification using TensorFlow/Keras.
import tensorflow as tf
from huggingface_hub import hf_hub_download
import numpy as np
from PIL import Image
# Download the model
model_path = hf_hub_download(
repo_id="shifaazzz/mobilenet-v2-custom",
filename="model.h5"
)
# Load the model
model = tf.keras.models.load_model(model_path, compile=False)
# Recompile if needed
model.compile(
optimizer='adam',
loss='categorical_crossentropy',
metrics=['accuracy']
)
# Load and preprocess an image
img = Image.open("your_image.jpg").resize((224, 224))
img_array = np.array(img) / 255.0 # Normalize
img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
# Make prediction
predictions = model.predict(img_array)
predicted_class = np.argmax(predictions[0])
confidence = predictions[0][predicted_class]
print(f"Predicted Class: {predicted_class}")
print(f"Confidence: {confidence:.2%}")
If you encounter loading errors, try:
# Load without compilation
model = tf.keras.models.load_model(model_path, compile=False)
Or check the LOADING_INSTRUCTIONS.md file in this repository for more details.
model.h5 - The trained model (recommended)saved_model/ - TensorFlow SavedModel format (if available)model_weights.h5 - Model weights only (if available)model_architecture.json - Model architecture in JSON format (if available)config.json - Model configurationrequirements.txt - Python dependencies[Add details about your training process, dataset, epochs, etc.]
[Add your model's accuracy, loss, validation metrics, etc.]
[List your class names here, e.g.:]
0: Class_Name_0
1: Class_Name_1
2: Class_Name_2
...
If you use this model, please cite appropriately.