Skip to content

Latest commit

 

History

History

tlt_api_pyt_image_classification

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Transfer Learning for PyTorch Image Classification using the Intel® Transfer Learning Tool API

This notebook demonstrates how to use the Intel Transfer Learning Tool API to do transfer learning for image classification using PyTorch.

The notebook performs the following steps:

  1. Import dependencies and setup parameters
  2. Get the model
  3. Get the dataset
  4. Prepare the dataset
  5. Predict using the original model
  6. Transfer learning
  7. Predict
  8. Export

Running the notebook

To run the notebook, follow the instructions to setup the PyTorch notebook environment.

To use Gaudi for training and inference, install required software for Intel Gaudi:

  1. Temporarily uninstall torch
# Torch will later be re-installed below
pip uninstall torch
  1. Install the Gaudi Intel SW Stack
wget -nv https://vault.habana.ai/artifactory/gaudi-installer/1.15.0/habanalabs-installer.sh
chmod +x habanalabs-installer.sh
sudo apt-get update
# Note: This may not be required depending on what is already installed on your machine
./habanalabs-installer.sh install --type base
  1. Install the Gaudi Intel Pytorch environment
# Note: This step may not be required depending on what is already installed on your machine
./habanalabs-installer.sh install -t dependencies
./habanalabs-installer.sh install --type pytorch –venv

See Habana Docs for detailed installation instructions

References

Dataset citations

@ONLINE {tfflowers,
author = "The TensorFlow Team",
title = "Flowers",
month = "jan",
year = "2019",
url = "http://download.tensorflow.org/example_images/flower_photos.tgz" }

@ONLINE {CIFAR10,
author = "Alex Krizhevsky",
title = "CIFAR-10",
year = "2009",
url = "http://www.cs.toronto.edu/~kriz/cifar.html" }

@article{openimages,
  title={OpenImages: A public dataset for large-scale multi-label and multi-class image classification.},
  author={Krasin, Ivan and Duerig, Tom and Alldrin, Neil and Veit, Andreas and Abu-El-Haija, Sami
    and Belongie, Serge and Cai, David and Feng, Zheyun and Ferrari, Vittorio and Gomes, Victor
    and Gupta, Abhinav and Narayanan, Dhyanesh and Sun, Chen and Chechik, Gal and Murphy, Kevin},
  journal={Dataset available from https://github.com/openimages},
  year={2016}
}

Model citations

@misc{yalniz2019billionscale,
    title={Billion-scale semi-supervised learning for image classification},
    author={I. Zeki Yalniz and Hervé Jégou and Kan Chen and Manohar Paluri and Dhruv Mahajan},
    year={2019},
    eprint={1905.00546},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}