Skip to content

Commit 2147a28

Browse files
committed
- Add license to test files
- Style transfer test - remove .test file in posenet
1 parent 103afd7 commit 2147a28

File tree

8 files changed

+60
-26
lines changed

8 files changed

+60
-26
lines changed

src/ImageClassifier/index_test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/* eslint new-cap: 0 */
1+
// Copyright (c) 2018 ml5
2+
//
3+
// This software is released under the MIT License.
4+
// https://opensource.org/licenses/MIT
25

36
const { tf, imageClassifier } = ml5;
47

src/LSTM/index_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Copyright (c) 2018 ml5
2+
//
3+
// This software is released under the MIT License.
4+
// https://opensource.org/licenses/MIT
5+
16
const { LSTMGenerator } = ml5;
27

38
const LSTM_MODEL_URL = 'https://raw.githubusercontent.com/ml5js/ml5-data-and-models/master/models/lstm/woolf/';

src/PoseNet/index.test.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/StyleTransfer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StyleTransfer extends Video {
2626
this.epsilonScalar = tf.scalar(1e-3);
2727
this.video = null;
2828
this.ready = callCallback(this.load(model), callback);
29-
this.then = this.ready.then;
29+
// this.then = this.ready.then;
3030
}
3131

3232
async load(model) {

src/StyleTransfer/index_test.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,39 @@
33
// This software is released under the MIT License.
44
// https://opensource.org/licenses/MIT
55

6-
// Just a test
7-
// test('true should be true', () => {
8-
// expect(true).toBe(true);
9-
// });
6+
7+
const { styleTransfer } = ml5;
8+
9+
const STYLE_TRANSFER_MODEL = 'https://github.com/ml5js/ml5-data-and-models/raw/master/models/style-transfer/matta/';
10+
const STYLE_TRANSFER_DEFAULTS = {
11+
size: 200,
12+
};
13+
14+
describe('styleTransfer', () => {
15+
let style;
16+
17+
async function getRobin() {
18+
const img = new Image();
19+
img.crossOrigin = '';
20+
img.src = 'https://ml5js.org/docs/assets/img/bird.jpg';
21+
await new Promise((resolve) => { img.onload = resolve; });
22+
return img;
23+
}
24+
25+
beforeEach(async () => {
26+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
27+
style = await styleTransfer(STYLE_TRANSFER_MODEL);
28+
});
29+
30+
it('instantiates styleTransfer', () => {
31+
expect(style.size).toBe(STYLE_TRANSFER_DEFAULTS.size);
32+
});
33+
34+
it('styles an image', async () => {
35+
// Same as with LSTM. There's an issue with the checkpoint loader
36+
// const image = await getRobin();
37+
// const transfer = await style.transfer(image);
38+
// console.log(transfer);
39+
// expect(transfer).toBe('bird');
40+
});
41+
});

src/Word2vec/index_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Copyright (c) 2018 ml5
2+
//
3+
// This software is released under the MIT License.
4+
// https://opensource.org/licenses/MIT
5+
16
/* eslint no-loop-func: 0 */
27
const { word2vec } = ml5;
38

src/YOLO/index_test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/* eslint new-cap: 0 */
1+
// Copyright (c) 2018 ml5
2+
//
3+
// This software is released under the MIT License.
4+
// https://opensource.org/licenses/MIT
25

36
const { YOLO } = ml5;
47

src/utils/checkpointLoader.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Copyright (c) 2018 ml5
2+
//
3+
// This software is released under the MIT License.
4+
// https://opensource.org/licenses/MIT
5+
16
import * as tf from '@tensorflow/tfjs';
27

38
const MANIFEST_FILE = 'manifest.json';

0 commit comments

Comments
 (0)