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

10 lines
128 KiB
JavaScript
Raw Normal View History

/*
Face-API
homepage: <https://github.com/vladmandic/face-api>
author: <https://github.com/vladmandic>'
*/
2020-12-19 17:46:41 +01:00
var __create=Object.create,__defProp=Object.defineProperty,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__markAsModule=target=>__defProp(target,"__esModule",{value:!0}),__commonJS=(callback,module)=>()=>(module||(module={exports:{}},callback(module.exports,module)),module.exports),__export=(target,all)=>{__markAsModule(target);for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__exportStar=(target,module,desc)=>{if(__markAsModule(target),module&&typeof module=="object"||typeof module=="function")for(let key of __getOwnPropNames(module))!__hasOwnProp.call(target,key)&&key!=="default"&&__defProp(target,key,{get:()=>module[key],enumerable:!(desc=__getOwnPropDesc(module,key))||desc.enumerable});return target},__toModule=module=>module&&module.__esModule?module:__exportStar(__defProp(module!=null?__create(__getProtoOf(module)):{},"default",{value:module,enumerable:!0}),module);import*as dist_star from"@tensorflow/tfjs/dist/index.js";import*as tfjs_backend_wasm_star from"@tensorflow/tfjs-backend-wasm";var require_tfjs_esm=__commonJS(exports=>{__exportStar(exports,dist_star);__exportStar(exports,tfjs_backend_wasm_star)}),require_isNodejs=__commonJS((exports,module)=>{__export(exports,{isNodejs:()=>isNodejs3});function isNodejs3(){return typeof global=="object"&&!0&&typeof module!="undefined"&&typeof process!="undefined"&&!!process.version}}),tf42=__toModule(require_tfjs_esm()),draw_exports={};__export(draw_exports,{AnchorPosition:()=>AnchorPosition,DrawBox:()=>DrawBox,DrawBoxOptions:()=>DrawBoxOptions,DrawFaceLandmarks:()=>DrawFaceLandmarks,DrawFaceLandmarksOptions:()=>DrawFaceLandmarksOptions,DrawTextField:()=>DrawTextField,DrawTextFieldOptions:()=>DrawTextFieldOptions,drawContour:()=>drawContour,drawDetections:()=>drawDetections,drawFaceExpressions:()=>drawFaceExpressions,drawFaceLandmarks:()=>drawFaceLandmarks});function drawContour(ctx,points,isClosed=!1){if(ctx.beginPath(),points.slice(1).forEach(({x,y},prevIdx)=>{let from=points[prevIdx];ctx.moveTo(from.x,from.y),ctx.lineTo(x,y)}),isClosed){let from=points[points.length-1],to=points[0];if(!from||!to)return;ctx.moveTo(from.x,from.y),ctx.lineTo(to.x,to.y)}ctx.stroke()}var utils_exports={};__export(utils_exports,{computeReshapedDimensions:()=>computeReshapedDimensions,getCenterPoint:()=>getCenterPoint,isDimensions:()=>isDimensions,isEven:()=>isEven,isFloat:()=>isFloat,isTensor:()=>isTensor,isTensor1D:()=>isTensor1D,isTensor2D:()=>isTensor2D,isTensor3D:()=>isTensor3D,isTensor4D:()=>isTensor4D,isValidNumber:()=>isValidNumber,isValidProbablitiy:()=>isValidProbablitiy,range:()=>range,round:()=>round});var tf=__toModule(require_tfjs_esm()),Dimensions=class{constructor(width,height){if(!isValidNumber(width)||!isValidNumber(height))throw new Error(`Dimensions.constructor - expected width and height to be valid numbers, instead have ${JSON.stringify({width,height})}`);this._width=width,this._height=height}get width(){return this._width}get height(){return this._height}reverse(){return new Dimensions(1/this.width,1/this.height)}};function isTensor(tensor2,dim){return tensor2 instanceof tf.Tensor&&tensor2.shape.length===dim}function isTensor1D(tensor2){return isTensor(tensor2,1)}function isTensor2D(tensor2){return isTensor(tensor2,2)}function isTensor3D(tensor2){return isTensor(tensor2,3)}function isTensor4D(tensor2){return isTensor(tensor2,4)}function isFloat(num){return num%1!==0}function isEven(num){return num%2===0}function round(num,prec=2){let f=Math.pow(10,prec);return Math.floor(num*f)/f}function isDimensions(obj){return obj&&obj.width&&obj.height}function computeReshapedDimensions({width,height},inputSize){let scale2=inputSize/Math.max(height,width);return new Dimensions(Math.round(width*scale2),Math.round(height*scale2))}function getCenterPoint(pts){return pts.reduce((sum,pt)=>sum.add(pt),new Point(0,0)).div(new Point(pts.length,pts.length))}function range(num,start,step){return Array(num).fill(0).map((_,i)=>start+i*step)}fu
//# sourceMappingURL=face-api.esm-nobundle.js.map