face-api/dist/face-api.esm-nobundle.js

10 lines
81 KiB
JavaScript
Raw Normal View History

/*
Face-API
homepage: <https://github.com/vladmandic/face-api>
author: <https://github.com/vladmandic>'
*/
2021-03-09 23:32:33 +01:00
var pn=Object.create,Ye=Object.defineProperty,dn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty,ln=Object.getOwnPropertyNames,fn=Object.getOwnPropertyDescriptor;var Dr=o=>Ye(o,"__esModule",{value:!0});var uo=(o,t)=>()=>(t||(t={exports:{}},o(t.exports,t)),t.exports),Er=(o,t)=>{for(var e in t)Ye(o,e,{get:t[e],enumerable:!0})},lt=(o,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ln(t))!un.call(o,r)&&r!=="default"&&Ye(o,r,{get:()=>t[r],enumerable:!(e=fn(t,r))||e.enumerable});return o},hn=o=>lt(Dr(Ye(o!=null?pn(dn(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);import*as Ca from"@tensorflow/tfjs/dist/index.js";import*as Na from"@tensorflow/tfjs-backend-wasm";var b=uo(xn=>{Dr(xn);lt(xn,Ca);lt(xn,Na)});var go=uo((_n,bo)=>{Dr(_n);Er(_n,{isNodejs:()=>wn});function wn(){return typeof global=="object"&&!0&&typeof bo!="undefined"&&typeof process!="undefined"&&!!process.version}});var ya=b();var Po={};Er(Po,{AnchorPosition:()=>pt,DrawBox:()=>Ue,DrawBoxOptions:()=>jr,DrawFaceLandmarks:()=>Zr,DrawFaceLandmarksOptions:()=>qr,DrawTextField:()=>Mt,DrawTextFieldOptions:()=>Ce,drawContour:()=>ft,drawDetections:()=>En,drawFaceExpressions:()=>kn,drawFaceLandmarks:()=>Ln});function ft(o,t,e=!1){if(o.beginPath(),t.slice(1).forEach(({x:r,y:n},a)=>{let s=t[a];o.moveTo(s.x,s.y),o.lineTo(r,n)}),e){let r=t[t.length-1],n=t[0];if(!r||!n)return;o.moveTo(r.x,r.y),o.lineTo(n.x,n.y)}o.stroke()}var lo={};Er(lo,{computeReshapedDimensions:()=>Nr,getCenterPoint:()=>$t,isDimensions:()=>ze,isEven:()=>Ge,isFloat:()=>Cr,isTensor:()=>Bt,isTensor1D:()=>bn,isTensor2D:()=>Mr,isTensor3D:()=>ht,isTensor4D:()=>G,isValidNumber:()=>et,isValidProbablitiy:()=>ee,range:()=>it,round:()=>Rt});var fo=b();var S=class{constructor(t,e){if(!et(t)||!et(e))throw new Error(`Dimensions.constructor - expected width and height to be valid numbers, instead have ${JSON.stringify({width:t,height:e})}`);this._width=t,this._height=e}get width(){return this._width}get height(){return this._height}reverse(){return new S(1/this.width,1/this.height)}};function Bt(o,t){return o instanceof fo.Tensor&&o.shape.length===t}function bn(o){return Bt(o,1)}function Mr(o){return Bt(o,2)}function ht(o){return Bt(o,3)}function G(o){return Bt(o,4)}function Cr(o){return o%1!=0}function Ge(o){return o%2==0}function Rt(o,t=2){let e=10**t;return Math.floor(o*e)/e}function ze(o){return o&&o.width&&o.height}function Nr({width:o,height:t},e){let r=e/Math.max(t,o);return new S(Math.round(o*r),Math.round(t*r))}function $t(o){return o.reduce((t,e)=>t.add(e),new x(0,0)).div(new x(o.length,o.length))}function it(o,t,e){return Array(o).fill(0).map((r,n)=>t+n*e)}function et(o){return!!o&&o!==Infinity&&o!==-Infinity&&!Number.isNaN(o)||o===0}function ee(o){return et(o)&&o>=0&&o<=1}var x=class{constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}add(t){return new x(this.x+t.x,this.y+t.y)}sub(t){return new x(this.x-t.x,this.y-t.y)}mul(t){return new x(this.x*t.x,this.y*t.y)}div(t){return new x(this.x/t.x,this.y/t.y)}abs(){return new x(Math.abs(this.x),Math.abs(this.y))}magnitude(){return Math.sqrt(this.x**2+this.y**2)}floor(){return new x(Math.floor(this.x),Math.floor(this.y))}};var P=class{static isRect(t){return!!t&&[t.x,t.y,t.width,t.height].every(et)}static assertIsValidBox(t,e,r=!1){if(!P.isRect(t))throw new Error(`${e} - invalid box: ${JSON.stringify(t)}, expected object with properties x, y, width, height`);if(!r&&(t.width<0||t.height<0))throw new Error(`${e} - width (${t.width}) and height (${t.height}) must be positive numbers`)}constructor(t,e=!0){let r=t||{},n=[r.left,r.top,r.right,r.bottom].every(et),a=[r.x,r.y,r.width,r.height].every(et);if(!a&&!n)throw new Error(`Box.constructor - expected box to be IBoundingBox | IRect, instead have ${JSON.stringify(r)}`);let[s,i,c,m]=a?[r.x,r.y,r.width,r.height]:[r.left,r.top,r.right-r.left,r.bottom-r.top];P.assertIsValidBox({x:s,y:i,width:c,height:m},"Box.constructor",e),this._x=s,this._y=i,this._width=c,this._height=m}get x(){return this._x}get y(){return
//# sourceMappingURL=face-api.esm-nobundle.js.map