Skip to content

Commit 00cce9a

Browse files
Update tfjs to 3.1.0 (#592)
Co-authored-by: Matthew Soulanille <[email protected]>
1 parent 42ab387 commit 00cce9a

File tree

7 files changed

+57
-49
lines changed

7 files changed

+57
-49
lines changed

body-pix/demos/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111
"dependencies": {
1212
"@tensorflow-models/body-pix": "file:../dist",
1313
"@tensorflow-models/posenet": "^2.1.3",
14-
"@tensorflow/tfjs-backend-webgl": "~3.0.0-rc.1",
15-
"@tensorflow/tfjs-converter": "~3.0.0-rc.1",
16-
"@tensorflow/tfjs-core": "~3.0.0-rc.1",
14+
"@tensorflow/tfjs-backend-webgl": "^3.1.0",
15+
"@tensorflow/tfjs-converter": "^3.1.0",
16+
"@tensorflow/tfjs-core": "^3.1.0",
1717
"stats.js": "0.17.0"
1818
},
1919
"scripts": {
2020
"watch": "cross-env NODE_ENV=development parcel index.html --no-hmr --open ",
2121
"build": "cross-env NODE_ENV=production parcel build index.html --public-url ./",
2222
"lint": "eslint .",
23-
"link-local": "yalc link"
23+
"link-local": "yalc link",
24+
"build-model": "cd .. && yarn && yarn build-npm",
25+
"build-deps": "yarn build-model"
2426
},
2527
"browser": {
2628
"crypto": false

body-pix/demos/yarn.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -750,35 +750,35 @@
750750
resolved "https://registry.yarnpkg.com/@tensorflow-models/posenet/-/posenet-2.1.3.tgz#09633e6e6e41d6c00d2ee7633632fb9322651463"
751751
integrity sha512-Z6HvkJhLWtXt5BD+1c9iaUGlHjohiPkeRJQpr1hu57opvTmwswwmwwRAKsmM07AVjuUT0D49QordE6zkjIJ3mg==
752752

753-
"@tensorflow/tfjs-backend-cpu@3.0.0-rc.1":
754-
version "3.0.0-rc.1"
755-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.0.0-rc.1.tgz#b02e05706b2d91ab601e7eb397b6ea60ac0a9e2e"
756-
integrity sha512-9+13fs3vVpfOpDY+Aa/JXdda2SuBN/clxxoNYIX3pMY0GAGwpUaAkSECLuOOhnngHcl9pxuaJtgqrCcrq+A3/A==
753+
"@tensorflow/tfjs-backend-cpu@3.1.0":
754+
version "3.1.0"
755+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.1.0.tgz#eabe616df679d567b6b6b929c06e45c4f24771a8"
756+
integrity sha512-BsuDEg11z3QDuvjZSge/ssITl/GHUvHjvHgJOptz4lVwAMFxzNErkL/e8fUeWQp2SI2m7oWsx2vx/H1Y9cd3Gg==
757757
dependencies:
758758
"@types/seedrandom" "2.4.27"
759759
seedrandom "2.4.3"
760760

761-
"@tensorflow/tfjs-backend-webgl@~3.0.0-rc.1":
762-
version "3.0.0-rc.1"
763-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.0.0-rc.1.tgz#21aacedcef687d2bb075c7951ac9e4f57faa79e6"
764-
integrity sha512-qEjtL/71HflBHJgWXhtj+8BVYB9Q+NHw282QGWi9QLA9SlWe3BRJhbGCaD28/Ddl+mSzBWFQnK+sKdZ04LL1Sg==
761+
"@tensorflow/tfjs-backend-webgl@^3.1.0":
762+
version "3.1.0"
763+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.1.0.tgz#c7ee2a9d146e1b08bdd32f467da09009d255d39b"
764+
integrity sha512-9J80sJR35Cg6BxTmQE8ljF4XLT3DXdvfLKF3C1xhRqV25PWsBvwlcvEuv6yCXp109topqJgbVnsmewS6vvVtDw==
765765
dependencies:
766-
"@tensorflow/tfjs-backend-cpu" "3.0.0-rc.1"
766+
"@tensorflow/tfjs-backend-cpu" "3.1.0"
767767
"@types/offscreencanvas" "~2019.3.0"
768768
"@types/seedrandom" "2.4.27"
769769
"@types/webgl-ext" "0.0.30"
770770
"@types/webgl2" "0.0.5"
771771
seedrandom "2.4.3"
772772

773-
"@tensorflow/tfjs-converter@~3.0.0-rc.1":
774-
version "3.0.0-rc.1"
775-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.0.0-rc.1.tgz#a15eb72ade80f7ae0e6403020763be0c5af6f2f7"
776-
integrity sha512-vVezwsDtrqM9CGDU+9c1WvPbLB5Odi9uiyEUHZEXMgNnPZ9Ix8a7RFOL7Y+8uBsI3B5wmLrWJuUNeyxUjA7yiA==
773+
"@tensorflow/tfjs-converter@^3.1.0":
774+
version "3.1.0"
775+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.1.0.tgz#9825d26eec177920ee2e184cb794d697066dd1c5"
776+
integrity sha512-V1DJ9ha9fy7pSXm6H6IGH4iF/5V32o32M8ZhFy7eydYUNWTJau8svpFI/i8AhJ1htVHKXtPTEPAo/T5XXsWN/g==
777777

778-
"@tensorflow/tfjs-core@~3.0.0-rc.1":
779-
version "3.0.0-rc.1"
780-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.0.0-rc.1.tgz#0b5316871eef2a4c8aa149d154e6ea6bbc7b631e"
781-
integrity sha512-h9a0TyWNJFqgmyfSklwI2q0SC93WFr8FBHwHorvsfm2mDK0ZrSs6bhWqa44tWRJjCrJNRq9J4GoTZQM292RTwg==
778+
"@tensorflow/tfjs-core@^3.1.0":
779+
version "3.1.0"
780+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.1.0.tgz#63884b124b38f8b2c00b8b4f88e36d3de7f07963"
781+
integrity sha512-KGSJEB6CTIk5YVgKbdpW0nAKuNtWaMdqYSrNYX43IAGdNrH0vDsipACH/bhrQyo9/NYiK/4Jbkr4k9pGwwiPJQ==
782782
dependencies:
783783
"@types/offscreencanvas" "~2019.3.0"
784784
"@types/seedrandom" "2.4.27"

body-pix/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tensorflow-models/body-pix",
3-
"version": "2.0.5",
3+
"version": "2.1.0",
44
"description": "Pretrained BodyPix model in TensorFlow.js",
55
"main": "dist/index.js",
66
"jsnext:main": "dist/body-pix.esm.js",
@@ -13,15 +13,15 @@
1313
"url": "https://github.com/tensorflow/tfjs-models.git"
1414
},
1515
"peerDependencies": {
16-
"@tensorflow/tfjs-backend-webgl": "^3.0.0-rc.1",
17-
"@tensorflow/tfjs-converter": "^3.0.0-rc.1",
18-
"@tensorflow/tfjs-core": "^3.0.0-rc.1"
16+
"@tensorflow/tfjs-backend-webgl": "^3.1.0",
17+
"@tensorflow/tfjs-converter": "^3.1.0",
18+
"@tensorflow/tfjs-core": "^3.1.0"
1919
},
2020
"devDependencies": {
2121
"@babel/polyfill": "^7.8.7",
22-
"@tensorflow/tfjs-backend-webgl": "^3.0.0-rc.1",
23-
"@tensorflow/tfjs-converter": "^3.0.0-rc.1",
24-
"@tensorflow/tfjs-core": "^3.0.0-rc.1",
22+
"@tensorflow/tfjs-backend-webgl": "^3.1.0",
23+
"@tensorflow/tfjs-converter": "^3.1.0",
24+
"@tensorflow/tfjs-core": "^3.1.0",
2525
"@types/jasmine": "~2.5.53",
2626
"jasmine": "~3.2.0",
2727
"jasmine-core": "~3.1.0",

body-pix/src/multi_person/decode_instance_masks.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ export async function decodePersonInstanceMasks(
5454

5555
if (isWebGlBackend()) {
5656
const personSegmentations = tf.tidy(() => {
57-
const masksTensor = decodeMultipleMasksWebGl(
57+
const masksTensorInfo = decodeMultipleMasksWebGl(
5858
segmentation, longOffsets, posesAboveScore, height, width, stride,
5959
[inHeight, inWidth], padding, refineSteps, minKeypointScore,
6060
maxNumPeople);
61+
const masksTensor = tf.engine().makeTensorFromDataId(
62+
masksTensorInfo.dataId, masksTensorInfo.shape,
63+
masksTensorInfo.dtype) as tf.Tensor2D;
6164

6265
return posesAboveScore.map(
6366
(_, k) => toPersonKSegmentation(masksTensor, k));
@@ -93,10 +96,13 @@ export async function decodePersonInstancePartMasks(
9396

9497
if (isWebGlBackend()) {
9598
const partSegmentations = tf.tidy(() => {
96-
const masksTensor = decodeMultipleMasksWebGl(
99+
const masksTensorInfo = decodeMultipleMasksWebGl(
97100
segmentation, longOffsets, posesAboveScore, height, width, stride,
98101
[inHeight, inWidth], padding, refineSteps, minKeypointScore,
99102
maxNumPeople);
103+
const masksTensor = tf.engine().makeTensorFromDataId(
104+
masksTensorInfo.dataId, masksTensorInfo.shape,
105+
masksTensorInfo.dtype) as tf.Tensor2D;
100106

101107
return posesAboveScore.map(
102108
(_, k) =>

body-pix/src/multi_person/decode_multiple_masks_webgl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function decodeMultipleMasksWebGl(
2727
posesAboveScore: Pose[], height: number, width: number, stride: number,
2828
[inHeight, inWidth]: [number, number], padding: Padding,
2929
refineSteps: number, minKptScore: number,
30-
maxNumPeople: number): tf.Tensor2D {
30+
maxNumPeople: number): tf.TensorInfo {
3131
// The height/width of the image/canvas itself.
3232
const [origHeight, origWidth] = segmentation.shape;
3333
// The height/width of the output of the model.

body-pix/src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @license See the LICENSE file. */
22

33
// This code is auto-generated, do not modify this file!
4-
const version = '2.0.5';
4+
const version = '2.1.0';
55
export {version};

body-pix/yarn.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -843,35 +843,35 @@
843843
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd"
844844
integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==
845845

846-
"@tensorflow/tfjs-backend-cpu@3.0.0-rc.1":
847-
version "3.0.0-rc.1"
848-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.0.0-rc.1.tgz#b02e05706b2d91ab601e7eb397b6ea60ac0a9e2e"
849-
integrity sha512-9+13fs3vVpfOpDY+Aa/JXdda2SuBN/clxxoNYIX3pMY0GAGwpUaAkSECLuOOhnngHcl9pxuaJtgqrCcrq+A3/A==
846+
"@tensorflow/tfjs-backend-cpu@3.1.0":
847+
version "3.1.0"
848+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.1.0.tgz#eabe616df679d567b6b6b929c06e45c4f24771a8"
849+
integrity sha512-BsuDEg11z3QDuvjZSge/ssITl/GHUvHjvHgJOptz4lVwAMFxzNErkL/e8fUeWQp2SI2m7oWsx2vx/H1Y9cd3Gg==
850850
dependencies:
851851
"@types/seedrandom" "2.4.27"
852852
seedrandom "2.4.3"
853853

854-
"@tensorflow/tfjs-backend-webgl@^3.0.0-rc.1":
855-
version "3.0.0-rc.1"
856-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.0.0-rc.1.tgz#21aacedcef687d2bb075c7951ac9e4f57faa79e6"
857-
integrity sha512-qEjtL/71HflBHJgWXhtj+8BVYB9Q+NHw282QGWi9QLA9SlWe3BRJhbGCaD28/Ddl+mSzBWFQnK+sKdZ04LL1Sg==
854+
"@tensorflow/tfjs-backend-webgl@^3.1.0":
855+
version "3.1.0"
856+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.1.0.tgz#c7ee2a9d146e1b08bdd32f467da09009d255d39b"
857+
integrity sha512-9J80sJR35Cg6BxTmQE8ljF4XLT3DXdvfLKF3C1xhRqV25PWsBvwlcvEuv6yCXp109topqJgbVnsmewS6vvVtDw==
858858
dependencies:
859-
"@tensorflow/tfjs-backend-cpu" "3.0.0-rc.1"
859+
"@tensorflow/tfjs-backend-cpu" "3.1.0"
860860
"@types/offscreencanvas" "~2019.3.0"
861861
"@types/seedrandom" "2.4.27"
862862
"@types/webgl-ext" "0.0.30"
863863
"@types/webgl2" "0.0.5"
864864
seedrandom "2.4.3"
865865

866-
"@tensorflow/tfjs-converter@^3.0.0-rc.1":
867-
version "3.0.0-rc.1"
868-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.0.0-rc.1.tgz#a15eb72ade80f7ae0e6403020763be0c5af6f2f7"
869-
integrity sha512-vVezwsDtrqM9CGDU+9c1WvPbLB5Odi9uiyEUHZEXMgNnPZ9Ix8a7RFOL7Y+8uBsI3B5wmLrWJuUNeyxUjA7yiA==
866+
"@tensorflow/tfjs-converter@^3.1.0":
867+
version "3.1.0"
868+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.1.0.tgz#9825d26eec177920ee2e184cb794d697066dd1c5"
869+
integrity sha512-V1DJ9ha9fy7pSXm6H6IGH4iF/5V32o32M8ZhFy7eydYUNWTJau8svpFI/i8AhJ1htVHKXtPTEPAo/T5XXsWN/g==
870870

871-
"@tensorflow/tfjs-core@^3.0.0-rc.1":
872-
version "3.0.0-rc.1"
873-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.0.0-rc.1.tgz#0b5316871eef2a4c8aa149d154e6ea6bbc7b631e"
874-
integrity sha512-h9a0TyWNJFqgmyfSklwI2q0SC93WFr8FBHwHorvsfm2mDK0ZrSs6bhWqa44tWRJjCrJNRq9J4GoTZQM292RTwg==
871+
"@tensorflow/tfjs-core@^3.1.0":
872+
version "3.1.0"
873+
resolved "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.1.0.tgz#63884b124b38f8b2c00b8b4f88e36d3de7f07963"
874+
integrity sha512-KGSJEB6CTIk5YVgKbdpW0nAKuNtWaMdqYSrNYX43IAGdNrH0vDsipACH/bhrQyo9/NYiK/4Jbkr4k9pGwwiPJQ==
875875
dependencies:
876876
"@types/offscreencanvas" "~2019.3.0"
877877
"@types/seedrandom" "2.4.27"

0 commit comments

Comments
 (0)