Giter Club home page Giter Club logo

deep-coral-tf's Introduction

Deep-Coral-Tf

A Tensorflow implementation of paper, Deep CORAL: Correlation Alignment for Deep Domain Adaptation.

Deep Coral is attributed as a solution to the problem faced by convolutional neural networks to generalize well across changes in input distributions. Domain adaptation algorithms have been proposed to compensate for the degradation in performance due to domain shift.

One of the solutions to the problem of unsupervised domain adaptation is CORAL. CORAL is referred to by many as a frustratingly easy unsupervised domain adaptation method that aligns the second-order statistics of the source and target distributions with a linear transformation.

In the aforementioned paper, authors have attempted to extend CORAL to learn a non-linear transformation that aligns correlations of the activations of the last fully connected layer in deep convolutional neural networks, hence the phrase Deep CORAL.

Requirements

  • Python 3.5
  • Tensorflow

Setup

  1. Clone the source code and run python3 train_net.py.
  • It downloads the Office 31 dataset in the '/office31_data directory and also generates the TF-Records file. The Offcie 31 dataset contains images divided in three domains namely, amazon, webcam and dslr. Each domain consists of images across 31 different categories like bike, bottle, pen and so on. The categories contain variable number of images, however each image is of resolution 300x300. Each image is resized to resolution 227x227 and the associated category is converted into an integer in the range (0, 30). The resized image is converted to a numpy array and together with the integer label is serialized into a TF example and subsequently written to the TF-Records file.

  • In the current implementation, amazon is used as the source domain and webcam is used as the target domain. Thus, two TF-Records file namely amazon.tfrecords and webcam.tfrecords are generated.

  • Finally, training begins. Since a pre-trained Alexnet is used as the model, the weights of the Alexnet need to be downloaded and stored in the directory /office31_data. The link for downloading weights is here. The training is carried for 40 epochs and the training checkpoints are saved in /office31_data/train. Also, a summary of the loss, gradient and weights is also made and saved in /office31_data/summary and can be used for visualization in Tensorboard.

  1. To evaluate the model on the target distribution (webcam for the current implementation), run python3 eval_net.py. It performs the evaluation on the entire target dataset and prints the precision at the end.

Contributing

Suggestions and pull requests are actively welcome.

References

  1. Deep CORAL: Correlation Alignment for Deep Domain Adaptation. (Paper)
  2. A Pytorch implementation of Deep CORAL. (Link)

deep-coral-tf's People

Contributors

harshitbansal05 avatar

Watchers

James Cloos 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.