Hello,
I have designed triplet network as following and trained with SGD woth batch size -:200, and learning rate .0001 ans also chanaged different batch size and lr but getting same loss curve as above
Network :
-----------------------------------------------------------------------
-- Network definition
-------------------------------------------------------------------------------
convNet = nn.Sequential()
convNet:add(nn.Linear(4096, 2000))
convNet:add(cudnn.BatchNormalization(2000))
convNet:add(cudnn.ReLU())
convNet:add(nn.Dropout(0.25))
convNet:add(nn.Linear(2000, 1000))
-- Cost function
criterion = nn.TripletEmbeddingCriterion()
-------------------------------------------------------------------------------
--get parameter
-------------------------------------------------------------------------------
params, grad_params =getparameters(convNet)
-------------------------------------------------------------------------------
--Create triplet
-------------------------------------------------------------------------------
CreateTriplet = function(Net)
prl = nn.ParallelTable()
convNetPos = Net:clone('weight', 'bias', 'gradWeight', 'gradBias')
convNetNeg = Net:clone('weight', 'bias', 'gradWeight', 'gradBias')
-- Parallel container
prl:add(Net)
prl:add(convNetPos)
prl:add(convNetNeg)
print(b('Fresh-embeddings-computation network:')); print(prl)
return prl
end
local triplet_model = CreateTriplet(convNet)
-----------------------------------------------------------
--some code is missing
--------------------------------------------------------------
local prediction = triplet_model:forward({aImgs, pImgs, nImgs}) -- this will need 200*4096
-----------------------------------------------------------------------------------------------------
--criterion: Triplet loss;
local loss = criterion:forward(prediction)
-----------------------------------------------------------------------------
-- backward pass
----------------------------------------------------------------------------------
dloss = criterion:backward(prediction) --errGrad
------------------------------------------------------------------------------------
--classifier back prop
dprediction = triplet_model:backward({aImgs, pImgs, nImgs}, dloss)
-----------------------------------------------------
I have refereed following link for triplet net
https://github.com/Atcold/torch-TripletEmbedding Please let me know what i have to change in order to converge the network.