Ryuzo and the Seven Henchmen

Recently watched another masterpiece from Takeshi Kitano.

Plot in a twitter format: Old yakuza gathers his very old yakuza friends to do some brutal yakuza stuff and compete for turf of a small Japanese town.

The movie is full of humor and subtle and gentle moments that reflect on the matters of our short lives and temporary friendships. It is shot in a calm, very Kitano manner and gives a great, pacifying visual experience.

If you want to get away from once again Beauty and King Kong, check it out.

http://www.imdb.com/title/tt4176776/

My rating:

8/10, yanking two points for poor special effects.

MXNet im2rec.py

MXNet provides a Python utility to create RecordIO packages of data that are supported by framework’s data iterators.

https://github.com/dmlc/mxnet/blob/master/tools/im2rec.py

Little detail, the im2rec.py doesn’t support .png files, unless you manually adjust the script and add it as allowed extensions.

In order to create a rec file, you first need to make a list of files using this command:

python \\mxnet-master\tools\im2rec.py  --list 1 --recursive 1 --num-thread 4 --train-ratio 0.7 --test-ratio 0.2 prefix frames
--list 1 ==> tells the script to create the .lst files
--num-thread 4 ==> runs script in parallel
--train-ratio 0.7 ==> will split the data set between several list files
--test-ratio 0.2 ==> it will make sure that 20 percent of the data will be used in the test set.

After you get .lst files, lets create a record set.

Record objects will be about the same size as the data that being used for the objects.

python \\mxnet-master\tools\im2rec.py --num-thread 4 --quality 80 prefix frames

here we eliminating –list argument so the script will be working on .rec files.

At the end of its execution, it should display something like

time: 0.0130000114441 count: 0
time: 3.01699995995 count: 1000
time: 2.83000016212 count: 2000

and in the folder where you have your dataset you will see files

prefix_test.rec

prefix_test.lst
prefix_test.val

and same for train and validation sets.

 

Enjoy!

Installing Apache MXNet Python library Windows 10

Hello, hello.

I wanted to share a quick how-to install MXNet on Windows 10 64-bit.

The solution here is a bit opinionated as I am using Anaconda to manage Python environments.

I will start from the beginning – Anaconda installation.

We will need Anaconda 4.3. You should use 64-bit Anaconda/Python 2.7 combination, as the environment we will create will be based on Python 2.7 64-bit in order to support MXNet. You can get anaconda here:

https://www.continuum.io/downloads

Follow the installation instructions and once it is done, lets go to the windows command line and type this:

conda create -n mxnet python=2.7 anaconda

having ‘anaconda’ argument in there will ensure we have common data analytics libraries, that are not necessary for MXNet, but nice to have. Also, we want to use Python 2.7 in this case, as MXNet has compatibility issues with Python 3.

Once the environment creation is complete, activate it by executing:

activate mxnet

It is all for the terminal so far.

Lets get pre-combiled MXNet dlls!

You will need to download several packages from

https://github.com/yajiedesign/mxnet/releases

First, get the prebuild VC14 ( Visual Studio runtime 2015) package, it doesn’t contain any specific binaries, but it provides 3rd party libraries and helps to set all the environment variables that are necessary to run MXNet. In my case I got prebuildbase_win10_x64_vc14 

Once you download VC14 base archive, extract its contents somewhere. A good folder candidate would be ‘mxnet’ in the root of C: or any other drive. Let’s imagine that you have created ‘D:\mxnet’ folder.

Open terminal in that folder an run

setupenv.cmd

It should finish quickly. You can verify that it was successful by going into the System -> Advanced System Settings and making sure it has MXNET_HOME:”D:\mxnet” environment variable setup.

Now, lets download GPU or CPU version of pre-compiled MXNet from the same page where you got the base package. At the moment of writing it is 20170702_mxnet_x64_vc14_gpu.7z

We won’t need the source code of mxnet, as we are not going to compile it from scratch, so you can IGNORE Source code (zip)

The archive will have contents that you need to extract to “D:\mxnet”, it might overwrite some of the folders, which is ok.

Optional STEP:

Now, if you used GPU version of MXNet, the last part would be is to get the cuDNN nVidia library for windows, you will have to register to get it, but essentially it is free.

cuDNN is available here:

https://developer.nvidia.com/rdp/cudnn-download

Once you download the archive, extract its contents to “D:\mxnet\3rdparty\cudnn”.

END OF Optional STEP.

It is time now to try to install python binding, so you can import mxnet inside a python project.

Go to the terminal where you had your MXNet Anaconda environment activated and jump to the location: “D:\mxnet\python”. Once you are in the correct location, run

python setup.py install

If it ran without any errors, then we are ready to do our final test. Go back to the terminal where you acivated mxnet environment and first, start Python interpreter, and then run

import mxnet

You should be able to import the library.

Enjoy!