X1
X2
P1
require "nn"
mlp = nn.Sequential();
inputs = 2; outputs = 1;
mlp:add(nn.Linear(inputs, outputs))
criterion = nn.MSECriterion()
for i = 1,5000 do
local input= torch.randn(2);
local output= torch.Tensor(1);
if input[1]*input[2] > 0 then
output[1] = -1
else
output[1] = 1
end
-- PREDICITON
local prediction = mlp:forward(input)
-- (1) zero the accumulation of the gradients
mlp:zeroGradParameters()
-- (2) accumulate gradients crite:bw() is the gradient vector
mlp:backward(input, criterion:backward(mlp.output, output))
-- (3) update parameters with a 0.01 learning rate
mlp:updateParameters(0.01)
end
require "nn"
mlp = nn.Sequential();
inputs = 5; outputs = 10;
HUs = {20 , 40};
mlp:add(nn.Linear(inputs, HUs[1]))
mlp:add(nn.Tanh())
mlp:add(nn.Linear(HUs[1], HUs[2]))
mlp:add(nn.Tanh())
mlp:add(nn.Linear(HUs[2], outputs))
criterion = nn.MSECriterion()
for i = 1,5000 do
-- same backprop. routine
end
nn.Sequential {
[input -> (1) -> (2) ->
(3) -> (4) -> (5) -> output]
(1): nn.Linear(10 -> 20)
(2): nn.Tanh
(3): nn.Linear(20 -> 40)
(4): nn.Tanh
(5): nn.Linear(40 -> 4)
}
Input Matrix
Output channel 1
Output channel 2
Output channel 3
nn.SpatialConvolution(1 -> channel)
nn.View(channel * w * h)
nn.Linear(channel * w * h -> HiddenSize)
nn.Linear(HiddenSize -> numClasses)
nn.LogSoftMax()
nn.Sequential {
[input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7)
-> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> output]
(1): nn.SpatialConvolution(1 -> 64, 5x5)
(2): nn.ReLU
(3): nn.SpatialConvolution(64 -> 128, 5x5)
(4): nn.ReLU
(5): nn.SpatialConvolution(128 -> 128, 5x5)
(6): nn.ReLU
(7): nn.SpatialMaxPooling(2x2, 2,2)
(8): nn.View(10368)
(9): nn.Linear(10368 -> 512)
(10): nn.ReLU
(11): nn.Linear(512 -> 256)
(12): nn.ReLU
(13): nn.Linear(256 -> 128)
(14): nn.ReLU
(15): nn.Linear(128 -> 40)
(16): nn.LogSoftMax
}
1.8489112831681e-06 ا
8.5918503451228e-07 ب
9.9835042715169e-06 پ
2.911008198596e-06 ت
6.9377831794647e-07 ث
4.2834721628495e-05 ج
0.99981760314176 چ
nn.Serial @ nn.Sequential {
[input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7) -> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> (17) -> (18) -> (19) -> (20) -> (21) -> (22) -> (23) -> (24) -> output]
(1): nn.Convert
(2): nn.SpatialDropout(0.200000)
(3): nn.SpatialConvolution(1 -> 64, 5x5, 1,1, 2,2)
(4): nn.SpatialBatchNormalization
(5): nn.Tanh
(6): nn.SpatialMaxPooling(2x2, 2,2)
(7): nn.SpatialDropout(0.500000)
(8): nn.SpatialConvolution(64 -> 128, 5x5, 1,1, 2,2)
(9): nn.SpatialBatchNormalization
(10): nn.Tanh
(11): nn.SpatialMaxPooling(2x2, 2,2)
(12): nn.Collapse
(13): nn.Dropout(0.500000)
(14): nn.Linear(6272 -> 512)
(15): nn.BatchNormalization
(16): nn.Tanh
(17): nn.Linear(512 -> 256)
(18): nn.BatchNormalization
(19): nn.Tanh
(20): nn.Linear(256 -> 128)
(21): nn.BatchNormalization
(22): nn.Tanh
(23): nn.Linear(128 -> 40)
(24): nn.LogSoftMax
}
The aim is to train the system on computer fonts and test it on handwritten text. In oder words, claim that such dataset is enough to generalize the model to a greater scope
0.00015779999353047 د
3.521212034443e-07 ذ
0.0014876711478155 ر
1.5775675775864e-05 ز
2.7149472579572e-05 ژ
0.97940942162196 س
0.0006677035107906 ش
0.0024584838050561 ص
1.9488518805953e-05 ض
3.917732601588e-05 ط
0.00074010179250526 ت
0.021139973753066 ث
0.55511346194901 ج
0.00092499923480925 چ
0.0015544320115577 ح
0.017658120147062 خ
0.020682373658584 د
0.00085717213848045 ذ
nn.SpatialConvolution(1 -> channel)
nn.View(...)
The entire representation of first column
The entire representation of second column
Timed Sequence
باصعودارسنال
شادی
رونمایی
خرداد
درصد
کیاب
بینایی
ماشین
مباز
کبن