MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / loadData

Method loadData

quantization/data_mnist.js:180–196  ·  view source on GitHub ↗

Loads training and test data.

()

Source from the content-addressed store, hash-verified

178
179 /** Loads training and test data. */
180 async loadData() {
181 const baseUrlAndFilePaths = this.getBaseUrlAndFilePaths();
182 const baseUrl = baseUrlAndFilePaths.baseUrl;
183 const destDir = baseUrlAndFilePaths.destDir;
184 if (!(await exists(destDir))) {
185 await mkdir(destDir);
186 }
187
188 this.dataset = await Promise.all([
189 loadImages(baseUrl, destDir, baseUrlAndFilePaths.trainImages),
190 loadLabels(baseUrl, destDir, baseUrlAndFilePaths.trainLabels),
191 loadImages(baseUrl, destDir, baseUrlAndFilePaths.testImages),
192 loadLabels(baseUrl, destDir, baseUrlAndFilePaths.testLabels)
193 ]);
194 this.trainSize = this.dataset[0].length;
195 this.testSize = this.dataset[2].length;
196 }
197
198 getTrainData() {
199 return this.getData_(true);

Callers 2

mainFunction · 0.45
mainFunction · 0.45

Calls 3

loadImagesFunction · 0.70
loadLabelsFunction · 0.70

Tested by

no test coverage detected