learning_model 1.0.17 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +5 -1
  2. package/jest.config.js +6 -0
  3. package/lib/learning/mobilenet_image.test.ts +44 -0
  4. package/{src → lib}/learning/mobilenet_image.ts +3 -1
  5. package/lib/learning/util.ts +15 -0
  6. package/package.json +5 -4
  7. package/tsconfig.json +5 -7
  8. package/dist/index.bundle.js +0 -2
  9. package/dist/index.bundle.js.LICENSE.txt +0 -335
  10. package/dist/index.js +0 -10
  11. package/dist/types/index.d.ts +0 -3
  12. package/dist/types/learning/base.d.ts +0 -19
  13. package/dist/types/learning/base.js +0 -2
  14. package/dist/types/learning/image.d.ts +0 -40
  15. package/dist/types/learning/image.js +0 -321
  16. package/dist/types/learning/mobilenet_image.d.ts +0 -42
  17. package/dist/types/learning/mobilenet_image.js +0 -329
  18. package/dist/types/learning/mobilenet_image.test.d.ts +0 -1
  19. package/dist/types/public/index.d.ts +0 -1
  20. package/dist/types/src/index.d.ts +0 -3
  21. package/dist/types/src/learning/base.d.ts +0 -19
  22. package/dist/types/src/learning/image.d.ts +0 -40
  23. package/dist/types/src/learning/mobilenet_image.d.ts +0 -42
  24. package/public/index.css +0 -7
  25. package/public/index.html +0 -15
  26. package/public/index.ts +0 -153
  27. package/src/learning/mobilenet_image.test.ts +0 -63
  28. package/types/index.d.ts +0 -3
  29. package/types/learning/base.d.ts +0 -19
  30. package/types/learning/image.d.ts +0 -40
  31. package/types/learning/mobilenet_image.d.ts +0 -42
  32. package/types/learning/mobilenet_image.test.d.ts +0 -1
  33. package/types/public/index.d.ts +0 -1
  34. package/types/src/index.d.ts +0 -3
  35. package/types/src/learning/base.d.ts +0 -19
  36. package/types/src/learning/image.d.ts +0 -40
  37. package/types/src/learning/mobilenet_image.d.ts +0 -42
  38. /package/{src → lib}/index.ts +0 -0
  39. /package/{src → lib}/learning/base.ts +0 -0
  40. /package/{src → lib}/learning/image.ts +0 -0
@@ -1,335 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC. All Rights Reserved.
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- * =============================================================================
16
- */
17
-
18
- /**
19
- * @license
20
- * Copyright 2018 Google LLC
21
- *
22
- * Use of this source code is governed by an MIT-style
23
- * license that can be found in the LICENSE file or at
24
- * https://opensource.org/licenses/MIT.
25
- * =============================================================================
26
- */
27
-
28
- /**
29
- * @license
30
- * Copyright 2018 Google LLC. All Rights Reserved.
31
- * Licensed under the Apache License, Version 2.0 (the "License");
32
- * you may not use this file except in compliance with the License.
33
- * You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the License is distributed on an "AS IS" BASIS,
39
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
- * See the License for the specific language governing permissions and
41
- * limitations under the License.
42
- *
43
- * =============================================================================
44
- */
45
-
46
- /**
47
- * @license
48
- * Copyright 2018 Google LLC. All Rights Reserved.
49
- * Licensed under the Apache License, Version 2.0 (the "License");
50
- * you may not use this file except in compliance with the License.
51
- * You may obtain a copy of the License at
52
- *
53
- * http://www.apache.org/licenses/LICENSE-2.0
54
- *
55
- * Unless required by applicable law or agreed to in writing, software
56
- * distributed under the License is distributed on an "AS IS" BASIS,
57
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58
- * See the License for the specific language governing permissions and
59
- * limitations under the License.
60
- * =============================================================================
61
- */
62
-
63
- /**
64
- * @license
65
- * Copyright 2019 Google LLC
66
- *
67
- * Use of this source code is governed by an MIT-style
68
- * license that can be found in the LICENSE file or at
69
- * https://opensource.org/licenses/MIT.
70
- * =============================================================================
71
- */
72
-
73
- /**
74
- * @license
75
- * Copyright 2019 Google LLC. All Rights Reserved.
76
- * Licensed under the Apache License, Version 2.0 (the "License");
77
- * you may not use this file except in compliance with the License.
78
- * You may obtain a copy of the License at
79
- *
80
- * http://www.apache.org/licenses/LICENSE-2.0
81
- *
82
- * Unless required by applicable law or agreed to in writing, software
83
- * distributed under the License is distributed on an "AS IS" BASIS,
84
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85
- * See the License for the specific language governing permissions and
86
- * limitations under the License.
87
- *
88
- * =============================================================================
89
- */
90
-
91
- /**
92
- * @license
93
- * Copyright 2019 Google LLC. All Rights Reserved.
94
- * Licensed under the Apache License, Version 2.0 (the "License");
95
- * you may not use this file except in compliance with the License.
96
- * You may obtain a copy of the License at
97
- *
98
- * http://www.apache.org/licenses/LICENSE-2.0
99
- *
100
- * Unless required by applicable law or agreed to in writing, software
101
- * distributed under the License is distributed on an "AS IS" BASIS,
102
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
103
- * See the License for the specific language governing permissions and
104
- * limitations under the License.
105
- * =============================================================================
106
- */
107
-
108
- /**
109
- * @license
110
- * Copyright 2020 Google Inc. All Rights Reserved.
111
- * Licensed under the Apache License, Version 2.0 (the "License");
112
- * you may not use this file except in compliance with the License.
113
- * You may obtain a copy of the License at
114
- *
115
- * http://www.apache.org/licenses/LICENSE-2.0
116
- *
117
- * Unless required by applicable law or agreed to in writing, software
118
- * distributed under the License is distributed on an "AS IS" BASIS,
119
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120
- * See the License for the specific language governing permissions and
121
- * limitations under the License.
122
- * =============================================================================
123
- */
124
-
125
- /**
126
- * @license
127
- * Copyright 2020 Google LLC
128
- *
129
- * Use of this source code is governed by an MIT-style
130
- * license that can be found in the LICENSE file or at
131
- * https://opensource.org/licenses/MIT.
132
- * =============================================================================
133
- */
134
-
135
- /**
136
- * @license
137
- * Copyright 2020 Google LLC. All Rights Reserved.
138
- * Licensed under the Apache License, Version 2.0 (the "License");
139
- * you may not use this file except in compliance with the License.
140
- * You may obtain a copy of the License at
141
- *
142
- * http://www.apache.org/licenses/LICENSE-2.0
143
- *
144
- * Unless required by applicable law or agreed to in writing, software
145
- * distributed under the License is distributed on an "AS IS" BASIS,
146
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
147
- * See the License for the specific language governing permissions and
148
- * limitations under the License.
149
- * =============================================================================
150
- */
151
-
152
- /**
153
- * @license
154
- * Copyright 2020 Google LLC. All Rights Reserved.
155
- * Licensed under the Apache License, Version 2.0 (the License);
156
- * you may not use this file except in compliance with the License.
157
- * You may obtain a copy of the License at
158
- *
159
- * http://www.apache.org/licenses/LICENSE-2.0
160
- *
161
- * Unless required by applicable law or agreed to in writing, software
162
- * distributed under the License is distributed on an AS IS BASIS,
163
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
- * See the License for the specific language governing permissions and
165
- * limitations under the License.
166
- * =============================================================================
167
- */
168
-
169
- /**
170
- * @license
171
- * Copyright 2021 Google LLC. All Rights Reserved.
172
- * Licensed under the Apache License, Version 2.0 (the "License");
173
- * you may not use this file except in compliance with the License.
174
- * You may obtain a copy of the License at
175
- *
176
- * http://www.apache.org/licenses/LICENSE-2.0
177
- *
178
- * Unless required by applicable law or agreed to in writing, software
179
- * distributed under the License is distributed on an "AS IS" BASIS,
180
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
181
- * See the License for the specific language governing permissions and
182
- * limitations under the License.
183
- * =============================================================================
184
- */
185
-
186
- /**
187
- * @license
188
- * Copyright 2021 Google LLC. All Rights Reserved.
189
- * Licensed under the Apache License, Version 2.0 (the "License");
190
- * you may not use this file except in compliance with the License.
191
- * You may obtain a copy of the License at
192
- *
193
- * https://www.apache.org/licenses/LICENSE-2.0
194
- *
195
- * Unless required by applicable law or agreed to in writing, software
196
- * distributed under the License is distributed on an "AS IS" BASIS,
197
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
- * See the License for the specific language governing permissions and
199
- * limitations under the License.
200
- * =============================================================================
201
- */
202
-
203
- /**
204
- * @license
205
- * Copyright 2022 CodeSmith LLC
206
- *
207
- * Use of this source code is governed by an MIT-style
208
- * license that can be found in the LICENSE file or at
209
- * https://opensource.org/licenses/MIT.
210
- * =============================================================================
211
- */
212
-
213
- /**
214
- * @license
215
- * Copyright 2022 Google Inc. All Rights Reserved.
216
- * Licensed under the Apache License, Version 2.0 (the "License");
217
- * you may not use this file except in compliance with the License.
218
- * You may obtain a copy of the License at
219
- *
220
- * http://www.apache.org/licenses/LICENSE-2.0
221
- *
222
- * Unless required by applicable law or agreed to in writing, software
223
- * distributed under the License is distributed on an "AS IS" BASIS,
224
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
225
- * See the License for the specific language governing permissions and
226
- * limitations under the License.
227
- * =============================================================================
228
- */
229
-
230
- /**
231
- * @license
232
- * Copyright 2022 Google LLC
233
- *
234
- * Use of this source code is governed by an MIT-style
235
- * license that can be found in the LICENSE file or at
236
- * https://opensource.org/licenses/MIT.
237
- * =============================================================================
238
- */
239
-
240
- /**
241
- * @license
242
- * Copyright 2022 Google LLC.
243
- * Licensed under the Apache License, Version 2.0 (the "License");
244
- * you may not use this file except in compliance with the License.
245
- * You may obtain a copy of the License at
246
- *
247
- * http://www.apache.org/licenses/LICENSE-2.0
248
- *
249
- * Unless required by applicable law or agreed to in writing, software
250
- * distributed under the License is distributed on an "AS IS" BASIS,
251
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
252
- * See the License for the specific language governing permissions and
253
- * limitations under the License.
254
- * =============================================================================
255
- */
256
-
257
- /**
258
- * @license
259
- * Copyright 2022 Google LLC. All Rights Reserved.
260
- * Licensed under the Apache License, Version 2.0 (the "License");
261
- * you may not use this file except in compliance with the License.
262
- * You may obtain a copy of the License at
263
- *
264
- * http://www.apache.org/licenses/LICENSE-2.0
265
- *
266
- * Unless required by applicable law or agreed to in writing, software
267
- * distributed under the License is distributed on an "AS IS" BASIS,
268
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
- * See the License for the specific language governing permissions and
270
- * limitations under the License.
271
- * =============================================================================
272
- */
273
-
274
- /**
275
- * @license
276
- * Copyright 2022 Google LLC. All Rights Reserved.
277
- * Licensed under the Apache License, Version 2.0 (the 'License');
278
- * you may not use this file except in compliance with the License.
279
- * You may obtain a copy of the License at
280
- *
281
- * http://www.apache.org/licenses/LICENSE-2.0
282
- *
283
- * Unless required by applicable law or agreed to in writing, software
284
- * distributed under the License is distributed on an 'AS IS' BASIS,
285
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286
- * See the License for the specific language governing permissions and
287
- * limitations under the License.
288
- * =============================================================================
289
- */
290
-
291
- /**
292
- * @license
293
- * Copyright 2023 CodeSmith LLC
294
- *
295
- * Use of this source code is governed by an MIT-style
296
- * license that can be found in the LICENSE file or at
297
- * https://opensource.org/licenses/MIT.
298
- * =============================================================================
299
- */
300
-
301
- /**
302
- * @license
303
- * Copyright 2023 Google LLC.
304
- * Licensed under the Apache License, Version 2.0 (the "License");
305
- * you may not use this file except in compliance with the License.
306
- * You may obtain a copy of the License at
307
- *
308
- * http://www.apache.org/licenses/LICENSE-2.0
309
- *
310
- * Unless required by applicable law or agreed to in writing, software
311
- * distributed under the License is distributed on an "AS IS" BASIS,
312
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
- * See the License for the specific language governing permissions and
314
- * limitations under the License.
315
- * =============================================================================
316
- */
317
-
318
- /**
319
- * @license
320
- * Copyright 2023 Google LLC. All Rights Reserved.
321
- * Licensed under the Apache License, Version 2.0 (the "License");
322
- * you may not use this file except in compliance with the License.
323
- * You may obtain a copy of the License at
324
- *
325
- * http://www.apache.org/licenses/LICENSE-2.0
326
- *
327
- * Unless required by applicable law or agreed to in writing, software
328
- * distributed under the License is distributed on an "AS IS" BASIS,
329
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
330
- * See the License for the specific language governing permissions and
331
- * limitations under the License.
332
- * =============================================================================
333
- */
334
-
335
- /** @license See the LICENSE file. */
package/dist/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LearningMobilenetImage = exports.LearningImage = void 0;
7
- var image_1 = __importDefault(require("./learning/image"));
8
- exports.LearningImage = image_1.default;
9
- var mobilenet_image_1 = __importDefault(require("./learning/mobilenet_image"));
10
- exports.LearningMobilenetImage = mobilenet_image_1.default;
@@ -1,3 +0,0 @@
1
- import LearningImage from './learning/image';
2
- import LearningMobilenetImage from './learning/mobilenet_image';
3
- export { LearningImage, LearningMobilenetImage };
@@ -1,19 +0,0 @@
1
- import * as tf from '@tensorflow/tfjs';
2
- interface LearningInterface {
3
- model: tf.LayersModel | null;
4
- labels: string[];
5
- isRunning: boolean;
6
- isReady: boolean;
7
- onProgress(progress: number): void;
8
- onLoss(loss: number): void;
9
- onEvents(logs: any): void;
10
- onTrainBegin(log: any): void;
11
- onTrainEnd(log: any): void;
12
- addData(label: string, data: any): Promise<void>;
13
- train(): Promise<tf.History>;
14
- infer(data: any): Promise<any>;
15
- saveModel(): void;
16
- running(): boolean;
17
- ready(): boolean;
18
- }
19
- export default LearningInterface;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,40 +0,0 @@
1
- import * as tf from '@tensorflow/tfjs';
2
- import LearningInterface from './base';
3
- declare class LearningImage implements LearningInterface {
4
- model: tf.LayersModel | null;
5
- epochs: number;
6
- batchSize: number;
7
- learningRate: number;
8
- labels: string[];
9
- isRunning: boolean;
10
- isReady: boolean;
11
- limitSize: number;
12
- trainImages: tf.Tensor3D[];
13
- readonly MOBILE_NET_INPUT_WIDTH = 224;
14
- readonly MOBILE_NET_INPUT_HEIGHT = 224;
15
- readonly MOBILE_NET_INPUT_CHANNEL = 3;
16
- readonly IMAGE_NORMALIZATION_FACTOR = 255;
17
- constructor({ epochs, batchSize, limitSize, learningRate, }?: {
18
- modelURL?: string;
19
- epochs?: number;
20
- batchSize?: number;
21
- limitSize?: number;
22
- learningRate?: number;
23
- });
24
- onProgress: (progress: number) => void;
25
- onLoss: (loss: number) => void;
26
- onEvents: (logs: any) => void;
27
- onTrainBegin: (log: any) => void;
28
- onTrainEnd: (log: any) => void;
29
- addData(label: string, data: any): Promise<void>;
30
- train(): Promise<tf.History>;
31
- infer(data: any): Promise<Map<string, number>>;
32
- saveModel(): void;
33
- running(): boolean;
34
- ready(): boolean;
35
- private _preprocessedTargetData;
36
- private _preprocessedInputData;
37
- private _preprocessData;
38
- private _createModel;
39
- }
40
- export default LearningImage;