This repository contains a Python script for performing image classification using pre-trained deep learning models. The code leverages the power of deep neural networks to predict the top classes for an input image, along with their associated probabilities. It uses PyTorch and torchvision to achieve this.
This software leverages artificial intelligence to automatically generate descriptive labels for images. These generated labels can then be seamlessly integrated into website's alt tags, significantly improving accessibility for users with visual impairments. By making web content more inclusive, it ensures that everyone can access and understand the images displayed on the site.
- Loads an image and preprocesses it for model input.
- Utilizes a pre-trained deep learning model (ResNet-152 or AlexNet) for image classification.
- Displays the top predicted classes and their probabilities based on the ImageNet dataset.
- Clone this repository to your local machine.
- Install the necessary dependencies (PyTorch, torchvision, Pillow, matplotlib).
- Replace the sample image with your own image in the script.
- Run the script to obtain image classification results.
- Use the classification as an alt-tag for websites to enhance accessibility.
- Python 3.10
- PyTorch
- torchvision
- Pillow (PIL)
- matplotlib
- Tkinter
- ResNet-152 (pre-trained on ImageNet)
- AlexNet (pre-trained on ImageNet) (deprecated)
Here's an example of how to use the code:
python3 imageLabel.py