Downloads · 30 days
11
9% of all-time downloads
louiecerv/cats_dogs_recognition_tf_nn
cats_dogs_recognition_tf_nn is a image classification model from louiecerv. Use it when you need a label for an image. It is set up for keras. The card lists the license as mit.
- Developed by: Louie F. Cervantes - Model type: TensorFlow-based Neural Network for image classification - Model Architecture: - Flatten layer (input shape: 128x128x3) - Dense layer (512 units, ReLU activation) - Den…
Downloads · 30 days
11
9% of all-time downloads
All-time downloads
126
Public
Repo size
509 MB
Likes
0
Public
Click a slice to open those files.
.keras305 MB · 60%
From the Hugging Face model README
This model is intended to be used for classifying images of cats and dogs. Given an input image, the model outputs the probability that the image belongs to each class (cat or dog).
The model can be potentially finetuned for other image classification tasks, especially those involving similar image characteristics or domains.
The model may not perform well on images significantly different from the training data (e.g., different animal species, objects other than cats/dogs, images with unusual lighting or angles). It's not intended for safety-critical applications.
The model's performance may vary depending on the characteristics of the input images, such as the breed, pose, and lighting of the animals. It might be biased towards features that are more prevalent in the training dataset.
Misclassification of images can occur, especially when the input image is ambiguous or different from the training data distribution.
Users should be aware of the potential biases and limitations of the model. It is recommended to evaluate the model's performance thoroughly on a representative test set before deploying it in any application.
Use the code below to get started with the model.
from tensorflow import keras
from PIL import Image
import numpy as np
# Load the model
model = keras.models.load_model('cats_dogs_recognition_tf_nn')
# Preprocess the image
def preprocess_image(image_path):
img = Image.open(image_path)
img = img.resize((128, 128))
img_array = np.array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
return img_array
# Make a prediction
image_path = 'path/to/your/image.jpg' # Replace with the path to your image
processed_image = preprocess_image(image_path)
predictions = model.predict(processed_image)
predicted_class = np.argmax(predictions[0])
# Interpret the results
class_labels = ['cat', 'dog']
print(f"Predicted class: {class_labels[predicted_class]}")
print(f"Probabilities: {predictions[0]}")```