CorTeX Core ABI 7
ToolTech Software · C++ library reference
Loading...
Searching...
No Matches
ctxData.h
Go to the documentation of this file.
1//*****************************************************************************
2// File : ctxData.h
3// Description : Object-oriented data pipeline
4// Author : Anders Moden
5// Product : CorTeX 2.0.1
6//*****************************************************************************
7#ifndef __CTX_DATA_H__
8#define __CTX_DATA_H__
9
10#include "ctxOutput.h"
11
20
27
33
35{
36public:
37
40 gzUInt32 values, gzUInt32 width = 0, gzUInt32 height = 0,
42 const gzString& spatialGroup = GZ_EMPTY_STRING,
43 const gzString& associatedComponent = GZ_EMPTY_STRING);
45 CTX_EXPORT gzString getName() const;
46 CTX_EXPORT gzUInt32 getValueCount() const;
47 CTX_EXPORT gzUInt32 getWidth() const;
48 CTX_EXPORT gzUInt32 getHeight() const;
50 CTX_EXPORT gzString getSpatialGroup() const;
52 CTX_EXPORT gzBool isMetadata() const;
53 CTX_EXPORT gzBool isValid() const;
54 CTX_EXPORT gzFloat getValue(gzUInt32 index) const;
55 CTX_EXPORT gzBool setValue(gzUInt32 index, gzFloat value);
56 CTX_EXPORT gzString getMetadata() const;
57 CTX_EXPORT gzBool setMetadata(const gzString& value);
58 CTX_EXPORT gzArray<gzFloat>& values();
59 CTX_EXPORT const gzArray<gzFloat>& values() const;
60
61private:
62
64 gzString m_name;
65 gzUInt32 m_width;
66 gzUInt32 m_height;
67 ctxDataInterpolation m_interpolation;
68 gzString m_spatialGroup;
69 gzString m_associatedComponent;
70 gzArray<gzFloat> m_values;
71 gzString m_metadata;
72};
73
74class ctxDataSample : public gzReference
75{
76public:
77
78 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
79
82 CTX_EXPORT virtual gzBool useDeepCopy() override;
83 CTX_EXPORT gzVoid clear();
84 CTX_EXPORT gzBool add(const ctxDataComponent& component);
85 CTX_EXPORT gzUInt32 getComponents() const;
87 CTX_EXPORT const ctxDataComponent* getComponent(gzUInt32 index) const;
89 CTX_EXPORT const ctxDataComponent* find(ctxDataComponentKind kind, const gzString& name) const;
91 CTX_EXPORT gzBool validate(gzString& error) const;
92
93private:
94
95 gzDynamicArray<ctxDataComponent> m_components;
96};
97
98GZ_DECLARE_REFPTR(ctxDataSample);
99
100class ctxDataset : public gzReference
101{
102public:
103
104 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
105
106 CTX_EXPORT virtual gzUInt32 getSamples() const = 0;
107 CTX_EXPORT virtual gzUInt32 getInputSize() const = 0;
108 CTX_EXPORT virtual gzUInt32 getTargetSize() const = 0;
109 CTX_EXPORT virtual gzBool readSample(gzUInt32 sample, gzArray<gzFloat>& input,
110 gzArray<gzFloat>& target) const = 0;
111 CTX_EXPORT virtual gzBool readDataSample(gzUInt32 sample, ctxDataSample& data) const;
112};
113
114GZ_DECLARE_REFPTR(ctxDataset);
115
122
123class ctxDatasetSplit : public gzReference
124{
125public:
126
127 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
128
130 gzUInt32 sampleCount = CTX_UNDEFINED_INDEX);
132 CTX_EXPORT gzUInt32 getFirstSample() const;
133 CTX_EXPORT gzUInt32 getSampleCount() const;
134 CTX_EXPORT gzBool resolve(ctxDataset* dataset, gzUInt32& firstSample,
135 gzUInt32& sampleCount) const;
136
137private:
138
139 ctxDatasetSplitKind m_kind;
140 gzUInt32 m_firstSample;
141 gzUInt32 m_sampleCount;
142};
143
144GZ_DECLARE_REFPTR(ctxDatasetSplit);
145
147{
148public:
149
150 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
151
152 CTX_EXPORT ctxGeneratedScalarDataset(gzUInt32 samples, gzFloat first = 0.0f,
153 gzFloat step = 1.0f, gzFloat targetScale = 1.0f, gzFloat targetOffset = 0.0f);
154 CTX_EXPORT virtual gzUInt32 getSamples() const;
155 CTX_EXPORT virtual gzUInt32 getInputSize() const;
156 CTX_EXPORT virtual gzUInt32 getTargetSize() const;
157 CTX_EXPORT virtual gzBool readSample(gzUInt32 sample, gzArray<gzFloat>& input,
158 gzArray<gzFloat>& target) const;
159
160private:
161
162 gzUInt32 m_samples;
163 gzFloat m_first;
164 gzFloat m_step;
165 gzFloat m_targetScale;
166 gzFloat m_targetOffset;
167};
168
169GZ_DECLARE_REFPTR(ctxGeneratedScalarDataset);
170
172{
173public:
174
175 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
176
177 CTX_EXPORT ctxIdxDataset(const gzString& imageURL, const gzString& labelURL,
178 gzUInt32 categories = 10, gzBool normalize = TRUE);
179 CTX_EXPORT gzBool isValid() const;
180 CTX_EXPORT gzString getError() const;
181 CTX_EXPORT gzUInt32 getRows() const;
182 CTX_EXPORT gzUInt32 getColumns() const;
183 CTX_EXPORT virtual gzUInt32 getSamples() const;
184 CTX_EXPORT virtual gzUInt32 getInputSize() const;
185 CTX_EXPORT virtual gzUInt32 getTargetSize() const;
186 CTX_EXPORT virtual gzBool readSample(gzUInt32 sample, gzArray<gzFloat>& input,
187 gzArray<gzFloat>& target) const;
188
189private:
190
191 gzUInt32 m_samples;
192 gzUInt32 m_rows;
193 gzUInt32 m_columns;
194 gzUInt32 m_categories;
195 gzBool m_normalize;
196 gzArray<gzUByte> m_images;
197 gzArray<gzUByte> m_labels;
198 gzString m_error;
199};
200
201GZ_DECLARE_REFPTR(ctxIdxDataset);
202
203class ctxDataTransform : public gzReference
204{
205public:
206
207 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
208
209 CTX_EXPORT virtual gzBool apply(gzUInt32 sample, gzArray<gzFloat>& input,
210 gzArray<gzFloat>& target) const = 0;
211 CTX_EXPORT virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch);
213 CTX_EXPORT virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample& data) const;
214};
215
216GZ_DECLARE_REFPTR(ctxDataTransform);
217
219{
220public:
221
222 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
223
224 CTX_EXPORT virtual gzBool apply(gzUInt32 sample, gzArray<gzFloat>& input,
225 gzArray<gzFloat>& target) const;
226 CTX_EXPORT virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample& data) const;
227};
228
229GZ_DECLARE_REFPTR(ctxIdentityDataTransform);
230
232{
233public:
234
235 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
236
238 CTX_EXPORT gzBool add(ctxDataTransform* transform);
239 CTX_EXPORT gzUInt32 getSize() const;
240 CTX_EXPORT virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch);
242 CTX_EXPORT virtual gzBool apply(gzUInt32 sample, gzArray<gzFloat>& input,
243 gzArray<gzFloat>& target) const;
244 CTX_EXPORT virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample& data) const;
245
246private:
247
248 mutable gzRefList<ctxDataTransform> m_transforms;
249 gzUInt32 m_size;
250};
251
252GZ_DECLARE_REFPTR(ctxDataTransformPipeline);
253
255{
256public:
257
258 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
259
260 CTX_EXPORT ctxRandomScaleDataTransform(gzFloat minimum, gzFloat maximum);
261 CTX_EXPORT virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch);
262 CTX_EXPORT virtual gzBool apply(gzUInt32 sample, gzArray<gzFloat>& input,
263 gzArray<gzFloat>& target) const;
264
265private:
266
267 gzFloat m_minimum;
268 gzFloat m_maximum;
269 gzUInt32 m_seed;
270 gzUInt32 m_epoch;
271};
272
273GZ_DECLARE_REFPTR(ctxRandomScaleDataTransform);
274
276{
277public:
278
279 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
280
282 gzFloat probability = 0.5f);
283 CTX_EXPORT virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch);
285 CTX_EXPORT virtual gzBool apply(gzUInt32 sample, gzArray<gzFloat>& input,
286 gzArray<gzFloat>& target) const;
287 CTX_EXPORT virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample& data) const;
288 CTX_EXPORT gzBool getDecision(gzUInt32 sample) const;
289
290private:
291
292 gzString m_spatialGroup;
293 gzFloat m_probability;
294 gzUInt32 m_seed;
295 gzUInt32 m_epoch;
296 ctxDataTransformStage m_stage;
297};
298
299GZ_DECLARE_REFPTR(ctxSharedHorizontalFlipDataTransform);
300
306
307class ctxDataCache : public gzReference
308{
309public:
310
311 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
312
316 CTX_EXPORT gzVoid reserve(gzUInt32 samples);
318 CTX_EXPORT gzBool get(gzUInt32 sample, gzArray<gzFloat>& input,
319 gzArray<gzFloat>& target) const;
320 CTX_EXPORT gzBool put(gzUInt32 sample, const gzArray<gzFloat>& input,
321 const gzArray<gzFloat>& target);
322 CTX_EXPORT gzBool get(gzUInt32 sample, ctxDataSample& data) const;
323 CTX_EXPORT gzBool put(gzUInt32 sample, const ctxDataSample& data);
324
325private:
326 ctxDataCacheStage m_stage;
327 gzUInt32 m_samples;
328 gzUInt32 m_inputSize;
329 gzUInt32 m_targetSize;
330 gzUByte* m_valid;
331 gzFloat* m_inputs;
332 gzFloat* m_targets;
333 gzDynamicArray<ctxDataSamplePtr> m_dataSamples;
334};
335
336GZ_DECLARE_REFPTR(ctxDataCache);
337
338class ctxDataBatch : public gzReference
339{
340public:
341
342 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
343
345 CTX_EXPORT gzUInt32 getSize() const;
346 CTX_EXPORT gzUInt32 getCapacity() const;
347 CTX_EXPORT gzUInt32 getInputSize() const;
348 CTX_EXPORT gzUInt32 getTargetSize() const;
349 CTX_EXPORT gzUInt32 getSampleIndex(gzUInt32 page) const;
350 CTX_EXPORT gzFloat getInputValue(gzUInt32 page, gzUInt32 index) const;
351 CTX_EXPORT gzFloat getTargetValue(gzUInt32 page, gzUInt32 index) const;
352 CTX_EXPORT gzUInt32 getComponents() const;
354 CTX_EXPORT gzString getComponentName(gzUInt32 component) const;
355 CTX_EXPORT gzUInt32 getComponentSize(gzUInt32 component) const;
356 CTX_EXPORT gzUInt32 getComponentWidth(gzUInt32 component) const;
357 CTX_EXPORT gzUInt32 getComponentHeight(gzUInt32 component) const;
358 CTX_EXPORT gzUInt32 findComponent(ctxDataComponentKind kind, const gzString& name) const;
359 CTX_EXPORT gzFloat getComponentValue(gzUInt32 page, gzUInt32 component,
360 gzUInt32 index) const;
361 CTX_EXPORT gzString getComponentMetadata(gzUInt32 page, gzUInt32 component) const;
362
363private:
364
365 friend class ctxDataLoader;
366 friend class ctxDataPrefetch;
367 gzVoid configure(gzUInt32 capacity, gzUInt32 inputSize, gzUInt32 targetSize);
368 gzBool configure(gzUInt32 capacity, const ctxDataSample& sample, gzString& error);
369 gzBool append(gzUInt32 page, gzUInt32 sampleIndex, const ctxDataSample& sample,
370 gzString& error);
371
372 gzUInt32 m_size;
373 gzUInt32 m_capacity;
374 gzUInt32 m_inputSize;
375 gzUInt32 m_targetSize;
376 gzArray<gzUInt32> m_sampleIndices;
377 gzArray<gzFloat> m_inputValues;
378 gzArray<gzFloat> m_targetValues;
379 gzDynamicArray<ctxDataComponent> m_components;
380 gzDynamicArray<gzArray<gzFloat> > m_componentValues;
381 gzDynamicArray<gzArray<gzString> > m_componentMetadata;
382};
383
384GZ_DECLARE_REFPTR(ctxDataBatch);
385
386class ctxDataPrefetch : public gzReference
387{
388public:
389
390 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
391
392 CTX_EXPORT ctxDataPrefetch(gzUInt32 batches = 1);
393 CTX_EXPORT gzBool setBatches(gzUInt32 batches);
394 CTX_EXPORT gzUInt32 getBatches() const;
395 CTX_EXPORT gzUInt32 getReady() const;
397
398private:
399
400 friend class ctxDataLoader;
401 gzBool push(ctxDataBatch* batch);
402 gzBool pop(ctxDataBatch* batch);
403
404 gzRefList<ctxDataBatch> m_batches;
405 gzUInt32 m_capacity;
406};
407
408GZ_DECLARE_REFPTR(ctxDataPrefetch);
409
410class ctxDataLoader : public gzReference
411{
412public:
413
414 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
415
416 CTX_EXPORT ctxDataLoader(ctxDataset* dataset, gzUInt32 batchSize,
417 gzBool shuffle = FALSE, gzUInt32 seed = 0, gzUInt32 firstSample = 0,
418 gzUInt32 sampleCount = CTX_UNDEFINED_INDEX);
419 CTX_EXPORT ctxDataLoader(ctxDataset* dataset, ctxDatasetSplit* split, gzUInt32 batchSize,
420 gzBool shuffle = FALSE, gzUInt32 seed = 0);
426 CTX_EXPORT gzVoid setAugmentationEnabled(gzBool enabled);
427 CTX_EXPORT gzBool reset(gzUInt32 epoch = 0);
429 CTX_EXPORT gzUInt32 getSamples() const;
430 CTX_EXPORT gzUInt32 getBatchSize() const;
431 CTX_EXPORT gzString getError() const;
432
433private:
434
435 gzUInt32 nextRandom();
436 gzBool constructBatch(ctxDataBatch* batch);
437 gzBool fillPrefetch();
438
439 ctxDatasetPtr m_dataset;
440 ctxDataTransformPtr m_preprocess;
441 ctxDataTransformPtr m_augmentation;
442 ctxDataCachePtr m_cache;
443 ctxDataPrefetchPtr m_prefetch;
444 gzArray<gzUInt32> m_order;
445 gzUInt32 m_batchSize;
446 gzUInt32 m_firstSample;
447 gzUInt32 m_sampleCount;
448 gzUInt32 m_seed;
449 gzUInt32 m_randomState;
450 gzUInt32 m_offset;
451 gzBool m_shuffle;
452 gzBool m_augmentationEnabled;
453 gzBool m_splitValid;
454 gzString m_error;
455};
456
457GZ_DECLARE_REFPTR(ctxDataLoader);
458
460{
461public:
462
463 CTX_EXPORT ctxBatchInputBinding(const gzString& port = GZ_EMPTY_STRING,
464 gzUInt32 expectedSize = CTX_UNDEFINED_INDEX,
465 const gzString& component = GZ_EMPTY_STRING);
467 CTX_EXPORT gzString getPort() const;
468 CTX_EXPORT virtual gzFloat getValue(ctxContext* context, gzUInt32 index = 0,
469 gzUInt32 sample = 0);
470 CTX_EXPORT virtual gzUInt32 getSampleSize();
471 CTX_EXPORT virtual gzUInt32 getSamples();
472
473private:
474
475 gzString m_port;
476 gzUInt32 m_expectedSize;
477 gzString m_component;
478 gzUInt32 m_componentIndex;
479 ctxDataBatchPtr m_batch;
480};
481
482GZ_DECLARE_REFPTR(ctxBatchInputBinding);
483
485{
486public:
487
488 CTX_EXPORT ctxBatchTargetBinding(const gzString& port = GZ_EMPTY_STRING,
489 gzUInt32 expectedSize = CTX_UNDEFINED_INDEX,
490 const gzString& component = GZ_EMPTY_STRING);
492 CTX_EXPORT gzString getPort() const;
493 CTX_EXPORT virtual gzFloat getExpectedValue(ctxContext* context, gzUInt32 index,
494 gzUInt32 sample);
495 CTX_EXPORT virtual gzUInt32 getResultSize();
496 CTX_EXPORT virtual gzUInt32 getResults();
497
498private:
499
500 gzString m_port;
501 gzUInt32 m_expectedSize;
502 gzString m_component;
503 gzUInt32 m_componentIndex;
504 ctxDataBatchPtr m_batch;
505};
506
507GZ_DECLARE_REFPTR(ctxBatchTargetBinding);
508
509#endif // __CTX_DATA_H__
virtual gzUInt32 getSamples()
gzBool bind(ctxDataBatch *batch)
ctxBatchInputBinding(const gzString &port=GZ_EMPTY_STRING, gzUInt32 expectedSize=CTX_UNDEFINED_INDEX, const gzString &component=GZ_EMPTY_STRING)
virtual gzUInt32 getSampleSize()
gzString getPort() const
virtual gzFloat getValue(ctxContext *context, gzUInt32 index=0, gzUInt32 sample=0)
virtual gzUInt32 getResultSize()
virtual gzUInt32 getResults()
gzString getPort() const
virtual gzFloat getExpectedValue(ctxContext *context, gzUInt32 index, gzUInt32 sample)
gzBool bind(ctxDataBatch *batch)
ctxBatchTargetBinding(const gzString &port=GZ_EMPTY_STRING, gzUInt32 expectedSize=CTX_UNDEFINED_INDEX, const gzString &component=GZ_EMPTY_STRING)
gzUInt32 getComponents() const
gzUInt32 getSize() const
gzUInt32 getTargetSize() const
friend class ctxDataLoader
Definition ctxData.h:365
gzUInt32 getComponentHeight(gzUInt32 component) const
ctxDataComponentKind getComponentKind(gzUInt32 component) const
gzUInt32 getInputSize() const
gzUInt32 getComponentWidth(gzUInt32 component) const
gzFloat getInputValue(gzUInt32 page, gzUInt32 index) const
gzUInt32 getSampleIndex(gzUInt32 page) const
gzUInt32 findComponent(ctxDataComponentKind kind, const gzString &name) const
gzFloat getComponentValue(gzUInt32 page, gzUInt32 component, gzUInt32 index) const
gzFloat getTargetValue(gzUInt32 page, gzUInt32 index) const
gzString getComponentName(gzUInt32 component) const
gzUInt32 getComponentSize(gzUInt32 component) const
friend class ctxDataPrefetch
Definition ctxData.h:366
gzUInt32 getCapacity() const
gzString getComponentMetadata(gzUInt32 page, gzUInt32 component) const
virtual ~ctxDataCache()
ctxDataCache(ctxDataCacheStage stage=CTX_DATA_CACHE_DETERMINISTIC)
gzVoid reserve(gzUInt32 samples)
ctxDataCacheStage getStage() const
gzBool get(gzUInt32 sample, ctxDataSample &data) const
gzVoid clear()
gzBool get(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
gzBool put(gzUInt32 sample, const gzArray< gzFloat > &input, const gzArray< gzFloat > &target)
gzBool put(gzUInt32 sample, const ctxDataSample &data)
ctxDataInterpolation getInterpolation() const
gzBool isMetadata() const
gzBool setMetadata(const gzString &value)
gzArray< gzFloat > & values()
gzUInt32 getValueCount() const
gzUInt32 getHeight() const
ctxDataComponentKind getKind() const
gzFloat getValue(gzUInt32 index) const
gzString getName() const
const gzArray< gzFloat > & values() const
gzUInt32 getWidth() const
gzBool setValue(gzUInt32 index, gzFloat value)
gzString getAssociatedComponent() const
gzString getMetadata() const
ctxDataComponent(ctxDataComponentKind kind, const gzString &name, gzUInt32 values, gzUInt32 width=0, gzUInt32 height=0, ctxDataInterpolation interpolation=CTX_DATA_INTERPOLATION_NONE, const gzString &spatialGroup=GZ_EMPTY_STRING, const gzString &associatedComponent=GZ_EMPTY_STRING)
gzBool isValid() const
gzString getSpatialGroup() const
gzBool setCache(ctxDataCache *cache)
gzBool setTransform(ctxDataTransform *transform)
ctxDataLoader(ctxDataset *dataset, gzUInt32 batchSize, gzBool shuffle=FALSE, gzUInt32 seed=0, gzUInt32 firstSample=0, gzUInt32 sampleCount=CTX_UNDEFINED_INDEX)
gzString getError() const
gzBool setPrefetch(ctxDataPrefetch *prefetch)
gzUInt32 getBatchSize() const
gzUInt32 getSamples() const
gzBool next(ctxDataBatch *batch)
gzBool setPreprocess(ctxDataTransform *transform)
gzBool setAugmentation(ctxDataTransform *transform)
gzVoid setAugmentationEnabled(gzBool enabled)
gzBool reset(gzUInt32 epoch=0)
ctxDataLoader(ctxDataset *dataset, ctxDatasetSplit *split, gzUInt32 batchSize, gzBool shuffle=FALSE, gzUInt32 seed=0)
gzUInt32 getReady() const
friend class ctxDataLoader
Definition ctxData.h:400
gzBool setBatches(gzUInt32 batches)
ctxDataPrefetch(gzUInt32 batches=1)
gzUInt32 getBatches() const
gzUInt32 count(ctxDataComponentKind kind) const
ctxDataComponent * find(ctxDataComponentKind kind, const gzString &name)
virtual gzBool useDeepCopy() override
gzVoid clear()
gzBool validate(gzString &error) const
ctxDataSample(const ctxDataSample &copy)
ctxDataComponent * getComponent(gzUInt32 index)
const ctxDataComponent * getComponent(gzUInt32 index) const
gzBool add(const ctxDataComponent &component)
gzUInt32 getComponents() const
const ctxDataComponent * find(ctxDataComponentKind kind, const gzString &name) const
virtual gzBool apply(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const =0
virtual gzVoid setStage(ctxDataTransformStage stage)
virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample &data) const
virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch)
virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample &data) const
virtual gzVoid setStage(ctxDataTransformStage stage)
gzUInt32 getSize() const
gzBool add(ctxDataTransform *transform)
virtual gzBool apply(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch)
virtual gzUInt32 getInputSize() const =0
virtual gzUInt32 getTargetSize() const =0
virtual gzBool readSample(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const =0
virtual gzBool readDataSample(gzUInt32 sample, ctxDataSample &data) const
virtual gzUInt32 getSamples() const =0
gzUInt32 getFirstSample() const
gzBool resolve(ctxDataset *dataset, gzUInt32 &firstSample, gzUInt32 &sampleCount) const
ctxDatasetSplitKind getKind() const
gzUInt32 getSampleCount() const
ctxDatasetSplit(ctxDatasetSplitKind kind, gzUInt32 firstSample, gzUInt32 sampleCount=CTX_UNDEFINED_INDEX)
virtual gzUInt32 getInputSize() const
virtual gzUInt32 getSamples() const
ctxGeneratedScalarDataset(gzUInt32 samples, gzFloat first=0.0f, gzFloat step=1.0f, gzFloat targetScale=1.0f, gzFloat targetOffset=0.0f)
virtual gzBool readSample(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
virtual gzUInt32 getTargetSize() const
virtual gzBool apply(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample &data) const
virtual gzUInt32 getInputSize() const
gzUInt32 getColumns() const
gzString getError() const
virtual gzUInt32 getTargetSize() const
virtual gzBool readSample(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
ctxIdxDataset(const gzString &imageURL, const gzString &labelURL, gzUInt32 categories=10, gzBool normalize=TRUE)
virtual gzUInt32 getSamples() const
gzUInt32 getRows() const
gzBool isValid() const
ctxRandomScaleDataTransform(gzFloat minimum, gzFloat maximum)
virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch)
virtual gzBool apply(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
virtual gzVoid setStage(ctxDataTransformStage stage)
virtual gzVoid setRandomState(gzUInt32 seed, gzUInt32 epoch)
gzBool getDecision(gzUInt32 sample) const
ctxSharedHorizontalFlipDataTransform(const gzString &spatialGroup, gzFloat probability=0.5f)
virtual gzBool applyDataSample(gzUInt32 sample, ctxDataSample &data) const
virtual gzBool apply(gzUInt32 sample, gzArray< gzFloat > &input, gzArray< gzFloat > &target) const
#define CTX_EXPORT
Definition ctxBase.h:68
ctxDataTransformStage
Definition ctxData.h:29
@ CTX_DATA_TRANSFORM_AUGMENTATION
Definition ctxData.h:31
@ CTX_DATA_TRANSFORM_PREPROCESS
Definition ctxData.h:30
ctxDataComponentKind
Definition ctxData.h:13
@ CTX_DATA_COMPONENT_TARGET
Definition ctxData.h:15
@ CTX_DATA_COMPONENT_WEIGHT
Definition ctxData.h:16
@ CTX_DATA_COMPONENT_METADATA
Definition ctxData.h:18
@ CTX_DATA_COMPONENT_MASK
Definition ctxData.h:17
@ CTX_DATA_COMPONENT_INPUT
Definition ctxData.h:14
ctxDatasetSplitKind
Definition ctxData.h:117
@ CTX_DATA_SPLIT_VALIDATION
Definition ctxData.h:119
@ CTX_DATA_SPLIT_TEST
Definition ctxData.h:120
@ CTX_DATA_SPLIT_TRAIN
Definition ctxData.h:118
ctxDataInterpolation
Definition ctxData.h:22
@ CTX_DATA_INTERPOLATION_NEAREST
Definition ctxData.h:24
@ CTX_DATA_INTERPOLATION_LINEAR
Definition ctxData.h:25
@ CTX_DATA_INTERPOLATION_NONE
Definition ctxData.h:23
ctxDataCacheStage
Definition ctxData.h:302
@ CTX_DATA_CACHE_DETERMINISTIC
Definition ctxData.h:304
@ CTX_DATA_CACHE_SOURCE
Definition ctxData.h:303
const gzUInt32 CTX_UNDEFINED_INDEX
Definition ctxTypes.h:35