Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

imagerecGIT

ImageRecognizer

This is a Python-based Graphical User Interface (GUI) application for image recognition which uses a pre-trained ResNet-50 model. The application allows users to select an iamge file (JPG, JPEG, PNG, or GIF), and it will predict the class of the image.

Table of Contents

  1. Prequisites and Installation
  2. Features
  3. Usage
  4. Compilation
  5. References

Prequisites and Installation

Before running the application make sure you have the following dependencies installed:

  • Python: (https://www.python.org/downloads/)
  • tkinter package: pip install tkinter
  • PIL package: pip install pillow
  • torch package: pip install torch
  • torchvision package: pip install torchvision

Features

  • Image Classification: The application uses the ResNet-50 model to classify the image and will provide the predicted class and confidence level. It has a powerful image recognition capabilities which was pre-trained on the large-scale ImageNet dataset.
  • API Integration: The program will fetch the class labels used for image classification from a JSON API endpoint. It will retrieve the lables from the imagenet-simple-lables repository by Anish Athayle. This makes sures that the predicted class names are accurate and up-to-date.
  • Preprocessing: Before any classification, the application will apply preprocessing transformations to the image. This includes resizing the selected image to a standard size of 224 x 224 pixels and then it will convert itself to a Tensor format suitable for input to the ResNet-50 Model.
  • User-Friendly Interface: The application provides a simple Graphical User Interface using the tkinter package. Users can easily select and view images, and recieve immediate feedback on the predicted class and the confidence level.
  • Error Handling: The application also handles various error scenarios, such as incorrect or invalid image formats and files. It will let the user know the appropriate error message to guide the user in selecting the correct image formats.

Usage

  1. Clone the repostory or download the source code file.
  2. Open a terminal or command prompt and navigate to the project directory. You can also use the exe file to test the application out from think link here.
  3. Run the following command to start the application:
python ImageRecognizer.py
  1. The application window will appear and there you can click on the "Open Image" button to select an image to classify. The supported formats include JPG, JPEG, PNG, and GIF.
  2. The selected image will get displayed and also will analyze the image using the pre-trained ResNet-50 model and display the confidence level as well as the predicted class.

Compilation

If you would like to distribute the application as an executable file, you can use UPX and Auto Py to Exe to compile the program. Extract the UPX archive to a directory and then add the UPX directory to your system's PATH enviornment variable.

  1. For terminal Install Auto Py to Exe Package:
pip install auto-py-to-exe
  1. Run the following command to start the compilation process:
auto-py-to-exe
  1. When the Auto Py to Exe GUI opens configure the options as per your requirements:
  • Script Location Select the ImageRecognition.py file.
  • Onefile: Select the checkbox to generate a single executable file.
  • UPX: Select the checkbox to compress the executable file using UPX (if UPX is installed and addted to PATH via advanced setting).
  1. Click the Convert .py to .exe button to start the compilation process.
  2. Once the compliation is finished, you can find the exe file in the output directory where it will be specified in.

References

This is a pre-trained ResNet-50 Model from the torchvision library. The image classification labels used in this applications are from the imagenet-simple-labels repository by Anish Athalye.

About

This program is a graphical user interface (GUI) application for image recognition using a pre-trained ResNet-50 model from tkinter.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages