diff --git a/README.md b/README.md index 715f3722..36afe21b 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,13 @@ There are multiple ways to use `Human` library, pick one that suits you: ### Included -- `dist/human.js`: IIFE format minified bundle with TFJS for Browsers -- `dist/human.esm.js`: ESM format minified bundle with TFJS for Browsers -- `dist/human.esm-nobundle.js`: ESM format non-minified bundle without TFJS for Browsers -- `dist/human.cjs`: CommonJS format non-minified bundle without TFJS for NodeJS +- `dist/human.js`: IIFE format bundle with TFJS for Browsers +- `dist/human.esm.js`: ESM format bundle with TFJS for Browsers +- `dist/human.esm-nobundle.js`: ESM format bundle without TFJS for Browsers +- `dist/human.cjs`: CommonJS format bundle without TFJS for NodeJS -All versions include `sourcemap` and build `manifest` +All versions include `sourcemap` and build `manifest` +While `Human` is in pre-release mode, all bundles are non-minified Defaults: ```json @@ -433,9 +434,9 @@ Development dependencies are [eslint](https://github.com/eslint) used for code l Performance will vary depending on your hardware, but also on number of resolution of input video/image, enabled modules as well as their parameters -For example, on a desktop with a low-end nVidia GTX1050 it can perform multiple face detections at 60+ FPS, but drops to ~15 FPS on a medium complex images if all modules are enabled +For example, it can perform multiple face detections at 60+ FPS, but drops to ~15 FPS on a medium complex images if all modules are enabled -Performance per module: +Performance per module on a **notebook** with nVidia GTX1050 GPU: - Enabled all: 15 FPS - Image filters: 80 FPS (standalone) @@ -448,6 +449,19 @@ Performance per module: - Hand: 40 FPS (standalone) - Body: 50 FPS (standalone) +Performance per module on a **smartphone** with Snapdragon 855: + +- Enabled all: 3 FPS +- Image filters: 30 FPS (standalone) +- Face Detect: 20 FPS (standalone) +- Face Geometry: 10 FPS (includes face detect) +- Face Iris: 5 FPS (includes face detect and face geometry) +- Age: 20 FPS (includes face detect) +- Gender: 20 FPS (includes face detect) +- Emotion: 20 FPS (includes face detect) +- Hand: 40 FPS (standalone) +- Body: 10 FPS (standalone) + For performance details, see output of `result.performance` object during runtime
1?ah(r,[1,a]):r}):i.cell.stateSize>1?[ah(r,[1,i.cell.stateSize])]:[r]})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),t.prototype.setFastWeightInitDuringBuild=function(e){n.prototype.setFastWeightInitDuringBuild.call(this,e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)},t.prototype.getConfig=function(){var e=n.prototype.getConfig.call(this),i={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(i.numConstants=this.numConstants);var r=this.cell.getConfig();return this.getClassName()===t.className&&(i.cell={className:this.cell.getClassName(),config:r}),qt({},r,e,i)},t.fromConfig=function(e,i,r){r===void 0&&(r={});var a=i.cell,s=mn(a,r);return new e(Object.assign(i,{cell:s}))},t.className="RNN",t}(De);y.serialization.registerClass(vi);var Hr=function(n){Q(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(De),zh=function(n){Q(t,n);function t(e){var i=n.call(this,e)||this;return i.DEFAULT_ACTIVATION="tanh",i.DEFAULT_KERNEL_INITIALIZER="glorotNormal",i.DEFAULT_RECURRENT_INITIALIZER="orthogonal",i.DEFAULT_BIAS_INITIALIZER="zeros",i.units=e.units,At(i.units,"units"),i.activation=gi(e.activation==null?i.DEFAULT_ACTIVATION:e.activation),i.useBias=e.useBias==null?!0:e.useBias,i.kernelInitializer=et(e.kernelInitializer||i.DEFAULT_KERNEL_INITIALIZER),i.recurrentInitializer=et(e.recurrentInitializer||i.DEFAULT_RECURRENT_INITIALIZER),i.biasInitializer=et(e.biasInitializer||i.DEFAULT_BIAS_INITIALIZER),i.kernelRegularizer=tt(e.kernelRegularizer),i.recurrentRegularizer=tt(e.recurrentRegularizer),i.biasRegularizer=tt(e.biasRegularizer),i.kernelConstraint=bt(e.kernelConstraint),i.recurrentConstraint=bt(e.recurrentConstraint),i.biasConstraint=bt(e.biasConstraint),i.dropout=Br([1,di([0,e.dropout==null?0:e.dropout])]),i.recurrentDropout=Br([1,di([0,e.recurrentDropout==null?0:e.recurrentDropout])]),i.stateSize=i.units,i.dropoutMask=null,i.recurrentDropoutMask=null,i}return t.prototype.build=function(e){e=Ge(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},t.prototype.call=function(e,i){var r=this;return y.tidy(function(){if(e=e,e.length!==2)throw new M("SimpleRNNCell expects 2 input Tensors, got "+e.length+".");var a=e[1];e=e[0];var s=i.training==null?!1:i.training;0 .5?Math.ceil(n):t%2===0?t:t+1}),a_={kernelName:x.Round,backendName:"cpu",kernelFunc:r_};var s_=x.backend_util.SELU_SCALEALPHA,o_=x.backend_util.SELU_SCALE,l_=Ke(x.Selu,function(n){return n>=0?o_*n:s_*(Math.exp(n)-1)}),u_={kernelName:x.Selu,backendName:"cpu",kernelFunc:l_};var c_=Ke(x.Sigmoid,function(n){return 1/(1+Math.exp(-n))}),h_={kernelName:x.Sigmoid,backendName:"cpu",kernelFunc:c_};var d_=Ke(x.Sign,function(n){return n<0?-1:n>0?1:0}),p_={kernelName:x.Sign,backendName:"cpu",kernelFunc:d_};var f_=Ke(x.Sin,function(n){return Math.sin(n)}),m_={kernelName:x.Sin,backendName:"cpu",kernelFunc:f_};var g_=Ke(x.Sinh,function(n){return Math.sinh(n)}),v_={kernelName:x.Sinh,backendName:"cpu",kernelFunc:g_};var y_=11920928955078125e-23,u0=Math.log(y_)+2,b_=Ke(x.Softplus,function(n){var t=n>-u0,e=ni){s=r-i;for(var o=[],l=0;l0){var d=void 0;i>r?d=i+r-3:d=i-1;for(var p=[],l=d;l1?l-1:l,a&&r>1?u-1:u],f=[a&&i>1?i-1:i,a&&r>1?r-1:r],m=p[0]/f[0],g=p[1]/f[1],v=0,b=0;b=h)continue;var X=C+Z*e.strides[1],ee=Z*v,ne=Math.min(o-1,r?Math.round(ee):Math.floor(ee));if(E!==ne)continue;for(var ie=0;ieo&&(o=u)}r[a]=o}return r}var Qw=ar(function(n,t){return n*t}),TB=gd(function(n,t,e,i){return{real:n*e-t*i,imag:n*i+t*e}}),e0=Yr(x.Multiply,Qw,TB),NB={kernelName:x.Multiply,backendName:"cpu",kernelFunc:e0};var t0=Kr(function(n){return 1/Math.sqrt(n)}),xB=jr(x.Rsqrt,t0),CB={kernelName:x.Rsqrt,backendName:"cpu",kernelFunc:xB};function n0(n,t,e,i,r){var a=x.slice_util.isSliceContinous(i,t,e),s=x.util.sizeFromShape(e),o=x.util.computeStrides(i);if(a){var l=x.slice_util.computeFlatOffset(t,o);return n.subarray(l,l+s)}for(var u=x.util.getTypedArrayFromDType(r,s),c=0;cj?j=ie:a==="avg"&&(q+=ie,G++)}if(isNaN(j))break}var te=F+_*S+I;g[te]=a==="avg"?q/G:j}return m}function s0(n,t,e,i,r,a){r===void 0&&(r=!1),a===void 0&&(a=!1);for(var s=x.buffer(i.outShape,"int32"),o=i.strideHeight,l=i.strideWidth,u=i.dilationHeight,c=i.dilationWidth,h=i.effectiveFilterHeight,d=i.effectiveFilterWidth,p=i.padInfo.top,f=i.padInfo.left,m=x.buffer(t,e,n),g=0;gie&&(ie=ke)}}}var _e=x.util.locToIndex([q,G,X,ne],K,x.util.computeStrides(H));j[_e]=ie}var Pe=h.write(x.util.toTypedArray(j,a.dtype),H,a.dtype);return{dataId:Pe,shape:H,dtype:a.dtype}}};var lz={kernelName:x.Dilation2DBackpropFilter,backendName:"cpu",kernelFunc:function(n){var t=n.inputs,e=n.backend,i=n.attrs,r=t,a=r.x,s=r.filter,o=r.dy,l=i,u=l.strides,c=l.pad,h=l.dilations,d=e,p=x.util.toNestedArray(a.shape,d.data.get(a.dataId).values),f=x.util.toNestedArray(s.shape,d.data.get(s.dataId).values),m=x.backend_util.computeDilation2DInfo(a.shape,s.shape,u,c,"NHWC",h),g=m.batchSize,v=m.inHeight,b=m.inWidth,S=m.inChannels,L=m.outHeight,w=m.outWidth,N=m.padInfo,I=m.strideHeight,C=m.strideWidth,E=m.filterHeight,k=m.filterWidth,W=m.dilationHeight,F=m.dilationWidth,_=m.outShape;x.util.assert(o.rank===_.length,function(){return"Error in "+x.Dilation2DBackpropFilter+", dy "+("must have the same rank as output "+_.length+", but got ")+(""+o.rank)});for(var H=x.util.toNestedArray(_,d.data.get(o.dataId).values),P=x.util.makeZerosNestedTypedArray(s.shape,s.dtype),K=0;K