Loads training and test data.
()
| 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); |
no test coverage detected