1 // Copyright (C) 2020 by Yuri Victorovich. All rights reserved. 2 3 #pragma once 4 5 #include <vector> 6 7 #include <stddef.h> // for size_t 8 9 #include <vector> 10 #include <tuple> 11 12 // various data types involved in NN model data 13 14 enum WidthHeight { 15 WIDTH, 16 HEIGHT 17 }; 18 19 enum InputNormalizationRange { 20 InputNormalizationRange_0_1, 21 InputNormalizationRange_0_255, 22 InputNormalizationRange_0_128, 23 InputNormalizationRange_0_64, 24 InputNormalizationRange_0_32, 25 InputNormalizationRange_0_16, 26 InputNormalizationRange_0_8, 27 InputNormalizationRange_M1_P1, 28 InputNormalizationRange_M05_P05, 29 InputNormalizationRange_14_34, 30 InputNormalizationRange_ImageNet 31 }; 32 33 enum InputNormalizationColorOrder { 34 InputNormalizationColorOrder_RGB, 35 InputNormalizationColorOrder_BGR 36 }; 37 38 enum OutputInterpretationKind { 39 OutputInterpretationKind_Undefined, 40 OutputInterpretationKind_ImageNet1001, 41 OutputInterpretationKind_ImageNet1000, 42 OutputInterpretationKind_NoYes, 43 OutputInterpretationKind_YesNo, 44 OutputInterpretationKind_PixelClassification, 45 OutputInterpretationKind_ImageConversion 46 }; 47 48 typedef std::tuple<InputNormalizationRange,InputNormalizationColorOrder> InputNormalization; 49 50 // based on ComputePaddingWithOffset from the TF Lite project in order to match the results 51 std::tuple<unsigned,unsigned> computePaddingValues(unsigned stride, unsigned dilationRate, unsigned inSize, int filterSize, int outSize); 52