Skip to content

An Image Classification Project model built using PyTorch and DirectML backend. Secondary purpose is to draw attention to AMD+DirectML and perform benchmarks on AMD GPUs.

License

Notifications You must be signed in to change notification settings

Gurneet1928/AnimalVision-DirectML

Repository files navigation

AnimalVision-DirectML

Animal Image Classification Project built using PyTorch and DirectML backend


PyPI - Python Version GitHub License GitHub last commit GitHub commit activity GitHub Downloads (all assets, all releases)

(Under Development - Custom Built Nerual Network)

The Animal Image Classification Project leverages PyTorch for its deep learning framework, utilizing the DirectML backend to optimize performance across various hardware AMD Devices. This project aims to accurately classify images of different animal species using a ResNet50 Model. The model is trained on Animal10 dataset and can distinguish between multiple animal classes with high accuracy. This project serves as an excellent example using AMD devices for deep learning purpose, dedicated to Windows users.

The Project implements a 3 Stage Pipeline

Table of Contents

  1. Features
  2. Tech Stack Used
  3. Installation and Usage
  4. Result Comparision
  5. Future Improvements
  6. Development and Contributions
  7. License
  8. Aftermath

Features

  • 3 Stage Pipeline, allows to execute complete code in single command (Data Ingestion -> Model Training -> Model Inference)
  • Added logs for debugging and future purpose
  • Uses Animal10 Dataset from Kaggle
  • Leaverages DirectML for utilizing the capabilites of AMD GPUS
  • Seperate file for model hyperparameters, for easy tuning

Tech Stack Used:

  • PyTorch, w/ TorchVision
  • DirectML
  • Logger
  • Opendatasets and few more from requirements.txt file

Installation

For the code to work, make sure to install PyTorch and Torch-DirectML

For the dataset to be downloaded, make sure to get Kaggle API keys in kaggle.json file (in same folder). The project will automatically load the file from folder. Don't worry, the file will never be shared and will stay on your local machine.

Incase you face issues while installing Torch-DirectML, follow this >> Installation Article

Run the below codes after making sure you install PyTorch and Torch-DirectML properly.

  1. Clone the repository
git clone https://github.com/Gurneet1928/AnimalVision-DirectML.git
  1. Install Requirements using:
pip install -r requirement.txt --use-deprecated=legacy-resolver
  1. Run the pipeline using:
python main.py

The Pipeline will begin by downloading dataset. Incase dataset is already present, this step will be skipped.

Model will be trained once dataset is available. After Training, the best model (w/ best epoch) will be saved and used for inferencing.

Result Comparison

Here is a graph for comparing the AMD 6500M GPU (That I have) against NVIDIA T4 (That Colab provides for Free) for reference in performance.

Future Improvements

Here are some thoughts regarding what can be added in future:

  • Command Line arguements for which stage to skip or execute, inference file path, etc.
  • Frontend using Streamlit or Gradio
  • Custom Built Image Classification model (soon)
  • A benchmark file to add more benchmark results

Development and Contributions

Have some ideas to make this project better? Or found a bug? Maybe tested on your device and want to share results? Feel free to add an issue on this repo and I will personally look onto this.

Or mail me to gurneet222@gmail.com

License

MIT License

Distributed under the License of MIT, which provides permission to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. Check LICENSE file for more info.

OR Free to use But please make sure attribute the developer....

Free Software, Hell Yeah!

Reached the End ? I appreciate you reading this README in its entirety (maybe). Please remember to give this software a star if you found it useful in any way. (❁´◡`❁) (●ˇ∀ˇ●)

Aftermath

AMD Users after learning about DirectML and now they can use AMD GPUs for Deep Learning.... alt text

About

An Image Classification Project model built using PyTorch and DirectML backend. Secondary purpose is to draw attention to AMD+DirectML and perform benchmarks on AMD GPUs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published