Movies, and engineering.

Menu Close

Tag: mxnet

Upgrading Python binding of Apache MXNet from 0.9 to 0.10 on Windows 10 64-bit

This post is a continuation and somewhat a revision of  “Installing MXNet on Windows 10”

MXNet is evolving and recently there was a release of version 0.10

I want to share the upgrade process that worked for me on my Windows 10 machine. You can use this tutorial as installation tutorial of MXNet 0.10.1.

First, we will need to create a folder somewhere called mxnet-0.10

Then, lets go to https://github.com/yajiedesign/mxnet/releases and download two packages:

  1. VC14 – prebuildbase_win10_x64_vc14.7z
  2. GPU ( or CPU) pre-built package – at the moment of writing it was 20170704_mxnet_x64_vc14_gpu.7z

Unpack VC14 first in the mxnet-0.10 folder and after that do the same with the GPU archive.

If you are using GPU version of MXNet, you will need to add cuda libraries to the folder called 3rd party.

You can register at NVIDIA web-site and get required cuDNN  library for free. The file should be placed into:

Drive:\mxnet-0.10.1\3rdparty\cudnn\bin\

Now in the root of the mxnet-0.10 folder look for a file called setupenv.cmd and run it as Administrator.

This execution of the .cmd file should adjust the PATH, and add MXNET_HOME environment variable.

MXNET_HOME should just point to the location of the mxnet-0.10 folder.

When all above is done, activate python 2.7 64-bit environment of your choice – conda, virtualenv or just system python.

Usually you do that by issuing command source activate [environment name] In my case, it is just source activate mxnet which I’ve created earlier using Anaconda Python 2.7 64bit installation.

Once the environment is active, go to the MXNET_HOME\python and run

python setup.py install

It should upgrade or install your MXNet package. Enjoy!

Apache MXNet in Python – Image iteration using mx.io.ImageRecordIter

In one of the previous posts I’ve described how to create RecordIO data set for MXNet.

Now I wanted to share an example how to iterate over the RecordIO data set. This example in many ways similar to the how to tutorial that are available on the mxnet github page. But nonetheless, I’ve decided it could be a logical continuation of a previous post and could probably help someone.

When we have a RecordIO set of images, we can use mx.io.ImageRecordIter to load and decode the data.

If you have prepared your image training set using im2rec.py correctly, you will see 4 little pictures plotted on the graph.

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

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

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.

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

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

and same for train and validation sets.

 

Enjoy!

© 2017 Movies, and engineering. . All rights reserved.

Theme by Anders Norén.