@tensorflow-models/blazeface
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
import{slice,add,div,sub,mul,concat2d,Tensor,tidy,concat,tensor1d,squeeze,tensor2d,image,sigmoid,reshape,browser,expandDims,cast}from"@tensorflow/tfjs-core";import{loadGraphModel}from"@tensorflow/tfjs-converter";function __awaiter(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})}function __generator(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var disposeBox=function(e){e.startEndTensor.dispose(),e.startPoint.dispose(),e.endPoint.dispose()},createBox=function(e){return{startEndTensor:e,startPoint:slice(e,[0,0],[-1,2]),endPoint:slice(e,[0,2],[-1,2])}},scaleBox=function(e,t){var n=mul(e.startPoint,t),r=mul(e.endPoint,t),o=concat2d([n,r],1);return createBox(o)},ANCHORS_CONFIG={strides:[8,16],anchors:[2,6]},NUM_LANDMARKS=6;function generateAnchors(e,t,n){for(var r=[],o=0;o<n.strides.length;o++)for(var i=n.strides[o],a=Math.floor((t+i-1)/i),s=Math.floor((e+i-1)/i),c=n.anchors[o],u=0;u<a;u++)for(var l=i*(u+.5),d=0;d<s;d++)for(var h=i*(d+.5),f=0;f<c;f++)r.push([h,l]);return r}function decodeBounds(e,t,n){var r=slice(e,[0,1],[-1,2]),o=add(r,t),i=slice(e,[0,3],[-1,2]),a=div(i,n),s=div(o,n),c=div(a,2),u=sub(s,c),l=add(s,c),d=mul(u,n),h=mul(l,n);return concat2d([d,h],1)}function getInputTensorDimensions(e){return e instanceof Tensor?[e.shape[0],e.shape[1]]:[e.height,e.width]}function flipFaceHorizontal(e,t){var n,r,o;if(e.topLeft instanceof Tensor&&e.bottomRight instanceof Tensor){var i=tidy(function(){return[concat([slice(sub(t-1,e.topLeft),0,1),slice(e.topLeft,1,1)]),concat([sub(t-1,slice(e.bottomRight,0,1)),slice(e.bottomRight,1,1)])]});n=i[0],r=i[1],null!=e.landmarks&&(o=tidy(function(){var n=sub(tensor1d([t-1,0]),e.landmarks),r=tensor1d([1,-1]);return mul(n,r)}))}else{var a=e.topLeft,s=a[0],c=a[1],u=e.bottomRight,l=u[0],d=u[1];n=[t-1-s,c],r=[t-1-l,d],null!=e.landmarks&&(o=e.landmarks.map(function(e){return[t-1-e[0],e[1]]}))}var h={topLeft:n,bottomRight:r};return null!=o&&(h.landmarks=o),null!=e.probability&&(h.probability=e.probability instanceof Tensor?e.probability.clone():e.probability),h}function scaleBoxFromPrediction(e,t){return tidy(function(){var n;return n=e.hasOwnProperty("box")?e.box:e,squeeze(scaleBox(n,t).startEndTensor)})}var BlazeFaceModel=function(){function e(e,t,n,r,o,i){this.blazeFaceModel=e,this.width=t,this.height=n,this.maxFaces=r,this.anchorsData=generateAnchors(t,n,ANCHORS_CONFIG),this.anchors=tensor2d(this.anchorsData),this.inputSizeData=[t,n],this.inputSize=tensor1d([t,n]),this.iouThreshold=o,this.scoreThreshold=i}return e.prototype.getBoundingBoxes=function(e,t,n){return void 0===n&&(n=!0),__awaiter(this,void 0,void 0,function(){var r,o,i,a,s,c,u,l,d,h,f,p,b,m,v=this;return __generator(this,function(y){switch(y.label){case 0:return r=tidy(function(){var t=image.resizeBilinear(e,[v.width,v.height]),n=mul(sub(div(t,255),.5),2),r=v.blazeFaceModel.predict(n),o=squeeze(r),i=decodeBounds(o,v.anchors,v.inputSize),a=slice(o,[0,0],[-1,1]);return[o,i,squeeze(sigmoid(a))]}),o=r[0],i=r[1],a=r[2],s=console.warn,console.warn=function(){},c=image.nonMaxSuppression(i,a,this.maxFaces,this.iouThreshold,this.scoreThreshold),console.warn=s,[4,c.array()];case 1:return u=y.sent(),c.dispose(),l=u.map(function(e){return slice(i,[e,0],[1,-1])}),t?[3,3]:[4,Promise.all(l.map(function(e){return __awaiter(v,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return[4,e.array()];case 1:return t=n.sent(),e.dispose(),[2,t]}})})}))];case 2:l=y.sent(),y.label=3;case 3:for(d=e.shape[1],h=e.shape[2],f=t?div([h,d],this.inputSize):[h/this.inputSizeData[0],d/this.inputSizeData[1]],p=[],b=function(e){var r=l[e],i=tidy(function(){var i=createBox(r instanceof Tensor?r:tensor2d(r));if(!n)return i;var s,c=u[e];return s=t?slice(v.anchors,[c,0],[1,2]):v.anchorsData[c],{box:i,landmarks:reshape(squeeze(slice(o,[c,NUM_LANDMARKS-1],[1,-1])),[NUM_LANDMARKS,-1]),probability:slice(a,[c],[1]),anchor:s}});p.push(i)},m=0;m<l.length;m++)b(m);return i.dispose(),a.dispose(),o.dispose(),[2,{boxes:p,scaleFactor:f}]}})})},e.prototype.estimateFaces=function(e,t,n,r){return void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),__awaiter(this,void 0,void 0,function(){var o,i,a,s,c,u,l=this;return __generator(this,function(d){switch(d.label){case 0:return o=getInputTensorDimensions(e),i=o[1],a=tidy(function(){return e instanceof Tensor||(e=browser.fromPixels(e)),expandDims(cast(e,"float32"),0)}),[4,this.getBoundingBoxes(a,t,r)];case 1:return s=d.sent(),c=s.boxes,u=s.scaleFactor,a.dispose(),t?[2,c.map(function(e){var t=scaleBoxFromPrediction(e,u),o={topLeft:slice(t,[0],[2]),bottomRight:slice(t,[2],[2])};if(r){var a=e,s=a.landmarks,c=a.probability,l=a.anchor,d=mul(add(s,l),u);o.landmarks=d,o.probability=c}return n&&(o=flipFaceHorizontal(o,i)),o})]:[2,Promise.all(c.map(function(e){return __awaiter(l,void 0,void 0,function(){var t,o,a,s,c,l,d,h,f,p,b,m=this;return __generator(this,function(v){switch(v.label){case 0:return t=scaleBoxFromPrediction(e,u),r?[3,2]:[4,t.array()];case 1:return c=v.sent(),o={topLeft:c.slice(0,2),bottomRight:c.slice(2)},[3,4];case 2:return[4,Promise.all([e.landmarks,t,e.probability].map(function(e){return __awaiter(m,void 0,void 0,function(){return __generator(this,function(t){return[2,e.array()]})})}))];case 3:a=v.sent(),s=a[0],c=a[1],l=a[2],d=e.anchor,f=(h=u)[0],p=h[1],b=s.map(function(e){return[(e[0]+d[0])*f,(e[1]+d[1])*p]}),o={topLeft:c.slice(0,2),bottomRight:c.slice(2),landmarks:b,probability:l},disposeBox(e.box),e.landmarks.dispose(),e.probability.dispose(),v.label=4;case 4:return t.dispose(),n&&(o=flipFaceHorizontal(o,i)),[2,o]}})})}))]}})})},e}(),BLAZEFACE_MODEL_URL="https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1";function load(e){var t=void 0===e?{}:e,n=t.maxFaces,r=void 0===n?10:n,o=t.inputWidth,i=void 0===o?128:o,a=t.inputHeight,s=void 0===a?128:a,c=t.iouThreshold,u=void 0===c?.3:c,l=t.scoreThreshold,d=void 0===l?.75:l;return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,loadGraphModel(BLAZEFACE_MODEL_URL,{fromTFHub:!0})];case 1:return e=t.sent(),[2,new BlazeFaceModel(e,i,s,r,u,d)]}})})}export{load,BlazeFaceModel}; | ||
import{slice,add,div,sub,mul,concat2d,Tensor,tidy,concat,tensor1d,squeeze,tensor2d,image,sigmoid,reshape,browser,expandDims,cast}from"@tensorflow/tfjs-core";import{loadGraphModel}from"@tensorflow/tfjs-converter";function __awaiter(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function __generator(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var disposeBox=function(e){e.startEndTensor.dispose(),e.startPoint.dispose(),e.endPoint.dispose()},createBox=function(e){return{startEndTensor:e,startPoint:slice(e,[0,0],[-1,2]),endPoint:slice(e,[0,2],[-1,2])}},scaleBox=function(e,t){var n=mul(e.startPoint,t),r=mul(e.endPoint,t),o=concat2d([n,r],1);return createBox(o)},ANCHORS_CONFIG={strides:[8,16],anchors:[2,6]},NUM_LANDMARKS=6;function generateAnchors(e,t,n){for(var r=[],o=0;o<n.strides.length;o++)for(var i=n.strides[o],a=Math.floor((t+i-1)/i),s=Math.floor((e+i-1)/i),c=n.anchors[o],l=0;l<a;l++)for(var u=i*(l+.5),d=0;d<s;d++)for(var h=i*(d+.5),f=0;f<c;f++)r.push([h,u]);return r}function decodeBounds(e,t,n){var r=slice(e,[0,1],[-1,2]),o=add(r,t),i=slice(e,[0,3],[-1,2]),a=div(i,n),s=div(o,n),c=div(a,2),l=sub(s,c),u=add(s,c),d=mul(l,n),h=mul(u,n);return concat2d([d,h],1)}function getInputTensorDimensions(e){return e instanceof Tensor?[e.shape[0],e.shape[1]]:[e.height,e.width]}function flipFaceHorizontal(e,t){var n,r,o;if(e.topLeft instanceof Tensor&&e.bottomRight instanceof Tensor){var i=tidy(function(){return[concat([slice(sub(t-1,e.topLeft),0,1),slice(e.topLeft,1,1)]),concat([sub(t-1,slice(e.bottomRight,0,1)),slice(e.bottomRight,1,1)])]});n=i[0],r=i[1],null!=e.landmarks&&(o=tidy(function(){var n=sub(tensor1d([t-1,0]),e.landmarks),r=tensor1d([1,-1]);return mul(n,r)}))}else{var a=e.topLeft,s=a[0],c=a[1],l=e.bottomRight,u=l[0],d=l[1];n=[t-1-s,c],r=[t-1-u,d],null!=e.landmarks&&(o=e.landmarks.map(function(e){return[t-1-e[0],e[1]]}))}var h={topLeft:n,bottomRight:r};return null!=o&&(h.landmarks=o),null!=e.probability&&(h.probability=e.probability instanceof Tensor?e.probability.clone():e.probability),h}function scaleBoxFromPrediction(e,t){return tidy(function(){var n;return n=e.hasOwnProperty("box")?e.box:e,squeeze(scaleBox(n,t).startEndTensor)})}var BlazeFaceModel=function(){function e(e,t,n,r,o,i){this.blazeFaceModel=e,this.width=t,this.height=n,this.maxFaces=r,this.anchorsData=generateAnchors(t,n,ANCHORS_CONFIG),this.anchors=tensor2d(this.anchorsData),this.inputSizeData=[t,n],this.inputSize=tensor1d([t,n]),this.iouThreshold=o,this.scoreThreshold=i}return e.prototype.getBoundingBoxes=function(e,t,n){return void 0===n&&(n=!0),__awaiter(this,void 0,void 0,function(){var r,o,i,a,s,c,l,u,d,h,f,p,b,m,v=this;return __generator(this,function(y){switch(y.label){case 0:return r=tidy(function(){var t=image.resizeBilinear(e,[v.width,v.height]),n=mul(sub(div(t,255),.5),2),r=v.blazeFaceModel.predict(n),o=squeeze(r),i=decodeBounds(o,v.anchors,v.inputSize),a=slice(o,[0,0],[-1,1]);return[o,i,squeeze(sigmoid(a))]}),o=r[0],i=r[1],a=r[2],s=console.warn,console.warn=function(){},c=image.nonMaxSuppression(i,a,this.maxFaces,this.iouThreshold,this.scoreThreshold),console.warn=s,[4,c.array()];case 1:return l=y.sent(),c.dispose(),u=l.map(function(e){return slice(i,[e,0],[1,-1])}),t?[3,3]:[4,Promise.all(u.map(function(e){return __awaiter(v,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return[4,e.array()];case 1:return t=n.sent(),e.dispose(),[2,t]}})})}))];case 2:u=y.sent(),y.label=3;case 3:for(d=e.shape[1],h=e.shape[2],f=t?div([h,d],this.inputSize):[h/this.inputSizeData[0],d/this.inputSizeData[1]],p=[],b=function(e){var r=u[e],i=tidy(function(){var i=createBox(r instanceof Tensor?r:tensor2d(r));if(!n)return i;var s,c=l[e];return s=t?slice(v.anchors,[c,0],[1,2]):v.anchorsData[c],{box:i,landmarks:reshape(squeeze(slice(o,[c,NUM_LANDMARKS-1],[1,-1])),[NUM_LANDMARKS,-1]),probability:slice(a,[c],[1]),anchor:s}});p.push(i)},m=0;m<u.length;m++)b(m);return i.dispose(),a.dispose(),o.dispose(),[2,{boxes:p,scaleFactor:f}]}})})},e.prototype.estimateFaces=function(e,t,n,r){return void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),__awaiter(this,void 0,void 0,function(){var o,i,a,s,c,l,u=this;return __generator(this,function(d){switch(d.label){case 0:return o=getInputTensorDimensions(e),i=o[1],a=tidy(function(){return e instanceof Tensor||(e=browser.fromPixels(e)),expandDims(cast(e,"float32"),0)}),[4,this.getBoundingBoxes(a,t,r)];case 1:return s=d.sent(),c=s.boxes,l=s.scaleFactor,a.dispose(),t?[2,c.map(function(e){var t=scaleBoxFromPrediction(e,l),o={topLeft:slice(t,[0],[2]),bottomRight:slice(t,[2],[2])};if(r){var a=e,s=a.landmarks,c=a.probability,u=a.anchor,d=mul(add(s,u),l);o.landmarks=d,o.probability=c}return n&&(o=flipFaceHorizontal(o,i)),o})]:[2,Promise.all(c.map(function(e){return __awaiter(u,void 0,void 0,function(){var t,o,a,s,c,u,d,h,f,p,b,m=this;return __generator(this,function(v){switch(v.label){case 0:return t=scaleBoxFromPrediction(e,l),r?[3,2]:[4,t.array()];case 1:return c=v.sent(),o={topLeft:c.slice(0,2),bottomRight:c.slice(2)},[3,4];case 2:return[4,Promise.all([e.landmarks,t,e.probability].map(function(e){return __awaiter(m,void 0,void 0,function(){return __generator(this,function(t){return[2,e.array()]})})}))];case 3:a=v.sent(),s=a[0],c=a[1],u=a[2],d=e.anchor,f=(h=l)[0],p=h[1],b=s.map(function(e){return[(e[0]+d[0])*f,(e[1]+d[1])*p]}),o={topLeft:c.slice(0,2),bottomRight:c.slice(2),landmarks:b,probability:u},disposeBox(e.box),e.landmarks.dispose(),e.probability.dispose(),v.label=4;case 4:return t.dispose(),n&&(o=flipFaceHorizontal(o,i)),[2,o]}})})}))]}})})},e}(),BLAZEFACE_MODEL_URL="https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1";function load(e){var t=void 0===e?{}:e,n=t.maxFaces,r=void 0===n?10:n,o=t.inputWidth,i=void 0===o?128:o,a=t.inputHeight,s=void 0===a?128:a,c=t.iouThreshold,l=void 0===c?.3:c,u=t.scoreThreshold,d=void 0===u?.75:u,h=t.modelUrl;return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return null==h?[3,2]:[4,loadGraphModel(h)];case 1:return e=t.sent(),[3,4];case 2:return[4,loadGraphModel(BLAZEFACE_MODEL_URL,{fromTFHub:!0})];case 3:e=t.sent(),t.label=4;case 4:return[2,new BlazeFaceModel(e,i,s,r,l,d)]}})})}export{load,BlazeFaceModel}; |
@@ -24,21 +24,22 @@ /** | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -485,3 +486,3 @@ }); | ||
function load(_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.maxFaces, maxFaces = _c === void 0 ? 10 : _c, _d = _b.inputWidth, inputWidth = _d === void 0 ? 128 : _d, _e = _b.inputHeight, inputHeight = _e === void 0 ? 128 : _e, _f = _b.iouThreshold, iouThreshold = _f === void 0 ? 0.3 : _f, _g = _b.scoreThreshold, scoreThreshold = _g === void 0 ? 0.75 : _g; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.maxFaces, maxFaces = _c === void 0 ? 10 : _c, _d = _b.inputWidth, inputWidth = _d === void 0 ? 128 : _d, _e = _b.inputHeight, inputHeight = _e === void 0 ? 128 : _e, _f = _b.iouThreshold, iouThreshold = _f === void 0 ? 0.3 : _f, _g = _b.scoreThreshold, scoreThreshold = _g === void 0 ? 0.75 : _g, modelUrl = _b.modelUrl; | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -491,5 +492,15 @@ var blazeface, model; | ||
switch (_h.label) { | ||
case 0: return [4 /*yield*/, tfconv.loadGraphModel(BLAZEFACE_MODEL_URL, { fromTFHub: true })]; | ||
case 0: | ||
if (!(modelUrl != null)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, tfconv.loadGraphModel(modelUrl)]; | ||
case 1: | ||
blazeface = _h.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, tfconv.loadGraphModel(BLAZEFACE_MODEL_URL, { | ||
fromTFHub: true, | ||
})]; | ||
case 3: | ||
blazeface = _h.sent(); | ||
_h.label = 4; | ||
case 4: | ||
model = new BlazeFaceModel(blazeface, inputWidth, inputHeight, maxFaces, iouThreshold, scoreThreshold); | ||
@@ -496,0 +507,0 @@ return [2 /*return*/, model]; |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tensorflow/tfjs-core"),require("@tensorflow/tfjs-converter")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs-core","@tensorflow/tfjs-converter"],e):e(t.blazeface={},t.tf,t.tf)}(this,function(t,e,n){"use strict";function r(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(s,a)}u((r=r.apply(t,e||[])).next())})}function o(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var i=function(t){return{startEndTensor:t,startPoint:e.slice(t,[0,0],[-1,2]),endPoint:e.slice(t,[0,2],[-1,2])}},s=function(t,n){var r=e.mul(t.startPoint,n),o=e.mul(t.endPoint,n),s=e.concat2d([r,o],1);return i(s)},a={strides:[8,16],anchors:[2,6]};function u(t,n){var r,o,i;if(t.topLeft instanceof e.Tensor&&t.bottomRight instanceof e.Tensor){var s=e.tidy(function(){return[e.concat([e.slice(e.sub(n-1,t.topLeft),0,1),e.slice(t.topLeft,1,1)]),e.concat([e.sub(n-1,e.slice(t.bottomRight,0,1)),e.slice(t.bottomRight,1,1)])]});r=s[0],o=s[1],null!=t.landmarks&&(i=e.tidy(function(){var r=e.sub(e.tensor1d([n-1,0]),t.landmarks),o=e.tensor1d([1,-1]);return e.mul(r,o)}))}else{var a=t.topLeft,u=a[0],c=a[1],l=t.bottomRight,d=l[0],f=l[1];r=[n-1-u,c],o=[n-1-d,f],null!=t.landmarks&&(i=t.landmarks.map(function(t){return[n-1-t[0],t[1]]}))}var h={topLeft:r,bottomRight:o};return null!=i&&(h.landmarks=i),null!=t.probability&&(h.probability=t.probability instanceof e.Tensor?t.probability.clone():t.probability),h}function c(t,n){return e.tidy(function(){var r;return r=t.hasOwnProperty("box")?t.box:t,e.squeeze(s(r,n).startEndTensor)})}var l=function(){function t(t,n,r,o,i,s){this.blazeFaceModel=t,this.width=n,this.height=r,this.maxFaces=o,this.anchorsData=function(t,e,n){for(var r=[],o=0;o<n.strides.length;o++)for(var i=n.strides[o],s=Math.floor((e+i-1)/i),a=Math.floor((t+i-1)/i),u=n.anchors[o],c=0;c<s;c++)for(var l=i*(c+.5),d=0;d<a;d++)for(var f=i*(d+.5),h=0;h<u;h++)r.push([f,l]);return r}(n,r,a),this.anchors=e.tensor2d(this.anchorsData),this.inputSizeData=[n,r],this.inputSize=e.tensor1d([n,r]),this.iouThreshold=i,this.scoreThreshold=s}return t.prototype.getBoundingBoxes=function(t,n,s){return void 0===s&&(s=!0),r(this,void 0,void 0,function(){var a,u,c,l,d,f,h,p,b,v,m,y,w,g,x=this;return o(this,function(T){switch(T.label){case 0:return a=e.tidy(function(){var n,r,o,i,s,a,u,c,l,d,f,h,p,b=e.image.resizeBilinear(t,[x.width,x.height]),v=e.mul(e.sub(e.div(b,255),.5),2),m=x.blazeFaceModel.predict(v),y=e.squeeze(m),w=(n=y,r=x.anchors,o=x.inputSize,i=e.slice(n,[0,1],[-1,2]),s=e.add(i,r),a=e.slice(n,[0,3],[-1,2]),u=e.div(a,o),c=e.div(s,o),l=e.div(u,2),d=e.sub(c,l),f=e.add(c,l),h=e.mul(d,o),p=e.mul(f,o),e.concat2d([h,p],1)),g=e.slice(y,[0,0],[-1,1]);return[y,w,e.squeeze(e.sigmoid(g))]}),u=a[0],c=a[1],l=a[2],d=console.warn,console.warn=function(){},f=e.image.nonMaxSuppression(c,l,this.maxFaces,this.iouThreshold,this.scoreThreshold),console.warn=d,[4,f.array()];case 1:return h=T.sent(),f.dispose(),p=h.map(function(t){return e.slice(c,[t,0],[1,-1])}),n?[3,3]:[4,Promise.all(p.map(function(t){return r(x,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,t.array()];case 1:return e=n.sent(),t.dispose(),[2,e]}})})}))];case 2:p=T.sent(),T.label=3;case 3:for(b=t.shape[1],v=t.shape[2],m=n?e.div([v,b],this.inputSize):[v/this.inputSizeData[0],b/this.inputSizeData[1]],y=[],w=function(t){var r=p[t],o=e.tidy(function(){var o=r instanceof e.Tensor?i(r):i(e.tensor2d(r));if(!s)return o;var a,c=h[t];return a=n?e.slice(x.anchors,[c,0],[1,2]):x.anchorsData[c],{box:o,landmarks:e.reshape(e.squeeze(e.slice(u,[c,5],[1,-1])),[6,-1]),probability:e.slice(l,[c],[1]),anchor:a}});y.push(o)},g=0;g<p.length;g++)w(g);return c.dispose(),l.dispose(),u.dispose(),[2,{boxes:y,scaleFactor:m}]}})})},t.prototype.estimateFaces=function(t,n,i,s){return void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===s&&(s=!0),r(this,void 0,void 0,function(){var a,l,d,f,h,p,b=this;return o(this,function(v){switch(v.label){case 0:return a=function(t){return t instanceof e.Tensor?[t.shape[0],t.shape[1]]:[t.height,t.width]}(t),l=a[1],d=e.tidy(function(){return t instanceof e.Tensor||(t=e.browser.fromPixels(t)),e.expandDims(e.cast(t,"float32"),0)}),[4,this.getBoundingBoxes(d,n,s)];case 1:return f=v.sent(),h=f.boxes,p=f.scaleFactor,d.dispose(),n?[2,h.map(function(t){var n=c(t,p),r={topLeft:e.slice(n,[0],[2]),bottomRight:e.slice(n,[2],[2])};if(s){var o=t,a=o.landmarks,d=o.probability,f=o.anchor,h=e.mul(e.add(a,f),p);r.landmarks=h,r.probability=d}return i&&(r=u(r,l)),r})]:[2,Promise.all(h.map(function(t){return r(b,void 0,void 0,function(){var e,n,a,d,f,h,b,v,m,y,w,g=this;return o(this,function(x){switch(x.label){case 0:return e=c(t,p),s?[3,2]:[4,e.array()];case 1:return f=x.sent(),n={topLeft:f.slice(0,2),bottomRight:f.slice(2)},[3,4];case 2:return[4,Promise.all([t.landmarks,e,t.probability].map(function(t){return r(g,void 0,void 0,function(){return o(this,function(e){return[2,t.array()]})})}))];case 3:a=x.sent(),d=a[0],f=a[1],h=a[2],b=t.anchor,m=(v=p)[0],y=v[1],w=d.map(function(t){return[(t[0]+b[0])*m,(t[1]+b[1])*y]}),n={topLeft:f.slice(0,2),bottomRight:f.slice(2),landmarks:w,probability:h},(T=t.box).startEndTensor.dispose(),T.startPoint.dispose(),T.endPoint.dispose(),t.landmarks.dispose(),t.probability.dispose(),x.label=4;case 4:return e.dispose(),i&&(n=u(n,l)),[2,n]}var T})})}))]}})})},t}(),d="https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1";t.load=function(t){var e=void 0===t?{}:t,i=e.maxFaces,s=void 0===i?10:i,a=e.inputWidth,u=void 0===a?128:a,c=e.inputHeight,f=void 0===c?128:c,h=e.iouThreshold,p=void 0===h?.3:h,b=e.scoreThreshold,v=void 0===b?.75:b;return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,n.loadGraphModel(d,{fromTFHub:!0})];case 1:return t=e.sent(),[2,new l(t,u,f,s,p,v)]}})})},t.BlazeFaceModel=l,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tensorflow/tfjs-core"),require("@tensorflow/tfjs-converter")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs-core","@tensorflow/tfjs-converter"],e):e(t.blazeface={},t.tf,t.tf)}(this,function(t,e,n){"use strict";function r(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function o(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var i=function(t){return{startEndTensor:t,startPoint:e.slice(t,[0,0],[-1,2]),endPoint:e.slice(t,[0,2],[-1,2])}},s=function(t,n){var r=e.mul(t.startPoint,n),o=e.mul(t.endPoint,n),s=e.concat2d([r,o],1);return i(s)},a={strides:[8,16],anchors:[2,6]};function c(t,n){var r,o,i;if(t.topLeft instanceof e.Tensor&&t.bottomRight instanceof e.Tensor){var s=e.tidy(function(){return[e.concat([e.slice(e.sub(n-1,t.topLeft),0,1),e.slice(t.topLeft,1,1)]),e.concat([e.sub(n-1,e.slice(t.bottomRight,0,1)),e.slice(t.bottomRight,1,1)])]});r=s[0],o=s[1],null!=t.landmarks&&(i=e.tidy(function(){var r=e.sub(e.tensor1d([n-1,0]),t.landmarks),o=e.tensor1d([1,-1]);return e.mul(r,o)}))}else{var a=t.topLeft,c=a[0],u=a[1],l=t.bottomRight,d=l[0],f=l[1];r=[n-1-c,u],o=[n-1-d,f],null!=t.landmarks&&(i=t.landmarks.map(function(t){return[n-1-t[0],t[1]]}))}var h={topLeft:r,bottomRight:o};return null!=i&&(h.landmarks=i),null!=t.probability&&(h.probability=t.probability instanceof e.Tensor?t.probability.clone():t.probability),h}function u(t,n){return e.tidy(function(){var r;return r=t.hasOwnProperty("box")?t.box:t,e.squeeze(s(r,n).startEndTensor)})}var l=function(){function t(t,n,r,o,i,s){this.blazeFaceModel=t,this.width=n,this.height=r,this.maxFaces=o,this.anchorsData=function(t,e,n){for(var r=[],o=0;o<n.strides.length;o++)for(var i=n.strides[o],s=Math.floor((e+i-1)/i),a=Math.floor((t+i-1)/i),c=n.anchors[o],u=0;u<s;u++)for(var l=i*(u+.5),d=0;d<a;d++)for(var f=i*(d+.5),h=0;h<c;h++)r.push([f,l]);return r}(n,r,a),this.anchors=e.tensor2d(this.anchorsData),this.inputSizeData=[n,r],this.inputSize=e.tensor1d([n,r]),this.iouThreshold=i,this.scoreThreshold=s}return t.prototype.getBoundingBoxes=function(t,n,s){return void 0===s&&(s=!0),r(this,void 0,void 0,function(){var a,c,u,l,d,f,h,p,b,v,m,y,w,g,x=this;return o(this,function(T){switch(T.label){case 0:return a=e.tidy(function(){var n,r,o,i,s,a,c,u,l,d,f,h,p,b=e.image.resizeBilinear(t,[x.width,x.height]),v=e.mul(e.sub(e.div(b,255),.5),2),m=x.blazeFaceModel.predict(v),y=e.squeeze(m),w=(n=y,r=x.anchors,o=x.inputSize,i=e.slice(n,[0,1],[-1,2]),s=e.add(i,r),a=e.slice(n,[0,3],[-1,2]),c=e.div(a,o),u=e.div(s,o),l=e.div(c,2),d=e.sub(u,l),f=e.add(u,l),h=e.mul(d,o),p=e.mul(f,o),e.concat2d([h,p],1)),g=e.slice(y,[0,0],[-1,1]);return[y,w,e.squeeze(e.sigmoid(g))]}),c=a[0],u=a[1],l=a[2],d=console.warn,console.warn=function(){},f=e.image.nonMaxSuppression(u,l,this.maxFaces,this.iouThreshold,this.scoreThreshold),console.warn=d,[4,f.array()];case 1:return h=T.sent(),f.dispose(),p=h.map(function(t){return e.slice(u,[t,0],[1,-1])}),n?[3,3]:[4,Promise.all(p.map(function(t){return r(x,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,t.array()];case 1:return e=n.sent(),t.dispose(),[2,e]}})})}))];case 2:p=T.sent(),T.label=3;case 3:for(b=t.shape[1],v=t.shape[2],m=n?e.div([v,b],this.inputSize):[v/this.inputSizeData[0],b/this.inputSizeData[1]],y=[],w=function(t){var r=p[t],o=e.tidy(function(){var o=r instanceof e.Tensor?i(r):i(e.tensor2d(r));if(!s)return o;var a,u=h[t];return a=n?e.slice(x.anchors,[u,0],[1,2]):x.anchorsData[u],{box:o,landmarks:e.reshape(e.squeeze(e.slice(c,[u,5],[1,-1])),[6,-1]),probability:e.slice(l,[u],[1]),anchor:a}});y.push(o)},g=0;g<p.length;g++)w(g);return u.dispose(),l.dispose(),c.dispose(),[2,{boxes:y,scaleFactor:m}]}})})},t.prototype.estimateFaces=function(t,n,i,s){return void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===s&&(s=!0),r(this,void 0,void 0,function(){var a,l,d,f,h,p,b=this;return o(this,function(v){switch(v.label){case 0:return a=function(t){return t instanceof e.Tensor?[t.shape[0],t.shape[1]]:[t.height,t.width]}(t),l=a[1],d=e.tidy(function(){return t instanceof e.Tensor||(t=e.browser.fromPixels(t)),e.expandDims(e.cast(t,"float32"),0)}),[4,this.getBoundingBoxes(d,n,s)];case 1:return f=v.sent(),h=f.boxes,p=f.scaleFactor,d.dispose(),n?[2,h.map(function(t){var n=u(t,p),r={topLeft:e.slice(n,[0],[2]),bottomRight:e.slice(n,[2],[2])};if(s){var o=t,a=o.landmarks,d=o.probability,f=o.anchor,h=e.mul(e.add(a,f),p);r.landmarks=h,r.probability=d}return i&&(r=c(r,l)),r})]:[2,Promise.all(h.map(function(t){return r(b,void 0,void 0,function(){var e,n,a,d,f,h,b,v,m,y,w,g=this;return o(this,function(x){switch(x.label){case 0:return e=u(t,p),s?[3,2]:[4,e.array()];case 1:return f=x.sent(),n={topLeft:f.slice(0,2),bottomRight:f.slice(2)},[3,4];case 2:return[4,Promise.all([t.landmarks,e,t.probability].map(function(t){return r(g,void 0,void 0,function(){return o(this,function(e){return[2,t.array()]})})}))];case 3:a=x.sent(),d=a[0],f=a[1],h=a[2],b=t.anchor,m=(v=p)[0],y=v[1],w=d.map(function(t){return[(t[0]+b[0])*m,(t[1]+b[1])*y]}),n={topLeft:f.slice(0,2),bottomRight:f.slice(2),landmarks:w,probability:h},(T=t.box).startEndTensor.dispose(),T.startPoint.dispose(),T.endPoint.dispose(),t.landmarks.dispose(),t.probability.dispose(),x.label=4;case 4:return e.dispose(),i&&(n=c(n,l)),[2,n]}var T})})}))]}})})},t}(),d="https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1";t.load=function(t){var e=void 0===t?{}:t,i=e.maxFaces,s=void 0===i?10:i,a=e.inputWidth,c=void 0===a?128:a,u=e.inputHeight,f=void 0===u?128:u,h=e.iouThreshold,p=void 0===h?.3:h,b=e.scoreThreshold,v=void 0===b?.75:b,m=e.modelUrl;return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return null==m?[3,2]:[4,n.loadGraphModel(m)];case 1:return t=e.sent(),[3,4];case 2:return[4,n.loadGraphModel(d,{fromTFHub:!0})];case 3:t=e.sent(),e.label=4;case 4:return[2,new l(t,c,f,s,p,v)]}})})},t.BlazeFaceModel=l,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -17,3 +17,12 @@ /** | ||
*/ | ||
import * as tf from '@tensorflow/tfjs-core'; | ||
import { BlazeFaceModel } from './face'; | ||
interface BlazeFaceConfig { | ||
maxFaces?: number; | ||
inputWidth?: number; | ||
inputHeight?: number; | ||
iouThreshold?: number; | ||
scoreThreshold?: number; | ||
modelUrl?: string | tf.io.IOHandler; | ||
} | ||
/** | ||
@@ -31,9 +40,3 @@ * Load blazeface. | ||
*/ | ||
export declare function load({ maxFaces, inputWidth, inputHeight, iouThreshold, scoreThreshold }?: { | ||
maxFaces?: number; | ||
inputWidth?: number; | ||
inputHeight?: number; | ||
iouThreshold?: number; | ||
scoreThreshold?: number; | ||
}): Promise<BlazeFaceModel>; | ||
export declare function load({ maxFaces, inputWidth, inputHeight, iouThreshold, scoreThreshold, modelUrl, }?: BlazeFaceConfig): Promise<BlazeFaceModel>; | ||
export { NormalizedFace, BlazeFaceModel, BlazeFacePrediction } from './face'; |
@@ -70,3 +70,3 @@ "use strict"; | ||
function load(_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.maxFaces, maxFaces = _c === void 0 ? 10 : _c, _d = _b.inputWidth, inputWidth = _d === void 0 ? 128 : _d, _e = _b.inputHeight, inputHeight = _e === void 0 ? 128 : _e, _f = _b.iouThreshold, iouThreshold = _f === void 0 ? 0.3 : _f, _g = _b.scoreThreshold, scoreThreshold = _g === void 0 ? 0.75 : _g; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.maxFaces, maxFaces = _c === void 0 ? 10 : _c, _d = _b.inputWidth, inputWidth = _d === void 0 ? 128 : _d, _e = _b.inputHeight, inputHeight = _e === void 0 ? 128 : _e, _f = _b.iouThreshold, iouThreshold = _f === void 0 ? 0.3 : _f, _g = _b.scoreThreshold, scoreThreshold = _g === void 0 ? 0.75 : _g, modelUrl = _b.modelUrl; | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -76,5 +76,15 @@ var blazeface, model; | ||
switch (_h.label) { | ||
case 0: return [4 /*yield*/, tfconv.loadGraphModel(BLAZEFACE_MODEL_URL, { fromTFHub: true })]; | ||
case 0: | ||
if (!(modelUrl != null)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, tfconv.loadGraphModel(modelUrl)]; | ||
case 1: | ||
blazeface = _h.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, tfconv.loadGraphModel(BLAZEFACE_MODEL_URL, { | ||
fromTFHub: true, | ||
})]; | ||
case 3: | ||
blazeface = _h.sent(); | ||
_h.label = 4; | ||
case 4: | ||
model = new face_1.BlazeFaceModel(blazeface, inputWidth, inputHeight, maxFaces, iouThreshold, scoreThreshold); | ||
@@ -81,0 +91,0 @@ return [2 /*return*/, model]; |
/** @license See the LICENSE file. */ | ||
declare const version = "0.0.6"; | ||
declare const version = "0.0.7"; | ||
export { version }; |
@@ -5,4 +5,4 @@ "use strict"; | ||
// This code is auto-generated, do not modify this file! | ||
var version = '0.0.6'; | ||
var version = '0.0.7'; | ||
exports.version = version; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@tensorflow-models/blazeface", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Pretrained face detection model in TensorFlow.js", | ||
@@ -16,9 +16,9 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"@tensorflow/tfjs-converter": "^2.8.0", | ||
"@tensorflow/tfjs-core": "^2.8.0" | ||
"@tensorflow/tfjs-converter": "^3.1.0", | ||
"@tensorflow/tfjs-core": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@tensorflow/tfjs-backend-cpu": "^2.8.2", | ||
"@tensorflow/tfjs-converter": "^2.8.0", | ||
"@tensorflow/tfjs-core": "^2.8.0", | ||
"@tensorflow/tfjs-backend-cpu": "^3.1.0", | ||
"@tensorflow/tfjs-converter": "^3.1.0", | ||
"@tensorflow/tfjs-core": "^3.1.0", | ||
"@types/jasmine": "~2.5.53", | ||
@@ -25,0 +25,0 @@ "jasmine": "~3.2.0", |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
827586
2220
0