Beispiel #1
0
Net<Dtype>::Net(const string& param_file, Phase phase, const Net* root_net = NULL):
	root_net(root_net){
	NetParameter param;
	readNetParamsFromTextFileOrDie(param_file, &param);
	param.mutable_state()->set_phase(phase);
	Init(param);
}
Beispiel #2
0
	void initTestNet(string model_file, string net_file){
		//	restore learned_net to learned_net_param
		readProtoFromBinaryFile(model_file.c_str(), &learned_net_param);
		//	read text_net to net_param
		readNetParamsFromTextFileOrDie(net_file, &net_param);
		NetState net_state;
		net_state.set_phase(TEST);
		if (net_param.has_state())
			net_state.MergeFrom(net_param.state());	//	low prio (default: not set)
		net_param.mutable_state()->CopyFrom(net_state);
		LOG(INFO) << "Create test net " << ":  " << net_file;
		LOG(INFO) << "		 Source net :  " << model_file;
		net.reset(new Net<Dtype>(net_param));
		//	copy parameters
		net->copyTrainedLayerFrom(learned_net_param);
	}