4 #ifndef __INPUTLAYER_HPP__ 5 #define __INPUTLAYER_HPP__ 7 #include "HyPerLayer.hpp" 8 #include "checkpointing/CheckpointableFileStream.hpp" 9 #include "columns/HyPerCol.hpp" 10 #include "components/BatchIndexer.hpp" 11 #include "structures/Buffer.hpp" 12 #include "utils/BorderExchange.hpp" 13 #include "utils/BufferUtilsRescale.hpp" 23 virtual void ioParam_inputPath(
enum ParamsIOFlag ioFlag);
28 virtual int ioParam_offsets(
enum ParamsIOFlag ioFlag);
33 virtual int ioParam_maxShifts(
enum ParamsIOFlag ioFlag);
36 virtual int ioParam_flipsEnabled(
enum ParamsIOFlag ioFlag);
39 virtual int ioParam_flipsToggle(
enum ParamsIOFlag ioFlag);
42 virtual int ioParam_jitterChangeInterval(
enum ParamsIOFlag ioFlag);
48 virtual void ioParam_offsetAnchor(
enum ParamsIOFlag ioFlag);
51 virtual void ioParam_autoResizeFlag(
enum ParamsIOFlag ioFlag);
54 virtual void ioParam_aspectRatioAdjustment(
enum ParamsIOFlag ioFlag);
57 virtual void ioParam_interpolationMethod(
enum ParamsIOFlag ioFlag);
61 virtual void ioParam_inverseFlag(
enum ParamsIOFlag ioFlag);
65 virtual void ioParam_normalizeLuminanceFlag(
enum ParamsIOFlag ioFlag);
71 virtual void ioParam_normalizeStdDev(
enum ParamsIOFlag ioFlag);
75 virtual void ioParam_padValue(
enum ParamsIOFlag ioFlag);
87 virtual void ioParam_displayPeriod(
enum ParamsIOFlag ioFlag);
91 virtual void ioParam_start_frame_index(
enum ParamsIOFlag ioFlag);
95 virtual void ioParam_skip_frame_index(
enum ParamsIOFlag ioFlag);
102 virtual void ioParam_writeFrameToTimestamp(
enum ParamsIOFlag ioFlag);
107 virtual void ioParam_resetToStartOnLoop(
enum ParamsIOFlag ioFlag);
114 virtual void ioParam_batchMethod(
enum ParamsIOFlag ioFlag);
117 virtual void ioParam_randomSeed(
enum ParamsIOFlag ioFlag);
120 virtual void ioParam_useInputBCflag(
enum ParamsIOFlag ioFlag);
129 int scatterInput(
int localBatchIndex,
int mpiBatchIndex);
130 int initialize(
const char *name,
HyPerCol *hc);
135 int checkValidAnchorString(
const char *offsetAnchor);
144 virtual void allocateV()
override;
145 virtual void initializeV()
override;
146 virtual void initializeActivity()
override;
148 virtual Response::Status registerData(
Checkpointer *checkpointer)
override;
149 virtual Response::Status readStateFromCheckpoint(
Checkpointer *checkpointer)
override;
154 virtual bool readyForNextFile();
181 void initializeBatchIndexer();
187 virtual int requireChannel(
int channelNeeded,
int *numChannelsResult)
override;
188 void makeInputRegionsPointer() { mNeedInputRegionsPointer =
true; }
189 virtual Response::Status allocateDataStructures()
override;
190 virtual Response::Status updateState(
double time,
double dt)
override;
202 virtual bool activityIsSpiking()
override {
return false; }
203 int getDisplayPeriod() {
return mDisplayPeriod; }
204 int getStartIndex(
int batchIndex) {
return mStartFrameIndex.at(batchIndex); }
205 int getSkipIndex(
int batchIndex) {
return mSkipFrameIndex.at(batchIndex); }
206 const std::string &getInputPath()
const {
return mInputPath; }
220 float *getInputRegionsAllBatchElements() {
return mInputRegionsAllBatchElements.data(); }
234 BufferUtils::RescaleMethod mRescaleMethod;
237 BufferUtils::InterpolationMethod mInterpolationMethod = BufferUtils::BICUBIC;
243 bool mAutoResizeFlag =
false;
246 bool mInverseFlag =
false;
249 bool mUseInputBCflag =
false;
252 bool mNormalizeLuminanceFlag =
false;
256 bool mNormalizeStdDev =
true;
267 int mJitterChangeInterval = 1;
270 bool mXFlipEnabled =
false;
271 bool mYFlipEnabled =
false;
274 bool mXFlipToggle =
false;
275 bool mYFlipToggle =
false;
278 int mRandomSeed = 123456789;
281 std::unique_ptr<BatchIndexer> mBatchIndexer;
282 BatchIndexer::BatchMethod mBatchMethod;
286 std::vector<Buffer<float>> mInputData;
294 std::vector<Buffer<float>> mInputRegion;
296 bool mNeedInputRegionsPointer =
false;
302 std::vector<float> mInputRegionsAllBatchElements;
308 float mPadValue = 0.0f;
311 std::string mInputPath;
318 int mDisplayPeriod = 0;
322 bool mResetToStartOnLoop =
false;
325 bool mWriteFrameToTimestamp =
true;
328 std::vector<int> mStartFrameIndex;
331 std::vector<int> mSkipFrameIndex;
336 std::vector<int> mRandomShiftX;
338 std::vector<int> mRandomShiftY;
340 std::vector<bool> mMirrorFlipX;
341 std::vector<bool> mMirrorFlipY;