BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.01k stars 18.71k forks source link

How can use environment variable in prototxt? #6884

Open hongfangyu opened 4 years ago

hongfangyu commented 4 years ago

Issue summary

I use the caffe docker imge on Ubuntu server, three environment variables are defined and they can only be known in running time. I can use ${log_dir} in bash, like: caffe train --solver=solver.prototxt --weights=weights.caffemodel --gpu=0, 1, 2, 3 2>&1 | tee ${log_dir}/train-log.log but I have to set up model_save_dir in solver.prototxt and data_dir in train.prototxt, how can I use this two environment variable in prototxt?The fellowing two usages will cause errors.

solver.prototxt: ....... snapshot_prefix: "${modelsave}/refine" .......

train.prototxt: layer { name: "fcn" type: "InputData" top: "data" top: "label" include { phase: TRAIN } input_data_param { positive_list: "${data_dir}/positive_list.txt" positive_image_folder: "${data_dir}/positive/" negetive_list: "${data_dir}/negative_list.txt" negetive_image_folder: "${data_dir}/negative/" neg_ratio: 0.5

batch_size: 32
mean_value: 113
pixel_scale: 0.00390625

} }

System configuration