0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

reproducing MMDT@ICML2013

Posted at

Domain Adaptation ProjectのMax-margin Domain Transformations (MMDT)の再現方法.

  • J. Hoffman, E. Rodner, J. Donahue, K. Saenko, and T. Darrell, "Efficient Learning of Domain Invariant Image Representations", ICLR2013.

Build


wget http://vision.cs.uml.edu/code/DomainTransformsECCV10_v1.tar.gz
tar xzvf DomainTransformsECCV10_v1.tar.gz 
wget http://www-scf.usc.edu/~boqinggo/domain_adaptation/GFK_v1.zip
unzip GFK_v1.zip 
wget http://www.csie.ntu.edu.tw/%7Ecjlin/libsvmtools/weights/liblinear-weights-2.01.zip
unzip liblinear-weights-2.01.zip 


git clone https://github.com/jhoffman/MaxMarginDomainTransforms.git
cd MaxMarginDomainTransforms
patch -p0 << EOF
--- demo.m.orig	2016-03-25 13:37:47.000000000 +0900
+++ demo.m	2016-03-25 13:39:07.000000000 +0900
@@ -47,7 +47,7 @@
     tstart = tic;
     [model_mmdt, W] = TrainMmdt(labels.train, data.train, param);
     telapsed(i) = toc(tstart);
-    [pl, acc] = predict(labels.test.target', ...
+    [pl, acc, ~] = predict(labels.test.target', ...
         [sparse(data.test.target), ones(length(labels.test.target),1)], ...
         model_mmdt);
     accuracy(i) = acc(1);
EOF
patch -p0 << EOF
--- demo_allSplits.m.orig	2016-03-25 13:37:47.000000000 +0900
+++ demo_allSplits.m	2016-03-25 12:53:55.000000000 +0900
@@ -53,7 +53,7 @@
             tstart = tic;
             [model, W] = TrainMmdt(labels.train, data.train, param);
             telapsed(i) = toc(tstart);
-            [pl, acc] = predict(labels.test.target', ...
+            [pl, acc, ~] = predict(labels.test.target', ...
                 [sparse(data.test.target), ones(length(labels.test.target),1)], ...
                 model);
             accuracy(i) = acc(1);
EOF
patch -p0 << EOF
--- AddDependencies.m.org	2016-03-25 13:56:27.000000000 +0900
+++ AddDependencies.m	2016-03-25 13:55:40.000000000 +0900
@@ -1,6 +1,6 @@
 % add dependencies
-LIBLINEAR_WEIGHTS_PATH = '../../dev/mmdt_liblinear/liblinear/matlab/';
-SAENKO_ECCV10_RELEASE = '../DomainTransformsECCV10';
+LIBLINEAR_WEIGHTS_PATH = '../liblinear-weights-2.01/matlab/';
+SAENKO_ECCV10_RELEASE = '../DomainTransformsECCV10/';
 
 addpath(LIBLINEAR_WEIGHTS_PATH);
 addpath(SAENKO_ECCV10_RELEASE);
EOF
patch -p0 << EOF
--- Config.m.org	2016-03-25 13:57:45.000000000 +0900
+++ Config.m	2016-03-25 13:57:19.000000000 +0900
@@ -14,7 +14,7 @@
 
 %%%%%                      PARAMETERS TO EDIT                       %%%%%%
 % Directory containing the data 
-param.DATA_DIR = '~/code/dev/OfficeExperiments/datacodeofthegeodesicflowkernel/';
+param.DATA_DIR = '../ToRelease_GFK/data/';
 
 % Choose the experiment type
 param.held_out_categories = false; 
EOF

# if you don't have Statistics toolbox,
wget https://raw.githubusercontent.com/skaae/rbm_toolbox/master/util/zscore.m
patch -p0 << EOF
--- zscore.m.org	2016-03-25 14:06:15.000000000 +0900
+++ zscore.m	2016-03-25 14:06:32.000000000 +0900
@@ -1,4 +1,4 @@
-function [x, mu, sigma] = zscore(x)
+function [x, mu, sigma] = zscore(x,~)
     mu=mean(x);	
     sigma=max(std(x),eps);
 	x=bsxfun(@minus,x,mu);
EOF
wget http://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/47180/versions/1/download/zip -O princomp.zip
unzip princomp.zip princomp.m

そしてMATLABを起動して,liblinear-weights-2.01/matlab/に移動して,MATLABコマンドウィンドウで

実行
make

する.

(mexにパスが通っていれば,シェルでmakeしてもよい)

Run

MaxMarginDomainTransforms/

実行
demo_allScript

を実行.

実行結果
amazon -> webcam:  65.04 +/-   1.3
amazon -> dslr:  54.57 +/-   1.0
amazon -> caltech:  39.96 +/-   0.5
webcam -> amazon:  50.55 +/-   0.8
webcam -> dslr:  62.52 +/-   1.1
webcam -> caltech:  34.67 +/-   0.8
dslr -> amazon:  50.20 +/-   0.8
dslr -> webcam:  73.75 +/-   0.8
dslr -> caltech:  35.44 +/-   0.7
caltech -> amazon:  50.89 +/-   0.8
caltech -> webcam:  62.55 +/-   1.1
caltech -> dslr:  53.31 +/-   1.0


 Mean acc all:  52.79
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?