#include "keras_model.h"
Definition at line 177 of file keras_model.h.
keras::LayerConv2D::LayerConv2D |
( |
| ) |
|
|
inline |
Implements keras::Layer.
Definition at line 310 of file keras_model.cc.
References keras::conv_single_depth_same(), keras::conv_single_depth_valid(), keras::DataChunk::get_3d(), keras::DataChunk2D::get_3d_rw(), x, and y.
311 unsigned int st_x = (
m_kernels[0][0].size()-1) >> 1;
312 unsigned int st_y = (
m_kernels[0][0][0].size()-1) >> 1;
313 auto const & im = dc->
get_3d();
315 size_t size_x = (
m_border_mode ==
"valid")? im[0].size() - 2 * st_x : im[0].size();
316 size_t size_y = (
m_border_mode ==
"valid")? im[0][0].size() - 2 * st_y: im[0][0].size();
325 tbb::parallel_for(
size_t(0),
size_t(
m_kernels.size()), [&](
size_t j ) {
327 for(
unsigned int m = 0; m < im.size(); ++m) {
334 for(
unsigned int x = 0;
x < y_ret[0].size(); ++
x) {
336 size_t size = y_ret[0][0].size();
340 for(
unsigned int y = 0;
y < size/8; ++
y) {
341 y_ret[j][
x][k] += bias;
342 y_ret[j][
x][k+1] += bias;
343 y_ret[j][
x][k+2] += bias;
344 y_ret[j][
x][k+3] += bias;
345 y_ret[j][
x][k+4] += bias;
346 y_ret[j][
x][k+5] += bias;
347 y_ret[j][
x][k+6] += bias;
348 y_ret[j][
x][k+7] += bias;
351 while (k < size) { y_ret[j][
x][k] += bias; ++k; }
void conv_single_depth_valid(std::vector< std::vector< float > > &y, std::vector< std::vector< float > > const &im, std::vector< std::vector< float > > const &k)
std::vector< std::vector< std::vector< std::vector< float > > > > m_kernels
virtual std::vector< std::vector< std::vector< float > > > const & get_3d() const
std::vector< float > m_bias
std::string m_border_mode
std::vector< std::vector< std::vector< float > > > & get_3d_rw()
void conv_single_depth_same(std::vector< std::vector< float > > &y, std::vector< std::vector< float > > const &im, std::vector< std::vector< float > > const &k)
virtual unsigned int keras::LayerConv2D::get_input_cols |
( |
| ) |
const |
|
inlinevirtual |
virtual unsigned int keras::LayerConv2D::get_input_rows |
( |
| ) |
const |
|
inlinevirtual |
std::string keras::Layer::get_name |
( |
| ) |
|
|
inlineinherited |
virtual unsigned int keras::LayerConv2D::get_output_units |
( |
| ) |
const |
|
inlinevirtual |
void keras::LayerConv2D::load_weights |
( |
std::ifstream & |
fin | ) |
|
|
virtual |
Implements keras::Layer.
Definition at line 43 of file keras_model.cc.
References d.
49 if (m_border_mode ==
"[") { m_border_mode =
"valid"; skip =
true; }
52 <<
"x" <<
m_depth <<
"x" <<
m_rows <<
"x" <<
m_cols <<
" border_mode " << m_border_mode << endl;
55 vector<vector<vector<float> > > tmp_depths;
57 vector<vector<float> > tmp_single_depth;
58 for(
int r = 0; r <
m_rows; ++r) {
59 if (!skip) {
fin >> tmp_char; }
60 else { skip =
false; }
61 vector<float> tmp_row;
62 for(
int c = 0; c <
m_cols; ++c) {
65 tmp_row.push_back(tmp_float);
68 tmp_single_depth.push_back(tmp_row);
70 tmp_depths.push_back(tmp_single_depth);
78 m_bias.push_back(tmp_float);
std::vector< std::vector< std::vector< std::vector< float > > > > m_kernels
std::vector< float > m_bias
std::string m_border_mode
std::vector<float> keras::LayerConv2D::m_bias |
std::string keras::LayerConv2D::m_border_mode |
int keras::LayerConv2D::m_cols |
int keras::LayerConv2D::m_depth |
std::vector<std::vector<std::vector<std::vector<float> > > > keras::LayerConv2D::m_kernels |
int keras::LayerConv2D::m_kernels_cnt |
std::string keras::Layer::m_name |
|
inherited |
int keras::LayerConv2D::m_rows |
The documentation for this class was generated from the following files:
- larreco/v06_64_02/source/larreco/RecoAlg/ImagePatternAlgs/Keras/keras_model.h
- larreco/v06_64_02/source/larreco/RecoAlg/ImagePatternAlgs/Keras/keras_model.cc