Code Monkey home page Code Monkey logo

domain-adaptation's Introduction

Domain Adaptation

Dependencies

There are 2 requirements.txt, one for Ubuntu and another for Windows.

Use as follows: pip intall -r requirements.txt

Pretrained weights

In the save/ directory, I have pretrained weights (se_weights_epoch_0.pth) that achieve :

  • Source accuracy: 98 %
  • Target accuracy: 97 %
  • F1 target: 1.000
  • Precision target: 1.000
  • Recall target: 1.000

Python script

Usage

usage: domain_adaptation.py [-h] [--resume RESUME] [--data DATA] [--save SAVE]
                            [--eval EVAL] [--batch_s BATCH_S]
                            [--batch_t BATCH_T] [--disp]

SVHN to MNIST domain adaptation

optional arguments:
  -h, --help         show this help message and exit
  --resume RESUME    Weights path to resume from
  --data DATA        Datasets path
  --save SAVE        Result path
  --eval EVAL        Evaluate model
  --batch_s BATCH_S  Source domain batch size
  --batch_t BATCH_T  Target domain batch size
  --disp             Display predictions during eval

Evaluate

python domain_adaptation.py --resume=./save/se_weights_epoch_0.pth --eval 100 --batch_s 10 --batch_t 10

Evaluate and display samples

python domain_adaptation.py --resume=./save/se_weights_epoch_0.pth --eval 1 --disp --batch_s 10 --batch_t 10

Close the matplotlib windows (alt-f4 or close button) to get new batch prediction. Ctrl-C to stop.

Train

python domain_adaptation.py --resume=./save/se_weights_epoch_0.pth --save=./weights/ --batch_s 100  --batch_t 1000

Batch sizes have to be big according to the paper, to keep a good distribution of labels/samples (e.g. 100 per class)

Train from scratch

python domain_adaptation.py --save=./weights/ --batch_s 100  --batch_t 1000

domain-adaptation's People

Contributors

cpcdoy 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.