How to train a net from scratch using Python?

50 views
Skip to first unread message

Rishabh Shah

unread,
Apr 11, 2017, 9:09:15 AM4/11/17
to Caffe Users
Hi all,

I have been working on semantic segmentation where I feed the data using Python layers created here . I want to train my own network in caffe using Python. My attempts at this have been futile. What I am currently doing is shown in the following Python code.


caffe.set_mode_cpu()

net
= caffe.Net('/home/stylabs/projects/codes/imageSegmentation/semanticSegmentation/fcn.berkeleyvision.org-master/voc-fcn8s-myModel/train.prototxt', caffe.TRAIN)
solver
= caffe.SGDSolver('solver.prototxt')
# solver.net.copy_from(weights)

# surgeries
interp_layers
= [k for k in solver.net.params.keys() if 'up' in k]
surgery
.interp(solver.net, interp_layers)

# scoring
val
= np.loadtxt('/home/stylabs/projects/data/imageSegmentation/semanticSegmentation/104_108_63_122_300x300/test.txt', dtype=str)



for _ in range(50):
    solver
.step(100)

However after each solver iteration there is no update of the weights as my weights have all been initialized to zero. Even though, in my prototxt I have specified weight_filler and bias_filler parameters in train.prototxt, all my weights have been initialized to zero. Why aren't my weight initialized to parameters mentioned in weight_filler? Also, is there any approach to solve the issue?

Reply all
Reply to author
Forward
0 new messages