File: ImageDataImpl.hpp

package info (click to toggle)
libxsmm 1.17-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 14,976 kB
  • sloc: ansic: 119,587; cpp: 27,680; fortran: 9,179; sh: 5,765; makefile: 5,040; pascal: 2,312; python: 1,812; f90: 1,773
file content (76 lines) | stat: -rw-r--r-- 1,947 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/******************************************************************************
* Copyright (c) Intel Corporation - All rights reserved.                      *
* This file is part of the LIBXSMM library.                                   *
*                                                                             *
* For information on the license, see the LICENSE file.                       *
* Further information: https://github.com/hfp/libxsmm/                        *
* SPDX-License-Identifier: BSD-3-Clause                                       *
******************************************************************************/
/* Sasikanth Avancha, Dhiraj Kalamkar (Intel Corp.)
******************************************************************************/


#pragma once
#include <string>
#include <vector>
#include <omp.h>
#include <math.h>
#include <limits.h>
#include <chrono>
#include "Engine.hpp"
#include "io.hpp"

#define RGB_FLATFILE 0
#define JPEG_FLATFILE 1
#define RGB_LMDB 2
#define JPEG_LMDB 3

using namespace std;

typedef struct
{
  bool mirror;
  bool vignette;
  bool color_bump;
} AugmentParams;

typedef struct
{
  string name;
  int height;
  int width;
  int length;
  int label;
} ImageInfo;

typedef struct
{
  int batch_size;
  int channels;
  vector<int> orig_sizes;
  vector<int> crop_sizes;
  vector<float> mean_values;
  vector<float> scale_values;
  int test_views;
  int lookahead;
  int threads;
  int exec_mode;
} DataImplParams;

class ImageDataImpl
{
  protected:
    DataImplParams *gp;
    AugmentParams *ap;
    unsigned int* tenSeeds_;
  public:
    ImageDataImpl(DataImplParams *gp_, AugmentParams *ap_): gp(gp_), ap(ap_)
    {
      tenSeeds_ = new unsigned int[gp->threads*16];
      initSeeds(tenSeeds_, gp->threads);
    }

    virtual void forwardPropagate(unsigned char *inp, float *outp) = 0;
    virtual void forwardPropagate(unsigned char *inp, int test_view, float *outp) = 0;
};