Giter Site home page Giter Site logo

dl-attention-class's Introduction

DL-Attention-Class

Simple implementation of a ConvNet with attention

  • Using Keras, we will design a simple ConvNet (3 layers) and train it for classification on the Cifar10 natural images dataset.

  • Without any attention, the model has about 2.5M parameters, and can reach 83% accuracy (if we use data augmentation during training). This is not state-of-the-art, but good enough for such a simple model.

  • We will implement a single-head attention layer acting on the last convolutional layer. This will allow the network to match or compare features across spatial locations, and will bring down the number of output channels and consequently, the total number of parameters: 0.5M parameters. We will verify that the network can achieve about the same or better level of accuracy (83%)with 5x fewer parameters.

  • We will visualize attention maps for a given location in an image, to see what attention features have been learned.

Optional follow-up work

  • We can verify that without attention, a ConvNet with 0.5M parameters would perform significantly worse (around 80%).

  • We can implement multi-head attention to further improve performance (about 83.5%) with the same number of parameters (<0.6M parameters).

  • We can run the models on Cifar100, for a more challenging task

dl-attention-class's People

Contributors

rufinv avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.