caffe: model definition: write same layer with different phase using caffe.NetSpec()

前端 未结 5 717
野性不改
野性不改 2020-12-03 23:00

I want to set up a caffe CNN with python, using caffe.NetSpec() interface. Although I saw we can put test net in solver.prototxt, I would like to w

5条回答
  •  醉话见心
    2020-12-03 23:43

    I find an useful method.

    You can add a key named name for your test phase layer, and modify the keys ntop and top just like this:

    net.data = L.Data(name='data', 
                    include=dict(phase=caffe_pb2.Phase.Value('TRAIN')),
                    ntop=1)
    net.test_data = L.Data(name='data', 
                        include=dict(phase=caffe_pb2.Phase.Value('TEST')),
                        top='data',
                        ntop=0)
    

提交回复
热议问题