Model Card for cats_dogs_recognition_tf_nn
Model Details
Model Description
- 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)
- Dense layer (512 units, ReLU activation)
- Dense layer (2 units, Softmax activation)
- License: mit
- Finetuned from model: N/A (trained from scratch)
Model Sources
- Repository: louiecerv/cats_dogs_recognition_tfnn
Uses
Direct Use
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).
Downstream Use
The model can be potentially finetuned for other image classification tasks, especially those involving similar image characteristics or domains.
Out-of-Scope Use
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.
Bias, Risks, and Limitations
Bias
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.
Risks
Misclassification of images can occur, especially when the input image is ambiguous or different from the training data distribution.
Limitations
- The model is limited by the size and diversity of the training dataset.
- It only recognizes two classes: cats and dogs.
- Performance might degrade on low-quality or heavily obscured images.
Recommendations
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.
How to Get Started with the Model
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]}")```
- Downloads last month
- 7