bob::ip::gabor::JetStatistics::JetStatistics(bob::io::base::HDF5File& hdf5){
  m_meanAbs.reference(hdf5.readArray<double,1>("MeanAbs"));
  m_varAbs.reference(hdf5.readArray<double,1>("VarAbs"));
  m_meanPhase.reference(hdf5.readArray<double,1>("MeanPhase"));
  m_varPhase.reference(hdf5.readArray<double,1>("VarPhase"));
  if (hdf5.hasGroup("Transform")){
    hdf5.cd("Transform");
    m_gwt.reset(new bob::ip::gabor::Transform(hdf5));
    hdf5.cd("..");
  }
}
Exemple #2
0
  void Machine::load (bob::io::base::HDF5File& config) {

    //reads all data directly into the member variables
    m_input_sub.reference(config.readArray<double,1>("input_sub"));
    m_input_div.reference(config.readArray<double,1>("input_div"));
    m_weight.reference(config.readArray<double,2>("weights"));
    m_bias.reference(config.readArray<double,1>("biases"));
    m_buffer.resize(m_input_sub.extent(0));

    //switch between different versions - support for version 1
    if (config.hasAttribute(".", "version")) { //new version
      config.cd("activation");
      m_activation = bob::learn::activation::load_activation(config);
      config.cd("..");
    }
    else { //old version
      uint32_t act = config.read<uint32_t>("activation");
      m_activation = bob::learn::activation::make_deprecated_activation(act);
    }

  }
void bob::ip::gabor::JetStatistics::save(bob::io::base::HDF5File& hdf5, bool saveTransform) const{
  hdf5.setArray("MeanAbs", m_meanAbs);
  hdf5.setArray("VarAbs", m_varAbs);
  hdf5.setArray("MeanPhase", m_meanPhase);
  hdf5.setArray("VarPhase", m_varPhase);
  if (saveTransform && m_gwt){
    hdf5.createGroup("Transform");
    hdf5.cd("Transform");
    m_gwt->save(hdf5);
    hdf5.cd("..");
  }
}
Exemple #4
0
void bob::learn::em::GMMMachine::load(bob::io::base::HDF5File& config) {
  int64_t v;
  v = config.read<int64_t>("m_n_gaussians");
  m_n_gaussians = static_cast<size_t>(v);
  v = config.read<int64_t>("m_n_inputs");
  m_n_inputs = static_cast<size_t>(v);

  m_gaussians.clear();
  for(size_t i=0; i<m_n_gaussians; ++i) {
    m_gaussians.push_back(boost::shared_ptr<bob::learn::em::Gaussian>(new bob::learn::em::Gaussian(m_n_inputs)));
    std::ostringstream oss;
    oss << "m_gaussians" << i;
    config.cd(oss.str());
    m_gaussians[i]->load(config);
    config.cd("..");
  }

  m_weights.resize(m_n_gaussians);
  config.readArray("m_weights", m_weights);

  // Initialise cache
  initCache();
}
Exemple #5
0
  void Machine::save (bob::io::base::HDF5File& config) const {

    config.setAttribute(".", "version", 1);
    config.setArray("input_sub", m_input_sub);
    config.setArray("input_div", m_input_div);
    config.setArray("weights", m_weight);
    config.setArray("biases", m_bias);
    config.createGroup("activation");
    config.cd("activation");
    m_activation->save(config);
    config.cd("..");

  }
Exemple #6
0
void bob::learn::em::GMMMachine::save(bob::io::base::HDF5File& config) const {
  int64_t v = static_cast<int64_t>(m_n_gaussians);
  config.set("m_n_gaussians", v);
  v = static_cast<int64_t>(m_n_inputs);
  config.set("m_n_inputs", v);

  for(size_t i=0; i<m_n_gaussians; ++i) {
    std::ostringstream oss;
    oss << "m_gaussians" << i;

    if (!config.hasGroup(oss.str())) config.createGroup(oss.str());
    config.cd(oss.str());
    m_gaussians[i]->save(config);
    config.cd("..");
  }

  config.setArray("m_weights", m_weights);
}
void bob::learn::boosting::StumpMachine::save(bob::io::base::HDF5File& file) const{
  file.set("Threshold", m_threshold);
  file.set("Polarity", m_polarity);
  file.set("Index", m_index);
  file.setAttribute(".", "MachineType", std::string("StumpMachine"));
}