Torch intro

Click here to load reader

Embed Size (px)

Transcript of Torch intro

  • Intelligent Software Lab.

    Torch 7

    ([email protected])Intelligent Software Lab.

  • Intelligent Software Lab.

    Torch 7

    Introduction: Installation

  • Intelligent Software Lab.

    Torch7 : Building

    Building (Linux, Ubuntu 12.04) sudo apt-get install lua5.2

    building Lua

    sudo apt-get install nodejs

    Torch nodejs GFX.js ..

    sudo apt-get install npm

    Torch

    image

  • Intelligent Software Lab.

    Torch7: Deep learning for NLP

    To install deep learning library sudo luarocks install dp

    For CUDA sudo luarocks install cunn

  • Intelligent Software Lab.

    Torch 7

    Introduction: Examples

  • Intelligent Software Lab.

    Torch7

    $ th

    $ luajit -lenv

  • Intelligent Software Lab.

    Torch7

    th th lgfx.go -- gfx

  • Intelligent Software Lab.

    Torch7

    i = image.lena() gfx.image(i)

  • Intelligent Software Lab.

    Torch7 (2)

    require nn n = nn.SpatialConvolution(1, 64, 16, 16) gfx.image(n.weight, {zoom=2, legend=})

    nn: Torch Neural Net. module

    nn.SpatialConvolution(): 16x16 64 ,

    weight

  • Intelligent Software Lab.

    Torch7 (3)

    n = nn.SpatialConvolution(1, 16, 12, 12) res = n:forward(image.rgb2y(image.lena())) gfx.image(res, {zoom=0.25, legend=states})

    forward(): output

  • Intelligent Software Lab.

    Supervised Learning: step_1 data

    torch7 https://github.com/clementfarabet/ipam-

    tutorials/blob/master/th_tutorials/1_supervised/1_data.lua

    dataset SVHN(Street View House Number)

    SVHN real-world image dataset MNIST

  • Intelligent Software Lab.

    Supervised Learning: step_1 data cont`

    SVHN dataset 10 classes (digit 1 class) ex) digit: 1 label: 1, digit: 0 label: 10, digit: 9 label: 9 train set: 73257 digits test set: 26032 digits additional extra training data: 531131 digits

    dataset format inputs: image feature 3*32*32 outputs: target result 10-dimensional

  • Intelligent Software Lab.

    Supervised Learning: step_1 data cont`

    torch7 https://github.com/clementfarabet/ipam-

    tutorials/blob/master/th_tutorials/1_supervised/1_data.lua

    Data(train_set, test_set ) torch lgfx.go i 1_data.lua

  • Intelligent Software Lab.

    Supervised Learning: step_1 data cont`

    Data torch lgfx.go i 1_data.lua

  • Intelligent Software Lab.

    Supervised Learning: step_1 data cont`

    Data torch lgfx.go i 1_data.lua

    Y U V

  • Intelligent Software Lab.

    Supervised Learning: step_2 model

    2_model.lua, model th i 2_model.lua model linear

    th i 2_model.lua model mlp

    th i 2_model.lua model convnet

    model _linear model = nn.Sequential()

    model:add(nn.Reshape(ninputs))

    model:add(nn.Linear(ninputs, noutputs))

    model _mlp model = nn.Sequential()

    model:add(nn.Reshape(ninputs))

    model:add(nn.Linear(ninputs, nhiddens))

    model:add(nn.Tanh())

    model:add(nn.Linear(nhiddens, noutputs))

  • Intelligent Software Lab.

    Thank you

    Torch 7Torch 7Introduction: InstallationTorch7 : BuildingTorch7: Deep learning for NLPTorch 7Introduction: ExamplesTorch7 Torch7 Torch7 Torch7 (2)Torch7 (3)Supervised Learning: step_1 dataSupervised Learning: step_1 data cont`Supervised Learning: step_1 data cont`Supervised Learning: step_1 data cont`Supervised Learning: step_1 data cont`Supervised Learning: step_2 model 17