Car_Vision / test.py
courte's picture
remove folder
0599704
raw
history blame contribute delete
591 Bytes
# Test the model with a sample image
import numpy as np
from PIL import Image
def test_model():
# Load a sample image
img_path = "./subaru.jpg"
img = Image.open(img_path).convert("RGB")
img = img.resize((299, 299))
img_array = np.array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)
# Make a prediction
predictions = model.predict(img_array)
predicted_class_index = np.argmax(predictions, axis=1)[0]
print(f"Predicted class index: {predicted_class_index}")
print(f"Predicted brand: {CAR_BRANDS[predicted_class_index]}")
test_model()