using pycaffe to read prototxt

1,003 views
Skip to first unread message

Ali Mousavi

unread,
Aug 31, 2015, 11:30:05 PM8/31/15
to Caffe Users
I'm trying to read my caffe models in python so I can take the last train caffemodel, add some weights to it and use it as an initialization for another file.

Im new to pycaffe and I get the following error:

    libprotobuf ERROR google/protobuf/text_format.cc:172] Error parsing text-format caffe.NetParameter: 1:10: Message type "caffe.NetParameter" has no field named "train_net".
    WARNING: Logging before InitGoogleLogging() is written to STDERR
    F0831 20:19:51.970383 15975 upgrade_proto.cpp:928] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: ./voc12/config/vgg128_noup/solver_train_aug.prototxt
    *** Check failure stack trace: ***
    Aborted (core dumped)


here is my python code

    import numpy as np
    import Image
    caffe_root = './'  # this file is expected to be in {caffe_root}/examples
    import sys
    sys.path.insert(0, caffe_root + 'python')
    
    import caffe
    
    
    # Load the original network and extract the fully connected layers' parameters.
    model= './voc12/config/vgg128_noup/solver_train_aug.prototxt'
    #model = './examples/mnist/lenet_solver.prototxt'
    weights = './voc12/model/vgg128_noup/train_iter_6000.caffemodel'
    net = caffe.Classifier(model, 
                    weights)

below is my solver prototext:

    train_net: "voc12/config/vgg128_noup/train_train_aug.prototxt"
    
    lr_policy: "step"
    gamma: 0.1
    stepsize: 2000
    base_lr: 0.001
    
    display: 10
    max_iter: 6000
    momentum: 0.9
    weight_decay: 0.0005
    
    snapshot: 2000
    snapshot_prefix: "voc12/model/vgg128_noup/train"
    solver_mode: GPU
                                                                                                                                                                                    

any suggestions                   

Cyndi

unread,
Sep 1, 2015, 12:01:43 AM9/1/15
to Caffe Users
Your model should be the your train/test deploy prototxt, not the solver prototxt (for example, look at "models/bvlc_reference_caffenet/deploy.prototxt")
Reply all
Reply to author
Forward
0 new messages