3 lines
83 KiB
JavaScript
3 lines
83 KiB
JavaScript
![]() |
var fe=Object.defineProperty,pn=Object.prototype.hasOwnProperty,fn=(t,e)=>()=>(e||(e={exports:{}},t(e.exports,e)),e.exports),jr=t=>fe(t,"__esModule",{value:!0}),He=(t,e)=>{jr(t);for(var r in e)fe(t,r,{get:e[r],enumerable:!0})},ln=(t,e)=>{if(jr(t),typeof e=="object"||typeof e=="function")for(let r in e)!pn.call(t,r)&&r!=="default"&&fe(t,r,{get:()=>e[r],enumerable:!0});return t},un=t=>t&&t.__esModule?t:ln(fe({},"default",{value:t,enumerable:!0}),t);var Hr=fn((dn,$r)=>{He(dn,{isNodejs:()=>hn});function hn(){return typeof global=="object"&&!0&&typeof $r!="undefined"&&typeof process!="undefined"&&!!process.version}});function Z(t,e,r=!1){if(t.beginPath(),e.slice(1).forEach(({x:o,y:n},a)=>{const i=e[a];t.moveTo(i.x,i.y),t.lineTo(o,n)}),r){const o=e[e.length-1],n=e[0];if(!o||!n)return;t.moveTo(o.x,o.y),t.lineTo(n.x,n.y)}t.stroke()}class S{constructor(t,e){if(!H(t)||!H(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)}}const Ge={};He(Ge,{computeReshapedDimensions:()=>Ve,getCenterPoint:()=>ut,isDimensions:()=>ue,isEven:()=>le,isFloat:()=>Ye,isTensor:()=>ft,isTensor1D:()=>bn,isTensor2D:()=>ze,isTensor3D:()=>K,isTensor4D:()=>W,isValidNumber:()=>H,isValidProbablitiy:()=>Mt,range:()=>X,round:()=>lt});import{Tensor as gn}from"@tensorflow/tfjs/dist/tf.es2017.js";function ft(t,e){return t instanceof gn&&t.shape.length===e}function bn(t){return ft(t,1)}function ze(t){return ft(t,2)}function K(t){return ft(t,3)}function W(t){return ft(t,4)}function Ye(t){return t%1!==0}function le(t){return t%2===0}function lt(t,e=2){const r=Math.pow(10,e);return Math.floor(t*r)/r}function ue(t){return t&&t.width&&t.height}function Ve({width:t,height:e},r){const o=r/Math.max(e,t);return new S(Math.round(t*o),Math.round(e*o))}function ut(t){return t.reduce((e,r)=>e.add(r),new g(0,0)).div(new g(t.length,t.length))}function X(t,e,r){return Array(t).fill(0).map((o,n)=>e+n*r)}function H(t){return!!t&&t!==Infinity&&t!==-Infinity&&!isNaN(t)||t===0}function Mt(t){return H(t)&&0<=t&&t<=1}class g{constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}add(t){return new g(this.x+t.x,this.y+t.y)}sub(t){return new g(this.x-t.x,this.y-t.y)}mul(t){return new g(this.x*t.x,this.y*t.y)}div(t){return new g(this.x/t.x,this.y/t.y)}abs(){return new g(Math.abs(this.x),Math.abs(this.y))}magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}floor(){return new g(Math.floor(this.x),Math.floor(this.y))}}class F{static isRect(t){return!!t&&[t.x,t.y,t.width,t.height].every(H)}static assertIsValidBox(t,e,r=!1){if(!F.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){const r=t||{},o=[r.left,r.top,r.right,r.bottom].every(H),n=[r.x,r.y,r.width,r.height].every(H);if(!n&&!o)throw new Error(`Box.constructor - expected box to be IBoundingBox | IRect, instead have ${JSON.stringify(r)}`);const[a,i,s,c]=n?[r.x,r.y,r.width,r.height]:[r.left,r.top,r.right-r.left,r.bottom-r.top];F.assertIsValidBox({x:a,y:i,width:s,height:c},"Box.constructor",e),this._x=a,this._y=i,this._width=s,this._height=c}get x(){return this._x}get y(){return this._y}get width(){return this._width}get height(){return this._height}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new g(this.left,this.top)}get topRight(){return new g(this.right,this.top)}get bottomLeft(){return new g(this.left,this.bottom)}get bottomRight(){return new g(this.right,this.bottom)}round(){const[t,e,r,o]=[this.x,this.y,this.width,this.height].map(n=>Math.round(n));return new F({x:t,y:e,width:r,height:o})}floor(){const[t,e,r,o]=
|
||
|
//# sourceMappingURL=face-api.nobundle.js.map
|