AnimalVision: Animal Classification Model

AnimalVision is a Convolutional Neural Network (CNN) model trained to classify 90 different animal species. The model is trained using Keras and is available on the Hugging Face platform.

πŸ“Œ Model Details

  • Model Type: Convolutional Neural Network (CNN)
  • Dataset: A diverse dataset containing 90 animal classes
  • Libraries: TensorFlow / Keras
  • Format: .keras model file

πŸš€ Usage

You can download and use this model from Hugging Face with TensorFlow/Keras.

1️⃣ Load the Model

from tensorflow import keras
import huggingface_hub

model_path = huggingface_hub.hf_hub_download("furkankarakuz/AnimalVision", "AnimalVisionModel.keras")
model = keras.models.load_model(model_path)

2️⃣ Make Predictions with the Model

from tensorflow import keras
from tensorflow.keras.preprocessing import image
import huggingface_hub
import numpy as np


model_path = huggingface_hub.hf_hub_download("furkankarakuz/AnimalVision", "AnimalVisionModel.keras")
model = keras.models.load_model(model_path)


def load_animal_labels():
    label_path = huggingface_hub.hf_hub_download("furkankarakuz/AnimalVision", "AnimalList.txt")
    with open(label_path, "r") as file:
        return file.read().split("\n")


def predict_image(img_path, model):
    img = image.load_img(img_path, target_size=(224, 224))
    img_array = image.img_to_array(img) / 255.0
    img_array = np.expand_dims(img_array, axis=0)
    predictions = model.predict(img_array, verbose=0)[0]
    class_index = np.argmax(predictions)

    animal_classes = load_animal_labels()
    animal_name = animal_classes[class_index]

    return animal_name


image_path = "example.jpg"
predicted_animal = predict_image(image_path, model)
print(f"Predicted Animal: {predicted_animal}")

πŸ“‚ Links and Resources

Feel free to share your feedback while using the model! 🎯

Downloads last month
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using furkankarakuz/AnimalVision 1