VS2017下AI工具的安装

以下根据教程进行:https://www.cnblogs.com/ms-uap/p/9182530.html

  1. 卸载了所有可以卸载的已安装文件(cntk,tensorflow,...)

  2. Path下所有路径清除

  3. VS里Python工具安装失败(找不到python36.dll),在VS installer中修复后OK

  4. 按照文章说明进行安装VS的AI工具插件

  5. 安装CUDA9.0,失败(CUDA VS插件安装失败):拷贝CUDA VS插件安装文件,只安装其它,然后再单独安装CUDA插件

  6. 按照文章说明把CuDNN的dll文件拷到安装目录的bin文件夹内

  7. 按照文章说明git clone安装脚本(我的默认Python路径与文章给出的不一样,可能是注册表里的信息)

    git clone https://github.com/Microsoft/samples-for-ai.git 
    cd samples-for-ai
  8. 运行安装脚本(需要在admin模式,python需要可用)

  9. 执行 intall.py

    python installer/install.py
    D:\repos\MSAI\samples-for-ai>python installer/install.py
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Detecting system information ...
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] OS: Windows-10, 64bit
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Python: 3.6.5, 64bit
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] NVIDIA GPU: Find 1 GPU device(s) that meet the compute capability
     requirement.
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Git: True
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Visual Studio: VS2017
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] CUDA: 9.0
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Cudnn: 7
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install scipy(numpy, scipy) ...
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install numpy 1.14.3 ...
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install CNTK(BrainScript) ...
    06:22:37 [INFO] [Microsoft Visual Studio Tools for AI] CNTK(BrainScript)-2.5.1 is already installed.
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install numpy 1.14.3 successfully!
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install scipy 1.1.0 ...
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install scipy 1.1.0 successfully!
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install cntk-gpu 2.5.1 ...
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install cntk-gpu 2.5.1 successfully!
    06:22:38 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install tensorflow-gpu 1.5.0 ...
    06:22:39 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install tensorflow-gpu 1.5.0 successfully!
    06:22:39 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install torch 0.4.0 ...
    06:22:39 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install torch 0.4.0 successfully!
    06:22:39 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install torchvision 0.2.1 ...
    06:22:40 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install torchvision 0.2.1 successfully!
    06:22:40 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install mxnet-cu90 1.2.0 ...
    06:22:40 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install mxnet-cu90 1.2.0 successfully!
    06:22:40 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install chainer(cupy, chainer) ...
    06:22:40 [WARNING] [Microsoft Visual Studio Tools for AI] On windows, please manully install cupy. You can reference thi
    s link https://github.com/Microsoft/vs-tools-for-ai/blob/master/docs/prepare-localmachine.md#chainer.
    06:22:40 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install chainer 4.1.0 ...
    06:22:41 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install chainer 4.1.0 successfully!
    06:22:41 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install Theano 1.0.2 ...
    06:22:41 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install Theano 1.0.2 successfully!
    06:22:41 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install Keras 2.1.6 ...
    06:22:42 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install Keras 2.1.6 successfully!
    06:22:42 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install caffe2 0.8.1 ...
    06:22:42 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install caffe2 0.8.1 successfully!
    06:22:42 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install ml software(scikit-learn, xgboost and libsvm) ..
    .
    06:22:42 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install scikit-learn 0.19.1 ...
    06:22:43 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install scikit-learn 0.19.1 successfully!
    06:22:43 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install xgboost 0.71 ...
    06:22:43 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install xgboost 0.71 successfully!
    06:22:43 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install libsvm 3.22 ...
    06:22:44 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install libsvm 3.22 successfully!
    06:22:44 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install converter(coremltools, onnx, tf2onnx, onnxmltool
    s and winmltools) ...
    06:22:44 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install coremltools 0.8 ...
    06:22:55 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install coremltools 0.8 successfully!
    06:22:55 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install onnx 1.1.2 ...
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install onnx 1.1.2 successfully!
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] onnxmltools is already installed.
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] winmltools is already installed.
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] tf2onnx is already installed. We will uninstall it and upgrade to
     the latest version.
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-uninstall tf2onnx 0.0.0.1 ...
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] Pip-uninstall tf2onnx 0.0.0.1 successfully!
    06:22:56 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install tf2onnx 0.0.0.1 ...
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] Pip-install tf2onnx 0.0.0.1 successfully!
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install extra software(jupyter, matplotlib, and pandas)
    ...
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] jupyter is already installed.
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] matplotlib is already installed.
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] pandas is already installed.
    06:23:14 [INFO] [Microsoft Visual Studio Tools for AI] Setup finishes.
    Press enter to exit.

     

  10. 训练第一个模型MINST

    D:\repos\MSAI\samples-for-ai>python examples/tensorflow/mnist/mnist.py
    Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
    Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
    Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
    Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
    Extracting input\train-images-idx3-ubyte.gz
    Extracting input\train-labels-idx1-ubyte.gz
    Extracting input\t10k-images-idx3-ubyte.gz
    Extracting input\t10k-labels-idx1-ubyte.gz
    2018-08-09 06:34:46.101979: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_g
    uard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
    2018-08-09 06:34:46.359657: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu
    _device.cc:1105] Found device 0 with properties:
    name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
    pciBusID: 0000:01:00.0
    totalMemory: 11.00GiB freeMemory: 9.10GiB
    2018-08-09 06:34:46.376253: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu
    _device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:0
    1:00.0, compute capability: 6.1)
    Initialized!
    Step 0 (epoch 0.00), 19.4 ms
    Minibatch loss: 8.334, learning rate: 0.010000
    Minibatch error: 85.9%
    Validation error: 84.6%
    Step 100 (epoch 0.12), 5.2 ms
    Minibatch loss: 3.237, learning rate: 0.010000
    Minibatch error: 4.7%
    Validation error: 7.8%
    ...
    ...
    ...
    Step 8500 (epoch 9.89), 4.6 ms
    Minibatch loss: 1.622, learning rate: 0.006302
    Minibatch error: 1.6%
    Validation error: 0.9%
    Test error: 0.8%
  11. 文件输出的模型位于 D:\repos\MSAI\samples-for-ai\export,和文章的不一致,用everything找到的

  12. 按照文章说明可以拷贝一个手写数字识别的VS工程sln

    git clone https://github.com/squirrelsc/sample-mnist.git
    start sample-mnist\MnistDemo.sln
  13. nuget包自动加载ML.Scoring

  14. 导入训练好的Mnist模型(.pd文件),工具自动生成了class 供导入

  15. Compile&Run

你可能感兴趣的:(机器学习)