File tree Expand file tree Collapse file tree 8 files changed +60
-26
lines changed Expand file tree Collapse file tree 8 files changed +60
-26
lines changed Original file line number Diff line number Diff line change 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
2
5
3
6
const { tf, imageClassifier } = ml5 ;
4
7
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2018 ml5
2
+ //
3
+ // This software is released under the MIT License.
4
+ // https://opensource.org/licenses/MIT
5
+
1
6
const { LSTMGenerator } = ml5 ;
2
7
3
8
const LSTM_MODEL_URL = 'https://raw.githubusercontent.com/ml5js/ml5-data-and-models/master/models/lstm/woolf/' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class StyleTransfer extends Video {
26
26
this . epsilonScalar = tf . scalar ( 1e-3 ) ;
27
27
this . video = null ;
28
28
this . ready = callCallback ( this . load ( model ) , callback ) ;
29
- this . then = this . ready . then ;
29
+ // this.then = this.ready.then;
30
30
}
31
31
32
32
async load ( model ) {
Original file line number Diff line number Diff line change 3
3
// This software is released under the MIT License.
4
4
// https://opensource.org/licenses/MIT
5
5
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
+ } ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2018 ml5
2
+ //
3
+ // This software is released under the MIT License.
4
+ // https://opensource.org/licenses/MIT
5
+
1
6
/* eslint no-loop-func: 0 */
2
7
const { word2vec } = ml5 ;
3
8
Original file line number Diff line number Diff line change 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
2
5
3
6
const { YOLO } = ml5 ;
4
7
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2018 ml5
2
+ //
3
+ // This software is released under the MIT License.
4
+ // https://opensource.org/licenses/MIT
5
+
1
6
import * as tf from '@tensorflow/tfjs' ;
2
7
3
8
const MANIFEST_FILE = 'manifest.json' ;
You can’t perform that action at this time.
0 commit comments