# Compile Deep Matching on Ubuntu 14.04

Today I successed in porting the Deep Matching algorithm & tools from LEAR to Ubuntu. The algorithm itself is a stand-of-art solution to mutipal questions concerning image matching, comes with a easy-understanding code. However the author did not mention the dependency request of tools he used, and the system file structure of Fedora differs a lot from Ubuntu/Debian, hence the compile&install takes me quite a long time.

First to first, using

 1 apt-get 
  to fix dependency. Take a look into 1Makefile , we have (although the default 1make  method does not call this)

 1 STATICLAPACKLDFLAGS=-static -static-libstdc++ /usr/lib64/libjpeg.a /usr/lib64/libpng.a /usr/lib64/libz.a /usr/lib64/libblas.a /usr/lib/gcc/x86_64-redhat-linux/4.7.2/libgfortran.a # statically linked version 

Which briefly declares the dependecy. In the following codes I’m omitting

 1 sudo 
 , however most steps should be executed as root.

 1 2 3 apt-get install libjepg-dev apt-get install libpng-dev apt-get install libatlas-base-dev libatlas-dev 

The following commands should add the corresponding

 1 .h 
  file to search path. It’s just the beginning: Ubuntu itself includes 1libjpeg , 1libpng  and some other tools the program uses in its kernel include path, hence a fix is taken to link such libaries to 1/usr/lib/ 

 1 2 3 4 5 6 ln -s /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libpng.a /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libz.a /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib 

Now we’ve dealt with

 1 libjpeg 
 , 1libpng  and 1libz . The part of 1atlas  is a little unusal since the program uses machine-optimized version. We have to manually install 1atlas . Notice the following name of folder maynot be the same as others since the version of 1atlas  at the time I try is 3.10.1.

 1 2 3 4 5 6 sudo apt-get source atlas cd atlas-3.10.1 sudo fakeroot debian/rules custom cd .. sudo dpkg -i libatlas3-base_3.10.1-4+custom1_amd64.deb sudo dpkg -i libatlas3gf-base_3.10.1-4+custom1_all.deb 

 1 Makefile 
 , we have some last modify here. The dynamic link may work now, only to change 1libptf77blas.so  to 1libptfblas.so  if you don’t have 1libptf77blas.so  under 1/usr/lib .

However when I tried on another computer, such method fails in loading

 1 jpeglib.h 
 . A more steady way can be used by calling the static link method:

In

 1 STATICLAPACKLDFLAGS 
 , Change all 1usr/lib64/  to 1usr/lib/ , and change 1x86_64-redhat-linux  in the last argument to something like 1/x86_64-linux-gnu  which is the folder name occurs in 1/usr/lib . Finally change 1all: deepmatching  to 1all: deepmatching-static .

Now call the static-link method by

 1 make 
 . Happy deep-matching.

# Reinstall Ubuntu: Disk by UUID not detected (initramfs), boot failure

Today I’m installing Ubuntu on my lab’s server, a Dell R410 U2 server with 6-core Xeon Cpu and a complex RAID of disks, which might be the key feature causing system boot failure described below.

After installing the system file along with the bootloader (grub2), the computer reboots, loads the grub2, and then try to boot the linux kernel located in

 1 \boot 
 . However after a short waiting, the bootloader cannot boot up the kernel file and outputs

 1 ALERT! /dev/disk/by-uuid/xxxxxxxxx does not exist. Dropping to a shell 

After figuring out it’s not due to missmatch of disk name or UUID (using ‘blkid’ to check for disks, and as is set by the new installed system, this configuration should not likely be wrong), I start realizing the thing might be on the configuration

 1 rootdelay 
 , which determines time to wait for response of the root file, and is not explicitly writen in the default conf-file (which is shown after typing ‘e’ in grub2).

So that’s the thing: my server machine comes with hardware costing much more time to load than some average PC, and hence is default waiting time for

 1 root/ 
  is not enough. To handle it, simply add something like 1rootdelay=120  in the command 1linux , normally after the word 1quiet , when 1120  is some long-enough time in seconds.

The system now successfully boot into desktop. While

 1 120 
  is a great number for PC starting time, it does not mean grub2 really waits for precisely 2 minutes. it takes only 43 seconds to launch into desktop after firing up boot.

# Cheat for newbies learning Lua

1. Double brackets start and end multi-line strings.
2. No 1++  or 1--  type operators.
3. 1~=  is not equals.
4. Variables are global by default; call 1local var  to make a variable local.
5. String concatenation uses 1.. .
6. Only 1nil  and 1false  are falsy. 10  and ‘empty’ 1{}, ''  are not false.
7. Function is a return type.
8. List is devided by 1,  like 1a, b, c .
9. Assignment between lists mismatched in length is available; the sender fits into the reciever.
10. Indices start at 11  !!!!!
11. A list can be seen as table with numeric index as the key.
12. Oh my classes…

# Lab Day 3

Today I talked with Bai about my plans for the further run. She suggests me that A (learning) method may be obtained through multi frames of the flow, predict point moving, and hence add a term in the energy function of matching. It’s a convinience thing that can be done directly from the ground true set, and coding could be started soon.

Also a person in this area is introduced: JiangXiong Yang, someone be doing stereo matching and flow for years. Plenty papers together with codes are provided too.