Mxnet Windows configuration

Source: Internet
Author: User
Tags mxnet cuda toolkit intel mkl

MXNET Windows Compilation installation (Python)

This article only records mxnet installation under Windows, more environment configuration please visit Official document: http://mxnet.readthedocs.io/en/latest/how_to/build.html

Compile target:
    • Libmxnet.dll
Necessary:
    • Support c++11,g++>=4.8
    • Blas libraries, such as Libblas, Libblas, Openblas Intel MKL
Optional conditions:
    • CUDA Toolkit >= v7.0 to run on Nvidia GPUs
      • Requires GPU with support for Compute Capability >= 2.0
    • CUDNN to accelerate the GPU computation (only CUDNN 3 is supported)
    • OpenCV for Image Augmentation
Steps

First, strengthen the VS2013 to enable it to support the c++11 feature.

    • Download Install: Visual C + + Compiler-Nov CTP.
    • Copy the files under the installation directory to the VS2013 appropriate installation directory, for example: Copy C:\Program files (x86) \microsoft Visual C + + Compiler All files to C:\Program file S (x86) \microsoft Visual Studio 12.0\VC It is best to back up the original files.

Second, install a third-party library.

Includes OpenCV, CuDNN, and Openblas (this is ignored if MKL is already installed).

Finally, using CMake to create a vs project, CMake needs to be pre-installed.

Note that you should choose whether or not to Win64 according to your machine, otherwise you will not find Cublas when you configure OpenCV.

After clicking Configure, you need to configure the OpenCV, Openblas, and CUDNN paths and follow the prompts next.

When prompted configure done, click Generate to build the solution.

Tip generate done, open the solution in VS to compile.

If the hint opencv2/opencv.hpp cannot be found, then in VC + + of the project properties, add the file directory in the Include directory (found in the OpenCV installation directory), and similar issues are resolved.

Python Package Installation

Need python>=2.7 and NumPy. Install numpy using the PIP command on the Windows command line:

Pip Install NumPy

Verify that the installation is successful:

Python example/image-classification/train_mnist.py

Install (place the desired library file in the specified location):

Python setup.py Install

or set the environment variable PYTHONPATH to/<rootpathtoproject>/mxnet/python

Train MLP on MNIST

Now train a MLP to get a quick look at the process of training a network and the associated Python interface.

Importmxnet as MX#Step 1 Configuration Training setTrain =Mx.io.MNISTIter (Image="Mnist/train-images-idx3-ubyte", the label="Mnist/train-labels-idx1-ubyte", Batch_size= 128, Data_shape= (784, ))#Step 2 Configuring the validation setval =Mx.io.MNISTIter (Image="Mnist/t10k-images-idx3-ubyte", the label="Mnist/t10k-labels-idx1-ubyte", Batch_size= 128, Data_shape= (784, ))#Step 3 Configure the network, here a simple three layerdata = Mx.symbol.Variable ('Data') FC1= mx.symbol.FullyConnected (data = data, num_hidden=128) Act1= mx.symbol.Activation (data = FC1, act_type="Relu") FC2= mx.symbol.FullyConnected (data = act1, Num_hidden = 64) Act2= mx.symbol.Activation (data = FC2, act_type="Relu") FC3= mx.symbol.FullyConnected (data = Act2, num_hidden=10) MLP= mx.symbol.SoftmaxOutput (data = FC3, name ='Softmax')#Step 4 feedforward Network configurationModel =Mx.model.FeedForward (Symbol=MLP, Num_epoch= 20, Learning_rate=. 1)#Step 5 FittingModel.fit (X = train, Eval_data =val)#after step 6 training is completed, use the trained model to predictModel.predict (X = val)

Pits ~ ~

Mxnet Windows configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.