Code Monkey home page Code Monkey logo

pytorch-classification's Introduction

PyTorch-Classification

This repository contains several Jupyter notebooks which explore classification tasks with PyTorch. We will build a convolutional neural network (CNN) to detect smiling in images from the CelebA dataset, which contains over 200000 celebrity photographs, and also study a variety of methods for recognizing hand-drawn digits from the MNIST dataset.

Initially, we recap the fundamentals of PyTorch in the notebook PyTorch_Fundamentals.ipynb. Here we review basic tensor operations in PyTorch and building neural networks, mostly following Chapters 12 and 13 of ''Machine Learning with PyTorch and Scikit-Learn'' by Sebastian Raschka et al.

Before tackling MNIST digit recognition with neural networks, we first explore the performance of several learning algorithms such as K-Nearest Neighbors and Random Forest on this task, as shown in the notebook MNIST_scikit-learn.ipynb.

Then we build a neural network (NN) in PyTorch and train it to classify MNIST images in the notebook MNIST_PyTorch-NN.ipynb. First we construct an inital model, using two hidden layers followed by a $10$-unit output layer with softmax. We perform hyperparameter tuning, and decide on good values for the learning rate $\alpha$, number of hidden units, weight decay (L2 penalty), and dropout probability $p$. We see how implementing these variance reduction techniques improves test-set performance compared to an initial baseline model.

After this, we construct a CNN in PyTorch and train it on the MNIST dataset, shown in MNIST_PyTorch_CNN.ipynb. We compare its performance to our previous neural network model, and find a marked improvement, with test accuracy now exceeding 99%.

Finally, in the notebook CelebA_Smile_Detection.ipynb, we explore the CelebA dataset and train a CNN in PyTorch to detect smiles in these images. Here we will employ a range of image augmentation techniques using the torchvision package.

pytorch-classification's People

Contributors

owenpb avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.