samedi 9 juillet 2016

Edit prototxt file from python

I would like to edit a prototxt file using python. I simply need to change the source from one directory to another. Is there a simple way to go about this, to not have to redefine the net and rewrite the entire file?

For example, in my prototxt file I have

layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
  }
  data_param {
    source: "examples/imagenet/ilsvrc12_train_lmdb"
    batch_size: 256
    backend: LMDB
  }
}

and I ONLY want to change the field 'source'. This is from a relatively long net def (posted here is just a typical example, I have my own net def), so not having to manually enter every field like in the caffe examples would save me lots of time

Thanks

Aucun commentaire:

Enregistrer un commentaire