This script performs image classification using the MobileNetV2 pre-trained model provided by TensorFlow. It allows you to classify images into different categories based on the ImageNet dataset.
Before running the script, ensure you have the following dependencies installed:
- TensorFlow (version 2.x)
- NumPy
- Pillow
-
Prepare your image: Ensure you have an image file that you want to classify. Supported image formats include JPEG, PNG, and BMP.
-
Update the image path: In the script, locate the image_path variable and replace "image.jpg" with the path to your image file.
-
Run the script: Execute the script using the following command:
python image_classification.py
-
View the predictions: The script will display the top 3 predictions for the image, along with their respective labels and confidence scores.