From 6d16029d07ab50690b73ef17b540ac6bc54693f8 Mon Sep 17 00:00:00 2001
From: Ping Yu <4018+pyu10055@users.noreply.github.com>
Date: Wed, 19 Jun 2019 15:23:03 -0700
Subject: [PATCH] update models peerDependencies to be individual npm instead
of union (#237)
cla: yes
* update all models deps to be individual npm instead of union
* fixed test
* addressed comments
* udpate the demo deps
* fix test
* updated the minor versions and peer deps
* update all demo deps
* addressed comments
* remove DS_Store files
* fixed the typo
---
body-pix/demos/package.json | 4 +-
body-pix/demos/yarn.lock | 6 +--
body-pix/package.json | 8 +--
body-pix/src/body_pix_model.ts | 7 +--
body-pix/src/body_pix_test.ts | 2 +-
body-pix/src/decode_part_map.ts | 2 +-
body-pix/src/mobilenet.ts | 2 +-
body-pix/src/model_weights.ts | 7 +--
body-pix/src/types.ts | 2 +-
body-pix/src/util.ts | 2 +-
body-pix/yarn.lock | 46 +++---------------
coco-ssd/demo/package.json | 4 +-
coco-ssd/demo/yarn.lock | 6 +--
coco-ssd/package.json | 8 +--
coco-ssd/src/index.ts | 8 +--
coco-ssd/src/ssd_test.ts | 6 ++-
coco-ssd/yarn.lock | 46 +++---------------
knn-classifier/demo/package.json | 3 +-
knn-classifier/demo/yarn.lock | 51 +++++++++++---------
knn-classifier/package.json | 6 +--
knn-classifier/src/index.ts | 23 ++++++---
knn-classifier/src/index_test.ts | 2 +-
knn-classifier/src/util.ts | 2 +-
knn-classifier/yarn.lock | 43 ++---------------
mobilenet/demo/index.html | 4 +-
mobilenet/package.json | 10 ++--
mobilenet/src/index.ts | 8 +--
mobilenet/src/index_test.ts | 5 +-
mobilenet/yarn.lock | 10 ++--
posenet/demos/package.json | 4 +-
posenet/package.json | 10 ++--
posenet/src/mobilenet.ts | 8 +--
posenet/src/posenet_model.ts | 6 +--
posenet/src/posenet_test.ts | 4 +-
posenet/src/resnet.ts | 6 +--
universal-sentence-encoder/demo/package.json | 4 +-
universal-sentence-encoder/demo/yarn.lock | 6 +--
universal-sentence-encoder/package.json | 10 ++--
universal-sentence-encoder/src/index.ts | 7 +--
universal-sentence-encoder/yarn.lock | 46 +++---------------
40 files changed, 171 insertions(+), 273 deletions(-)
diff --git a/body-pix/demos/package.json b/body-pix/demos/package.json
index 32d99eeaa5..cb4050507e 100644
--- a/body-pix/demos/package.json
+++ b/body-pix/demos/package.json
@@ -9,8 +9,8 @@
"node": ">=8.9.0"
},
"dependencies": {
- "@tensorflow-models/body-pix": "1.0.1",
- "@tensorflow/tfjs": "1.1.0",
+ "@tensorflow-models/body-pix": "1.1.0",
+ "@tensorflow/tfjs": "1.2.1",
"stats.js": "0.17.0"
},
"scripts": {
diff --git a/body-pix/demos/yarn.lock b/body-pix/demos/yarn.lock
index 3f6f2cea08..74e303d245 100644
--- a/body-pix/demos/yarn.lock
+++ b/body-pix/demos/yarn.lock
@@ -755,10 +755,8 @@
"@parcel/utils" "^1.11.0"
physical-cpu-count "^2.0.0"
-"@tensorflow-models/body-pix@1.0.1":
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/@tensorflow-models/body-pix/-/body-pix-1.0.1.tgz#bcf0b680b14dd65f7249a922d16a5afb132c1549"
- integrity sha512-s63eE+ns6ArGZ6MiX7t95yzUPUxdUkEUFwG8jWkhAlDSANiqFFM1rmNcIp2iF2ldojftFRr2y7vwHGocFYrDdQ==
+"@tensorflow-models/body-pix@file:.yalc/@tensorflow-models/body-pix":
+ version "1.0.1-5c8afa55"
"@tensorflow/tfjs-converter@1.1.0":
version "1.1.0"
diff --git a/body-pix/package.json b/body-pix/package.json
index 14df457c9a..06a403cf60 100644
--- a/body-pix/package.json
+++ b/body-pix/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/body-pix",
- "version": "1.0.1",
+ "version": "1.1.0",
"description": "Pretrained BodyPix model in TensorFlow.js",
"main": "dist/index.js",
"jsnext:main": "dist/body-pix.esm.js",
@@ -13,10 +13,12 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs": "^1.1.0"
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1",
"@types/jasmine": "~2.5.53",
"jasmine": "~3.2.0",
"jasmine-core": "~3.1.0",
diff --git a/body-pix/src/body_pix_model.ts b/body-pix/src/body_pix_model.ts
index d3a27f519a..e68d48087e 100644
--- a/body-pix/src/body_pix_model.ts
+++ b/body-pix/src/body_pix_model.ts
@@ -16,7 +16,8 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tfconv from '@tensorflow/tfjs-converter';
+import * as tf from '@tensorflow/tfjs-core';
import {checkpoints} from './checkpoints';
import {decodePartSegmentation, toMask} from './decode_part_map';
@@ -235,8 +236,8 @@ export const mobilenetLoader = {
const baseUrl = checkpoint.url;
- const model =
- await tf.loadGraphModel(`${baseUrl}model.json`) as tf.GraphModel;
+ const model = await tfconv.loadGraphModel(`${baseUrl}model.json`) as
+ tfconv.GraphModel;
const weights = new ModelWeights(model);
diff --git a/body-pix/src/body_pix_test.ts b/body-pix/src/body_pix_test.ts
index e919a05796..d9362b7f54 100644
--- a/body-pix/src/body_pix_test.ts
+++ b/body-pix/src/body_pix_test.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
import {describeWithFlags, NODE_ENVS} from '@tensorflow/tfjs-core/dist/jasmine_util';
import {BodyPix, load, mobilenetLoader} from './body_pix_model';
diff --git a/body-pix/src/decode_part_map.ts b/body-pix/src/decode_part_map.ts
index 995723f9f9..d27c0b62f0 100644
--- a/body-pix/src/decode_part_map.ts
+++ b/body-pix/src/decode_part_map.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
/**
* Takes the sigmoid of the part heatmap output and generates a 2d one-hot
diff --git a/body-pix/src/mobilenet.ts b/body-pix/src/mobilenet.ts
index 58d3e7c244..12747a6ac7 100644
--- a/body-pix/src/mobilenet.ts
+++ b/body-pix/src/mobilenet.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
import {ModelWeights} from './model_weights';
export type MobileNetMultiplier = 0.25|0.50|0.75|1.0|1.01;
diff --git a/body-pix/src/model_weights.ts b/body-pix/src/model_weights.ts
index 50a42f43a8..59169328a6 100644
--- a/body-pix/src/model_weights.ts
+++ b/body-pix/src/model_weights.ts
@@ -15,12 +15,13 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tfconv from '@tensorflow/tfjs-converter';
+import * as tf from '@tensorflow/tfjs-core';
export class ModelWeights {
- private graphModel: tf.GraphModel;
+ private graphModel: tfconv.GraphModel;
- constructor(graphModel: tf.GraphModel) {
+ constructor(graphModel: tfconv.GraphModel) {
this.graphModel = graphModel;
}
diff --git a/body-pix/src/types.ts b/body-pix/src/types.ts
index eaa498d297..c76104b46b 100644
--- a/body-pix/src/types.ts
+++ b/body-pix/src/types.ts
@@ -1,4 +1,4 @@
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
export type BodyPixInput =
ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|tf.Tensor3D;
diff --git a/body-pix/src/util.ts b/body-pix/src/util.ts
index bbf78fa94e..b6362e6070 100644
--- a/body-pix/src/util.ts
+++ b/body-pix/src/util.ts
@@ -1,4 +1,4 @@
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
import {BodyPixInput} from './types';
diff --git a/body-pix/yarn.lock b/body-pix/yarn.lock
index 23a360d80e..0caf632830 100644
--- a/body-pix/yarn.lock
+++ b/body-pix/yarn.lock
@@ -2,15 +2,15 @@
# yarn lockfile v1
-"@tensorflow/tfjs-converter@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.0.tgz#1d6f58347e9b3826c02090e06e6590b0c4df2d4e"
- integrity sha512-gUkoRoYm9yrVVQNp8nD+pEWOPUNhayCSrUHNItSfIm8Lzbgx6brVxVdz5T8V0kT0yh67Pp9Er/LIlf54p7KikA==
+"@tensorflow/tfjs-converter@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.2.1.tgz#996e9e2e7d0f03717e7fc1211176ee43049b38ac"
+ integrity sha512-HKWlGV9uSWMUaogo6TyS/x2xdgO/du/vXPj91iGnm+t44Jl++1PXYD0LKD1LdNLR2RhUS3TJv6HuqDmYOO8EYw==
-"@tensorflow/tfjs-core@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.1.0.tgz#028c69291e19c328c4c30e18d29b09135c22cb44"
- integrity sha512-loPpHGVjiyEb+Ixlsj8prQ/r4exekITn7vM4WEyHUouFKx0/CuoB2FQ0m6DSb/6ApvucxTWGGNTRRo4HK4Ma0Q==
+"@tensorflow/tfjs-core@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
+ integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
dependencies:
"@types/seedrandom" "2.4.27"
"@types/webgl-ext" "0.0.30"
@@ -20,29 +20,6 @@
optionalDependencies:
rollup-plugin-visualizer "~1.1.1"
-"@tensorflow/tfjs-data@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.1.0.tgz#8d9a0175497930061532c8d43b419b25b26b9bbf"
- integrity sha512-0+PfAsaZs/pmaxiLunb4c1rPRdu47+CYe5kxpu2P8Xn3k+vhlBYMu+zsVgs5RrTRFLWVzVeH9muA1SJLkMGZPA==
- dependencies:
- "@types/node-fetch" "^2.1.2"
- node-fetch "~2.1.2"
-
-"@tensorflow/tfjs-layers@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.1.0.tgz#fd221c254d2fca13e93e83669bdde3140e7a0434"
- integrity sha512-a0gXjOWvGi9gc2q8/gK79zfD5WqEZnAhZfpm6b7AoKXjDUBq4GgdbbWCfv2nYBlmMoXgRSRSV44UmJVExep0uw==
-
-"@tensorflow/tfjs@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.1.0.tgz#77809dc336655a7ff0bbf76527cc3d7b9e68e330"
- integrity sha512-CxcFzl2KtknO3f12xuuv8kq8usMA7xGWpJajubIlYBp4KoBDhiDimP/DwBlTvFZq5RT5riHGtA4BWjMj6rnDcw==
- dependencies:
- "@tensorflow/tfjs-converter" "1.1.0"
- "@tensorflow/tfjs-core" "1.1.0"
- "@tensorflow/tfjs-data" "1.1.0"
- "@tensorflow/tfjs-layers" "1.1.0"
-
"@types/estree@0.0.38":
version "0.0.38"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2"
@@ -53,13 +30,6 @@
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.54.tgz#a6b5f2ae2afb6e0307774e8c7c608e037d491c63"
integrity sha512-B9YofFbUljs19g5gBKUYeLIulsh31U5AK70F41BImQRHEZQGm4GcN922UvnYwkduMqbC/NH+9fruWa/zrqvHIg==
-"@types/node-fetch@^2.1.2":
- version "2.3.2"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.2.tgz#e01893b176c6fa1367743726380d65bce5d6576b"
- integrity sha512-yW0EOebSsQme9yKu09XbdDfle4/SmWZMK4dfteWcSLCYNQQcF+YOv0kIrvm+9pO11/ghA4E6A+RNQqvYj4Nr3A==
- dependencies:
- "@types/node" "*"
-
"@types/node@*":
version "11.13.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.6.tgz#37ec75690830acb0d74ce3c6c43caab787081e85"
diff --git a/coco-ssd/demo/package.json b/coco-ssd/demo/package.json
index bd03277173..b635992a36 100644
--- a/coco-ssd/demo/package.json
+++ b/coco-ssd/demo/package.json
@@ -9,8 +9,8 @@
"node": ">=8.9.0"
},
"dependencies": {
- "@tensorflow-models/coco-ssd": "1.0.1",
- "@tensorflow/tfjs": "1.1.0",
+ "@tensorflow-models/coco-ssd": "1.1.0",
+ "@tensorflow/tfjs": "1.2.1",
"stats.js": "^0.17.0"
},
"scripts": {
diff --git a/coco-ssd/demo/yarn.lock b/coco-ssd/demo/yarn.lock
index 8b993a7169..bdce96d02f 100644
--- a/coco-ssd/demo/yarn.lock
+++ b/coco-ssd/demo/yarn.lock
@@ -651,10 +651,8 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
-"@tensorflow-models/coco-ssd@1.0.1":
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/@tensorflow-models/coco-ssd/-/coco-ssd-1.0.1.tgz#7b038f08d7e23528c52491e4e80b946bcf30bae8"
- integrity sha512-3oHdEYUAvQu6rbCu08K0j2tI3K+C/p9HVi8OWs2mrhAj8/b91nEz/ZKqmRG10AJffOJCFM5T0FWzr5xadBxOdw==
+"@tensorflow-models/coco-ssd@file:.yalc/@tensorflow-models/coco-ssd":
+ version "1.0.2-b75c3e2b"
"@tensorflow/tfjs-converter@1.1.0":
version "1.1.0"
diff --git a/coco-ssd/package.json b/coco-ssd/package.json
index ac5949900e..191fe44abf 100644
--- a/coco-ssd/package.json
+++ b/coco-ssd/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/coco-ssd",
- "version": "1.0.2",
+ "version": "1.1.0",
"description": "Object detection model (coco-ssd) in TensorFlow.js",
"main": "dist/index.js",
"unpkg": "dist/coco-ssd.min.js",
@@ -13,10 +13,12 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs": "^1.1.0"
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1",
"@types/jasmine": "~2.8.8",
"babel-core": "~6.26.0",
"babel-plugin-transform-runtime": "~6.23.0",
diff --git a/coco-ssd/src/index.ts b/coco-ssd/src/index.ts
index 70ebfe254b..3c5dca4c14 100644
--- a/coco-ssd/src/index.ts
+++ b/coco-ssd/src/index.ts
@@ -15,7 +15,9 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tfconv from '@tensorflow/tfjs-converter';
+import * as tf from '@tensorflow/tfjs-core';
+
import {CLASSES} from './classes';
const BASE_PATH = 'https://storage.googleapis.com/tfjs-models/savedmodel/';
@@ -54,7 +56,7 @@ export async function load(
export class ObjectDetection {
private modelPath: string;
- private model: tf.GraphModel;
+ private model: tfconv.GraphModel;
constructor(base: ObjectDetectionBaseModel) {
this.modelPath = `${BASE_PATH}${this.getPrefix(base)}/model.json`;
@@ -65,7 +67,7 @@ export class ObjectDetection {
}
async load() {
- this.model = await tf.loadGraphModel(this.modelPath);
+ this.model = await tfconv.loadGraphModel(this.modelPath);
// Warmup the model.
const result = await this.model.executeAsync(tf.zeros([1, 300, 300, 3])) as
diff --git a/coco-ssd/src/ssd_test.ts b/coco-ssd/src/ssd_test.ts
index c08b4f1bc6..49636268ee 100644
--- a/coco-ssd/src/ssd_test.ts
+++ b/coco-ssd/src/ssd_test.ts
@@ -14,13 +14,15 @@
* limitations under the License.
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tfconv from '@tensorflow/tfjs-converter';
+import * as tf from '@tensorflow/tfjs-core';
import {describeWithFlags, NODE_ENVS} from '@tensorflow/tfjs-core/dist/jasmine_util';
+
import {load} from './index';
describeWithFlags('ObjectDetection', NODE_ENVS, () => {
beforeEach(() => {
- spyOn(tf, 'loadGraphModel').and.callFake(() => {
+ spyOn(tfconv, 'loadGraphModel').and.callFake(() => {
const model = {
executeAsync: (
x: tf
diff --git a/coco-ssd/yarn.lock b/coco-ssd/yarn.lock
index c3c72b4f0b..dc1a93ebaa 100644
--- a/coco-ssd/yarn.lock
+++ b/coco-ssd/yarn.lock
@@ -2,15 +2,15 @@
# yarn lockfile v1
-"@tensorflow/tfjs-converter@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.0.tgz#1d6f58347e9b3826c02090e06e6590b0c4df2d4e"
- integrity sha512-gUkoRoYm9yrVVQNp8nD+pEWOPUNhayCSrUHNItSfIm8Lzbgx6brVxVdz5T8V0kT0yh67Pp9Er/LIlf54p7KikA==
+"@tensorflow/tfjs-converter@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.2.1.tgz#996e9e2e7d0f03717e7fc1211176ee43049b38ac"
+ integrity sha512-HKWlGV9uSWMUaogo6TyS/x2xdgO/du/vXPj91iGnm+t44Jl++1PXYD0LKD1LdNLR2RhUS3TJv6HuqDmYOO8EYw==
-"@tensorflow/tfjs-core@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.1.0.tgz#028c69291e19c328c4c30e18d29b09135c22cb44"
- integrity sha512-loPpHGVjiyEb+Ixlsj8prQ/r4exekITn7vM4WEyHUouFKx0/CuoB2FQ0m6DSb/6ApvucxTWGGNTRRo4HK4Ma0Q==
+"@tensorflow/tfjs-core@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
+ integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
dependencies:
"@types/seedrandom" "2.4.27"
"@types/webgl-ext" "0.0.30"
@@ -20,29 +20,6 @@
optionalDependencies:
rollup-plugin-visualizer "~1.1.1"
-"@tensorflow/tfjs-data@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.1.0.tgz#8d9a0175497930061532c8d43b419b25b26b9bbf"
- integrity sha512-0+PfAsaZs/pmaxiLunb4c1rPRdu47+CYe5kxpu2P8Xn3k+vhlBYMu+zsVgs5RrTRFLWVzVeH9muA1SJLkMGZPA==
- dependencies:
- "@types/node-fetch" "^2.1.2"
- node-fetch "~2.1.2"
-
-"@tensorflow/tfjs-layers@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.1.0.tgz#fd221c254d2fca13e93e83669bdde3140e7a0434"
- integrity sha512-a0gXjOWvGi9gc2q8/gK79zfD5WqEZnAhZfpm6b7AoKXjDUBq4GgdbbWCfv2nYBlmMoXgRSRSV44UmJVExep0uw==
-
-"@tensorflow/tfjs@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.1.0.tgz#77809dc336655a7ff0bbf76527cc3d7b9e68e330"
- integrity sha512-CxcFzl2KtknO3f12xuuv8kq8usMA7xGWpJajubIlYBp4KoBDhiDimP/DwBlTvFZq5RT5riHGtA4BWjMj6rnDcw==
- dependencies:
- "@tensorflow/tfjs-converter" "1.1.0"
- "@tensorflow/tfjs-core" "1.1.0"
- "@tensorflow/tfjs-data" "1.1.0"
- "@tensorflow/tfjs-layers" "1.1.0"
-
"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
@@ -53,13 +30,6 @@
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.16.tgz#a6cb24b1149d65293bd616923500014838e14e7d"
integrity sha512-056oRlBBp7MDzr+HoU5su099s/s7wjZ3KcHxLfv+Byqb9MwdLUvsfLgw1VS97hsh3ddxSPyQu+olHMnoVTUY6g==
-"@types/node-fetch@^2.1.2":
- version "2.3.2"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.2.tgz#e01893b176c6fa1367743726380d65bce5d6576b"
- integrity sha512-yW0EOebSsQme9yKu09XbdDfle4/SmWZMK4dfteWcSLCYNQQcF+YOv0kIrvm+9pO11/ghA4E6A+RNQqvYj4Nr3A==
- dependencies:
- "@types/node" "*"
-
"@types/node@*":
version "11.13.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.6.tgz#37ec75690830acb0d74ce3c6c43caab787081e85"
diff --git a/knn-classifier/demo/package.json b/knn-classifier/demo/package.json
index a928f15eb5..6640c4cc52 100644
--- a/knn-classifier/demo/package.json
+++ b/knn-classifier/demo/package.json
@@ -9,8 +9,9 @@
"node": ">=8.9.0"
},
"dependencies": {
+ "@tensorflow-models/knn-classifier": "1.2.0",
"@tensorflow-models/mobilenet": "^1.0.1",
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow/tfjs": "^1.2.1",
"stats.js": "^0.17.0"
},
"scripts": {
diff --git a/knn-classifier/demo/yarn.lock b/knn-classifier/demo/yarn.lock
index dca56062b9..bbff4a7b14 100644
--- a/knn-classifier/demo/yarn.lock
+++ b/knn-classifier/demo/yarn.lock
@@ -651,20 +651,23 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
+"@tensorflow-models/knn-classifier@file:.yalc/@tensorflow-models/knn-classifier":
+ version "1.1.1-2248cb11"
+
"@tensorflow-models/mobilenet@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@tensorflow-models/mobilenet/-/mobilenet-1.0.1.tgz#e0dfdfd4941bae780dfe09e927ebdeea00926d12"
integrity sha512-VaxVRCmJLK09yp2Qn/LvT29joZPT4aCBrSD4DwIkWghfJF7M/DGqxsiZSnjnUnYjzkZdNv7JCVJ4EY1PCmufQw==
-"@tensorflow/tfjs-converter@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.0.tgz#1d6f58347e9b3826c02090e06e6590b0c4df2d4e"
- integrity sha512-gUkoRoYm9yrVVQNp8nD+pEWOPUNhayCSrUHNItSfIm8Lzbgx6brVxVdz5T8V0kT0yh67Pp9Er/LIlf54p7KikA==
+"@tensorflow/tfjs-converter@1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.2.1.tgz#996e9e2e7d0f03717e7fc1211176ee43049b38ac"
+ integrity sha512-HKWlGV9uSWMUaogo6TyS/x2xdgO/du/vXPj91iGnm+t44Jl++1PXYD0LKD1LdNLR2RhUS3TJv6HuqDmYOO8EYw==
-"@tensorflow/tfjs-core@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.1.0.tgz#028c69291e19c328c4c30e18d29b09135c22cb44"
- integrity sha512-loPpHGVjiyEb+Ixlsj8prQ/r4exekITn7vM4WEyHUouFKx0/CuoB2FQ0m6DSb/6ApvucxTWGGNTRRo4HK4Ma0Q==
+"@tensorflow/tfjs-core@1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
+ integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
dependencies:
"@types/seedrandom" "2.4.27"
"@types/webgl-ext" "0.0.30"
@@ -674,28 +677,28 @@
optionalDependencies:
rollup-plugin-visualizer "~1.1.1"
-"@tensorflow/tfjs-data@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.1.0.tgz#8d9a0175497930061532c8d43b419b25b26b9bbf"
- integrity sha512-0+PfAsaZs/pmaxiLunb4c1rPRdu47+CYe5kxpu2P8Xn3k+vhlBYMu+zsVgs5RrTRFLWVzVeH9muA1SJLkMGZPA==
+"@tensorflow/tfjs-data@1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.2.1.tgz#c0ffdfed0a6c18f17205ad1d55ff1433a0f973c4"
+ integrity sha512-5H/AqoGBWWY/7k8baaYmvu6SzRpEiSgAeOYZu3ueq8O766aHQzFRjmCyC6vUj8lko2VWfsE891zsdw4hieFnoA==
dependencies:
"@types/node-fetch" "^2.1.2"
node-fetch "~2.1.2"
-"@tensorflow/tfjs-layers@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.1.0.tgz#fd221c254d2fca13e93e83669bdde3140e7a0434"
- integrity sha512-a0gXjOWvGi9gc2q8/gK79zfD5WqEZnAhZfpm6b7AoKXjDUBq4GgdbbWCfv2nYBlmMoXgRSRSV44UmJVExep0uw==
+"@tensorflow/tfjs-layers@1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.2.1.tgz#78f28e90ee95ec206e69d5e2432b677e28c70c45"
+ integrity sha512-h3uFYRHzEGqtyzC4PLHcXGn2tbPcozk9H6yMEtdI1yLJZXBKTh4Yjs9B/yN9HRxp31pc2hCFrqU7ViNYAg/vYw==
-"@tensorflow/tfjs@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.1.0.tgz#77809dc336655a7ff0bbf76527cc3d7b9e68e330"
- integrity sha512-CxcFzl2KtknO3f12xuuv8kq8usMA7xGWpJajubIlYBp4KoBDhiDimP/DwBlTvFZq5RT5riHGtA4BWjMj6rnDcw==
+"@tensorflow/tfjs@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.2.1.tgz#1237fab53005d659ee082974428061d78493341f"
+ integrity sha512-uWYuRlcewFFX1mE+6hqXzdDxYMWsylxmREWvwC35zj2JexiIwJrTFLDu50RSwb6muL9tZJrwfZYbuOSfV0avQA==
dependencies:
- "@tensorflow/tfjs-converter" "1.1.0"
- "@tensorflow/tfjs-core" "1.1.0"
- "@tensorflow/tfjs-data" "1.1.0"
- "@tensorflow/tfjs-layers" "1.1.0"
+ "@tensorflow/tfjs-converter" "1.2.1"
+ "@tensorflow/tfjs-core" "1.2.1"
+ "@tensorflow/tfjs-data" "1.2.1"
+ "@tensorflow/tfjs-layers" "1.2.1"
"@types/node-fetch@^2.1.2":
version "2.1.6"
diff --git a/knn-classifier/package.json b/knn-classifier/package.json
index 6cd6e56b7c..c22ef79bd3 100644
--- a/knn-classifier/package.json
+++ b/knn-classifier/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/knn-classifier",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "KNN Classifier for TensorFlow.js",
"main": "dist/index.js",
"unpkg": "dist/knn-classifier.min.js",
@@ -13,10 +13,10 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs": "^1.1.0"
+ "@tensorflow/tfjs-core": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow/tfjs-core": "~1.2.1",
"@types/jasmine": "~2.5.53",
"babel-core": "~6.26.0",
"babel-plugin-transform-runtime": "~6.23.0",
diff --git a/knn-classifier/src/index.ts b/knn-classifier/src/index.ts
index a8f97478d0..8f8b9faf08 100644
--- a/knn-classifier/src/index.ts
+++ b/knn-classifier/src/index.ts
@@ -14,8 +14,8 @@
* limitations under the License.
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
-import {Tensor, Tensor1D, Tensor2D, util} from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
+import {Tensor, Tensor1D, Tensor2D, util} from '@tensorflow/tfjs-core';
import {concatWithNulls, topK} from './util';
/**
@@ -129,8 +129,11 @@ export class KNNClassifier {
* @returns A dict of the top class for the input and an array of confidence
* values for all possible classes.
*/
- async predictClass(input: Tensor, k = 3):
- Promise<{label: string, classIndex: number, confidences: {[label: string]: number}}> {
+ async predictClass(input: Tensor, k = 3): Promise<{
+ label: string,
+ classIndex: number,
+ confidences: {[label: string]: number}
+ }> {
if (k < 1) {
throw new Error(
`Please provide a positive integer k value to predictClass.`);
@@ -199,7 +202,11 @@ export class KNNClassifier {
if (topKIndices == null) {
// No class predicted
- return {classIndex: this.labelToClassId[topLabel], label: topLabel, confidences};
+ return {
+ classIndex: this.labelToClassId[topLabel],
+ label: topLabel,
+ confidences
+ };
}
const classOffsets: {[label: string]: number} = {};
@@ -233,7 +240,11 @@ export class KNNClassifier {
confidences[label] = probability;
}
- return {classIndex: this.labelToClassId[topLabel], label: topLabel, confidences};
+ return {
+ classIndex: this.labelToClassId[topLabel],
+ label: topLabel,
+ confidences
+ };
}
/**
diff --git a/knn-classifier/src/index_test.ts b/knn-classifier/src/index_test.ts
index e899d5f985..89c440076d 100644
--- a/knn-classifier/src/index_test.ts
+++ b/knn-classifier/src/index_test.ts
@@ -14,7 +14,7 @@
* limitations under the License.
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
import {describeWithFlags, NODE_ENVS} from '@tensorflow/tfjs-core/dist/jasmine_util';
import * as knnClassifier from './index';
diff --git a/knn-classifier/src/util.ts b/knn-classifier/src/util.ts
index 583ee2c354..c3181d9b4f 100644
--- a/knn-classifier/src/util.ts
+++ b/knn-classifier/src/util.ts
@@ -14,7 +14,7 @@
* limitations under the License.
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tf from '@tensorflow/tfjs-core';
export function concatWithNulls(
ndarray1: tf.Tensor2D, ndarray2: tf.Tensor2D): tf.Tensor2D {
diff --git a/knn-classifier/yarn.lock b/knn-classifier/yarn.lock
index 042cf92767..a94fbe119f 100644
--- a/knn-classifier/yarn.lock
+++ b/knn-classifier/yarn.lock
@@ -2,15 +2,10 @@
# yarn lockfile v1
-"@tensorflow/tfjs-converter@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.0.tgz#1d6f58347e9b3826c02090e06e6590b0c4df2d4e"
- integrity sha512-gUkoRoYm9yrVVQNp8nD+pEWOPUNhayCSrUHNItSfIm8Lzbgx6brVxVdz5T8V0kT0yh67Pp9Er/LIlf54p7KikA==
-
-"@tensorflow/tfjs-core@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.1.0.tgz#028c69291e19c328c4c30e18d29b09135c22cb44"
- integrity sha512-loPpHGVjiyEb+Ixlsj8prQ/r4exekITn7vM4WEyHUouFKx0/CuoB2FQ0m6DSb/6ApvucxTWGGNTRRo4HK4Ma0Q==
+"@tensorflow/tfjs-core@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
+ integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
dependencies:
"@types/seedrandom" "2.4.27"
"@types/webgl-ext" "0.0.30"
@@ -20,29 +15,6 @@
optionalDependencies:
rollup-plugin-visualizer "~1.1.1"
-"@tensorflow/tfjs-data@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.1.0.tgz#8d9a0175497930061532c8d43b419b25b26b9bbf"
- integrity sha512-0+PfAsaZs/pmaxiLunb4c1rPRdu47+CYe5kxpu2P8Xn3k+vhlBYMu+zsVgs5RrTRFLWVzVeH9muA1SJLkMGZPA==
- dependencies:
- "@types/node-fetch" "^2.1.2"
- node-fetch "~2.1.2"
-
-"@tensorflow/tfjs-layers@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.1.0.tgz#fd221c254d2fca13e93e83669bdde3140e7a0434"
- integrity sha512-a0gXjOWvGi9gc2q8/gK79zfD5WqEZnAhZfpm6b7AoKXjDUBq4GgdbbWCfv2nYBlmMoXgRSRSV44UmJVExep0uw==
-
-"@tensorflow/tfjs@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.1.0.tgz#77809dc336655a7ff0bbf76527cc3d7b9e68e330"
- integrity sha512-CxcFzl2KtknO3f12xuuv8kq8usMA7xGWpJajubIlYBp4KoBDhiDimP/DwBlTvFZq5RT5riHGtA4BWjMj6rnDcw==
- dependencies:
- "@tensorflow/tfjs-converter" "1.1.0"
- "@tensorflow/tfjs-core" "1.1.0"
- "@tensorflow/tfjs-data" "1.1.0"
- "@tensorflow/tfjs-layers" "1.1.0"
-
"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
@@ -53,13 +25,6 @@
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.54.tgz#a6b5f2ae2afb6e0307774e8c7c608e037d491c63"
integrity sha512-B9YofFbUljs19g5gBKUYeLIulsh31U5AK70F41BImQRHEZQGm4GcN922UvnYwkduMqbC/NH+9fruWa/zrqvHIg==
-"@types/node-fetch@^2.1.2":
- version "2.3.2"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.2.tgz#e01893b176c6fa1367743726380d65bce5d6576b"
- integrity sha512-yW0EOebSsQme9yKu09XbdDfle4/SmWZMK4dfteWcSLCYNQQcF+YOv0kIrvm+9pO11/ghA4E6A+RNQqvYj4Nr3A==
- dependencies:
- "@types/node" "*"
-
"@types/node@*":
version "11.13.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.6.tgz#37ec75690830acb0d74ce3c6c43caab787081e85"
diff --git a/mobilenet/demo/index.html b/mobilenet/demo/index.html
index 9bdc22d42b..d62e2b465c 100644
--- a/mobilenet/demo/index.html
+++ b/mobilenet/demo/index.html
@@ -1,5 +1,5 @@
-
+
@@ -12,7 +12,7 @@
async function run() {
// Load the model.
- const model = await mobilenet.load(version, alpha);
+ const model = await mobilenet.load({version, alpha});
// Classify the image.
const predictions = await model.classify(img);
diff --git a/mobilenet/package.json b/mobilenet/package.json
index 640b215b59..7f7ef26dd6 100644
--- a/mobilenet/package.json
+++ b/mobilenet/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/mobilenet",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "Pretrained MobileNet in TensorFlow.js",
"main": "dist/index.js",
"unpkg": "dist/mobilenet.min.js",
@@ -13,12 +13,12 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs-core": "^1.1.2",
- "@tensorflow/tfjs-converter": "^1.1.2"
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs-core": "^1.1.2",
- "@tensorflow/tfjs-converter": "^1.1.2",
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1",
"@types/jasmine": "~2.5.53",
"babel-core": "^6.26.0",
"babel-plugin-transform-runtime": "~6.23.0",
diff --git a/mobilenet/src/index.ts b/mobilenet/src/index.ts
index 409f65e682..528e976554 100644
--- a/mobilenet/src/index.ts
+++ b/mobilenet/src/index.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tfc from '@tensorflow/tfjs-converter';
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
import {IMAGENET_CLASSES} from './imagenet_classes';
@@ -113,7 +113,7 @@ export interface MobileNet {
}
class MobileNetImpl implements MobileNet {
- model: tfc.GraphModel;
+ model: tfconv.GraphModel;
private normalizationOffset: tf.Scalar;
@@ -125,10 +125,10 @@ class MobileNetImpl implements MobileNet {
async load() {
if (this.modelUrl) {
- this.model = await tfc.loadGraphModel(this.modelUrl);
+ this.model = await tfconv.loadGraphModel(this.modelUrl);
} else {
const url = MODEL_INFO[this.version][this.alpha];
- this.model = await tfc.loadGraphModel(url, {fromTFHub: true});
+ this.model = await tfconv.loadGraphModel(url, {fromTFHub: true});
}
// Warmup the model.
diff --git a/mobilenet/src/index_test.ts b/mobilenet/src/index_test.ts
index 387bc1f67b..b2f5c6d99e 100644
--- a/mobilenet/src/index_test.ts
+++ b/mobilenet/src/index_test.ts
@@ -14,14 +14,15 @@
* limitations under the License.
* =============================================================================
*/
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
-import * as tfc from '@tensorflow/tfjs-converter';
import {describeWithFlags, NODE_ENVS} from '@tensorflow/tfjs-core/dist/jasmine_util';
+
import {load} from './index';
describeWithFlags('MobileNet', NODE_ENVS, () => {
beforeAll(() => {
- spyOn(tfc, 'loadGraphModel').and.callFake(() => {
+ spyOn(tfconv, 'loadGraphModel').and.callFake(() => {
const model = {
predict: (x: tf.Tensor) => tf.zeros([x.shape[0], 1001]),
execute: (x: tf.Tensor, nodeName: string) =>
diff --git a/mobilenet/yarn.lock b/mobilenet/yarn.lock
index 5e71149fd2..336801692c 100644
--- a/mobilenet/yarn.lock
+++ b/mobilenet/yarn.lock
@@ -2,12 +2,12 @@
# yarn lockfile v1
-"@tensorflow/tfjs-converter@^1.1.2":
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.2.tgz#2400ac77b30f973f1fcb26c912b28271f7f4d605"
- integrity sha512-KuLIIJYzmRmtJXcjBH3inQVhTHbABj2TNAVS3ss12hzDiEE/RiRb/LZKo8XV2WczuZXTq+gxep84PWXSH/HQXA==
+"@tensorflow/tfjs-converter@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.2.1.tgz#996e9e2e7d0f03717e7fc1211176ee43049b38ac"
+ integrity sha512-HKWlGV9uSWMUaogo6TyS/x2xdgO/du/vXPj91iGnm+t44Jl++1PXYD0LKD1LdNLR2RhUS3TJv6HuqDmYOO8EYw==
-"@tensorflow/tfjs-core@^1.1.2":
+"@tensorflow/tfjs-core@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
diff --git a/posenet/demos/package.json b/posenet/demos/package.json
index 55a4b3e479..f6ee4a7fcc 100644
--- a/posenet/demos/package.json
+++ b/posenet/demos/package.json
@@ -9,8 +9,8 @@
"node": ">=8.9.0"
},
"dependencies": {
- "@tensorflow-models/posenet": "^2.0.0",
- "@tensorflow/tfjs": "^1.1.2",
+ "@tensorflow-models/posenet": "^2.0.1",
+ "@tensorflow/tfjs": "^1.2.1",
"stats.js": "^0.17.0"
},
"scripts": {
diff --git a/posenet/package.json b/posenet/package.json
index 223717a379..7018996c43 100644
--- a/posenet/package.json
+++ b/posenet/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/posenet",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "Pretrained PoseNet model in TensorFlow.js",
"main": "dist/index.js",
"jsnext:main": "dist/posenet.esm.js",
@@ -13,12 +13,12 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs-core": "^1.1.2",
- "@tensorflow/tfjs-converter": "^1.1.2"
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs-core": "^1.1.2",
- "@tensorflow/tfjs-converter": "^1.1.2",
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1",
"@types/jasmine": "~2.5.53",
"babel-core": "^6.26.0",
"babel-plugin-transform-runtime": "~6.23.0",
diff --git a/posenet/src/mobilenet.ts b/posenet/src/mobilenet.ts
index 8f65fd62dc..1e830faf0c 100644
--- a/posenet/src/mobilenet.ts
+++ b/posenet/src/mobilenet.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tfc from '@tensorflow/tfjs-converter';
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
import {BaseModel, PoseNetOutputStride, PoseNetResolution} from './posenet_model';
@@ -54,12 +54,12 @@ function toFloatIfInt(input: tf.Tensor3D): tf.Tensor3D {
}
export class MobileNet implements BaseModel {
- readonly model: tfc.GraphModel
+ readonly model: tfconv.GraphModel
readonly outputStride: PoseNetOutputStride
readonly inputResolution: PoseNetResolution;
constructor(
- model: tfc.GraphModel, inputResolution: PoseNetResolution,
+ model: tfconv.GraphModel, inputResolution: PoseNetResolution,
outputStride: PoseNetOutputStride) {
this.model = model;
const inputShape =
@@ -97,4 +97,4 @@ export class MobileNet implements BaseModel {
dispose() {
this.model.dispose();
}
-}
\ No newline at end of file
+}
diff --git a/posenet/src/posenet_model.ts b/posenet/src/posenet_model.ts
index 020485b001..0e6b4670bc 100644
--- a/posenet/src/posenet_model.ts
+++ b/posenet/src/posenet_model.ts
@@ -15,7 +15,7 @@
* =============================================================================
*/
-import * as tfc from '@tensorflow/tfjs-converter';
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
import {mobileNetCheckpoint, resNet50Checkpoint} from './checkpoints';
@@ -402,7 +402,7 @@ async function loadMobileNet(config: ModelConfig): Promise {
const url = mobileNetCheckpoint(
inputResolution, outputStride, multiplier, quantBytes);
- const graphModel = await tfc.loadGraphModel(config.modelUrl || url);
+ const graphModel = await tfconv.loadGraphModel(config.modelUrl || url);
const mobilenet = new MobileNet(graphModel, inputResolution, outputStride);
return new PoseNet(mobilenet);
}
@@ -419,7 +419,7 @@ async function loadResNet(config: ModelConfig): Promise {
}
const url = resNet50Checkpoint(outputStride, quantBytes);
- const graphModel = await tfc.loadGraphModel(config.modelUrl || url);
+ const graphModel = await tfconv.loadGraphModel(config.modelUrl || url);
const resnet = new ResNet(graphModel, inputResolution, outputStride);
return new PoseNet(resnet);
}
diff --git a/posenet/src/posenet_test.ts b/posenet/src/posenet_test.ts
index b35e1d5fc8..ecab72b992 100644
--- a/posenet/src/posenet_test.ts
+++ b/posenet/src/posenet_test.ts
@@ -16,7 +16,7 @@
=============================================================================
*/
-import * as tfc from '@tensorflow/tfjs-converter';
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
import {describeWithFlags, NODE_ENVS} from '@tensorflow/tfjs-core/dist/jasmine_util';
@@ -52,7 +52,7 @@ describeWithFlags('PoseNet', NODE_ENVS, () => {
quantBytes: quantBytes
} as posenetModel.ModelConfig;
- spyOn(tfc, 'loadGraphModel').and.callFake((): tfc.GraphModel => {
+ spyOn(tfconv, 'loadGraphModel').and.callFake((): tfconv.GraphModel => {
return null;
})
diff --git a/posenet/src/resnet.ts b/posenet/src/resnet.ts
index 4b79f60ece..8a0d5c65e2 100644
--- a/posenet/src/resnet.ts
+++ b/posenet/src/resnet.ts
@@ -1,4 +1,4 @@
-import * as tfc from '@tensorflow/tfjs-converter';
+import * as tfconv from '@tensorflow/tfjs-converter';
import * as tf from '@tensorflow/tfjs-core';
import {BaseModel, PoseNetOutputStride, PoseNetResolution} from './posenet_model';
@@ -14,12 +14,12 @@ function toFloatIfInt(input: tf.Tensor3D): tf.Tensor3D {
}
export class ResNet implements BaseModel {
- readonly model: tfc.GraphModel;
+ readonly model: tfconv.GraphModel;
readonly outputStride: PoseNetOutputStride;
readonly inputResolution: PoseNetResolution;
constructor(
- model: tfc.GraphModel, inputResolution: PoseNetResolution,
+ model: tfconv.GraphModel, inputResolution: PoseNetResolution,
outputStride: PoseNetOutputStride) {
this.model = model;
const inputShape =
diff --git a/universal-sentence-encoder/demo/package.json b/universal-sentence-encoder/demo/package.json
index e56f14a80f..3c21fcdc44 100644
--- a/universal-sentence-encoder/demo/package.json
+++ b/universal-sentence-encoder/demo/package.json
@@ -9,8 +9,8 @@
"node": ">=8.9.0"
},
"dependencies": {
- "@tensorflow-models/universal-sentence-encoder": "^1.0.2",
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow-models/universal-sentence-encoder": "1.1.0",
+ "@tensorflow/tfjs": "^1.2.1",
"d3-scale-chromatic": "^1.3.3"
},
"scripts": {
diff --git a/universal-sentence-encoder/demo/yarn.lock b/universal-sentence-encoder/demo/yarn.lock
index 49f2c48e93..626982e14c 100644
--- a/universal-sentence-encoder/demo/yarn.lock
+++ b/universal-sentence-encoder/demo/yarn.lock
@@ -651,10 +651,8 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
-"@tensorflow-models/universal-sentence-encoder@^1.0.2":
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/@tensorflow-models/universal-sentence-encoder/-/universal-sentence-encoder-1.0.2.tgz#a317c96b90ee2a32e079c0f36f0585e599a2b434"
- integrity sha512-1XcVvYEgMU2Fhu83Rya2iKuBhfHF3gagSG+NfonzoxeOg30eOOeabWg1iLmKFCY55b9ECZ4Rj441rK18rEa70g==
+"@tensorflow-models/universal-sentence-encoder@file:.yalc/@tensorflow-models/universal-sentence-encoder":
+ version "1.0.3-09f4ad68"
"@tensorflow/tfjs-converter@1.1.0":
version "1.1.0"
diff --git a/universal-sentence-encoder/package.json b/universal-sentence-encoder/package.json
index 069ff1a0e2..d4409e51d9 100644
--- a/universal-sentence-encoder/package.json
+++ b/universal-sentence-encoder/package.json
@@ -1,6 +1,6 @@
{
"name": "@tensorflow-models/universal-sentence-encoder",
- "version": "1.0.3",
+ "version": "1.1.0",
"description": "Universal Sentence Encoder lite in TensorFlow.js",
"main": "dist/index.js",
"jsnext:main": "dist/universal-sentence-encoder.esm.js",
@@ -13,10 +13,12 @@
"url": "https://github.com/tensorflow/tfjs-models.git"
},
"peerDependencies": {
- "@tensorflow/tfjs": "^1.1.0"
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1"
},
"devDependencies": {
- "@tensorflow/tfjs": "^1.1.0",
+ "@tensorflow/tfjs-core": "~1.2.1",
+ "@tensorflow/tfjs-converter": "~1.2.1",
"@types/jasmine": "~2.5.53",
"jasmine": "^3.3.1",
"jasmine-core": "^3.3.0",
@@ -38,4 +40,4 @@
"lint": "tslint -p . -t verbose"
},
"license": "Apache-2.0"
-}
\ No newline at end of file
+}
diff --git a/universal-sentence-encoder/src/index.ts b/universal-sentence-encoder/src/index.ts
index e8512c1d85..7ee04ac918 100644
--- a/universal-sentence-encoder/src/index.ts
+++ b/universal-sentence-encoder/src/index.ts
@@ -15,7 +15,8 @@
* =============================================================================
*/
-import * as tf from '@tensorflow/tfjs';
+import * as tfconv from '@tensorflow/tfjs-converter';
+import * as tf from '@tensorflow/tfjs-core';
import {Tokenizer} from './tokenizer';
@@ -51,11 +52,11 @@ async function loadVocabulary(pathToVocabulary = `${BASE_PATH}vocab.json`) {
}
export class UniversalSentenceEncoder {
- private model: tf.GraphModel;
+ private model: tfconv.GraphModel;
private tokenizer: Tokenizer;
async loadModel() {
- return tf.loadGraphModel(`${BASE_PATH}model.json`);
+ return tfconv.loadGraphModel(`${BASE_PATH}model.json`);
}
async load() {
diff --git a/universal-sentence-encoder/yarn.lock b/universal-sentence-encoder/yarn.lock
index 24d728a9fd..5c7c253342 100644
--- a/universal-sentence-encoder/yarn.lock
+++ b/universal-sentence-encoder/yarn.lock
@@ -2,15 +2,15 @@
# yarn lockfile v1
-"@tensorflow/tfjs-converter@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.1.0.tgz#1d6f58347e9b3826c02090e06e6590b0c4df2d4e"
- integrity sha512-gUkoRoYm9yrVVQNp8nD+pEWOPUNhayCSrUHNItSfIm8Lzbgx6brVxVdz5T8V0kT0yh67Pp9Er/LIlf54p7KikA==
+"@tensorflow/tfjs-converter@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.2.1.tgz#996e9e2e7d0f03717e7fc1211176ee43049b38ac"
+ integrity sha512-HKWlGV9uSWMUaogo6TyS/x2xdgO/du/vXPj91iGnm+t44Jl++1PXYD0LKD1LdNLR2RhUS3TJv6HuqDmYOO8EYw==
-"@tensorflow/tfjs-core@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.1.0.tgz#028c69291e19c328c4c30e18d29b09135c22cb44"
- integrity sha512-loPpHGVjiyEb+Ixlsj8prQ/r4exekITn7vM4WEyHUouFKx0/CuoB2FQ0m6DSb/6ApvucxTWGGNTRRo4HK4Ma0Q==
+"@tensorflow/tfjs-core@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.2.1.tgz#0ff54aa7fd412b8c17e39f6ec5a97bf032e8f530"
+ integrity sha512-cpSHl+tP7cketq0cAyJPbIGxNlPV7mR6lkMLLDvZAmZUTBSyBufCdJg/KwgjHMZksE/KqjL4/RyccOGBAQcb7g==
dependencies:
"@types/seedrandom" "2.4.27"
"@types/webgl-ext" "0.0.30"
@@ -20,29 +20,6 @@
optionalDependencies:
rollup-plugin-visualizer "~1.1.1"
-"@tensorflow/tfjs-data@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.1.0.tgz#8d9a0175497930061532c8d43b419b25b26b9bbf"
- integrity sha512-0+PfAsaZs/pmaxiLunb4c1rPRdu47+CYe5kxpu2P8Xn3k+vhlBYMu+zsVgs5RrTRFLWVzVeH9muA1SJLkMGZPA==
- dependencies:
- "@types/node-fetch" "^2.1.2"
- node-fetch "~2.1.2"
-
-"@tensorflow/tfjs-layers@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.1.0.tgz#fd221c254d2fca13e93e83669bdde3140e7a0434"
- integrity sha512-a0gXjOWvGi9gc2q8/gK79zfD5WqEZnAhZfpm6b7AoKXjDUBq4GgdbbWCfv2nYBlmMoXgRSRSV44UmJVExep0uw==
-
-"@tensorflow/tfjs@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.1.0.tgz#77809dc336655a7ff0bbf76527cc3d7b9e68e330"
- integrity sha512-CxcFzl2KtknO3f12xuuv8kq8usMA7xGWpJajubIlYBp4KoBDhiDimP/DwBlTvFZq5RT5riHGtA4BWjMj6rnDcw==
- dependencies:
- "@tensorflow/tfjs-converter" "1.1.0"
- "@tensorflow/tfjs-core" "1.1.0"
- "@tensorflow/tfjs-data" "1.1.0"
- "@tensorflow/tfjs-layers" "1.1.0"
-
"@types/estree@0.0.38":
version "0.0.38"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2"
@@ -53,13 +30,6 @@
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.54.tgz#a6b5f2ae2afb6e0307774e8c7c608e037d491c63"
integrity sha512-B9YofFbUljs19g5gBKUYeLIulsh31U5AK70F41BImQRHEZQGm4GcN922UvnYwkduMqbC/NH+9fruWa/zrqvHIg==
-"@types/node-fetch@^2.1.2":
- version "2.3.2"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.2.tgz#e01893b176c6fa1367743726380d65bce5d6576b"
- integrity sha512-yW0EOebSsQme9yKu09XbdDfle4/SmWZMK4dfteWcSLCYNQQcF+YOv0kIrvm+9pO11/ghA4E6A+RNQqvYj4Nr3A==
- dependencies:
- "@types/node" "*"
-
"@types/node@*":
version "11.13.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.6.tgz#37ec75690830acb0d74ce3c6c43caab787081e85"