diff --git a/.gitignore b/.gitignore index 8dc6f00..80e5be4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules .DS_Store -dist diff --git a/dist/numero.js b/dist/numero.js new file mode 100644 index 0000000..3cd81f1 --- /dev/null +++ b/dist/numero.js @@ -0,0 +1,2 @@ +/*! For license information please see numero.js.LICENSE.txt */ +var num;(()=>{var e={328:(e,t)=>{"use strict";function n(e){return new Uint8Array(atob(e).split("").map((function(e){return e.charCodeAt(0)})))}Object.defineProperty(t,"__esModule",{value:!0}),t.stringToUint8array=n,t.stringToArray=function(e){var t=n(e);return new Int16Array(t.buffer)};var r=!1,i=0;function a(){if(r)return r=!1,i;var e=2*Math.random()-1,t=2*Math.random()-1,n=e*e+t*t;if(0===n||n>1)return a();var o=Math.sqrt(-2*Math.log(n)/n);return i=t*o,r=!0,e*o}function o(e,t){return Math.random()*(t-e)+e}function s(e,t){return e+a()*t}function u(e,t){void 0===t&&(t=2);var n=t;function r(e,t){return[e[0]-t[0],e[1]-t[1]]}function i(e,t){return e[0]*t[0]+e[1]*t[1]}function a(e){return e[0]*e[0]+e[1]*e[1]}function o(e,t){return a(r(e,t))}var s,u,c,l,f=e.length,p=[],h=n*n,d=[],m=[];for(d[0]=e[0],s=u=1,l=0;sg&&(c[d]=1,e(t,n,s,d,c),e(t,n,d,u,c))}}(n,d,0,u-1,m),s=c=0;s=n)return t;return console.log("error sampling pi index"),-1},t.simplifyLine=u,t.simplifyLines=function(e,t){var n=[],r=2;t&&(r=t);for(var i=0;i1)for(u=0;u1)for(p=0;p{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2099);t.tf=r,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(5656))},5656:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3850);t.SketchRNN=r.SketchRNN},3850:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(o,s)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]e.data()))),r.map((e=>e.dispose())),e.dispose()}async infer(e,t,r){const i=n.tidy((()=>(e instanceof n.Tensor||(e=n.browser.fromPixels(e)),n.expandDims(e)))),a=i.shape[1],o=i.shape[2],s=await this.model.executeAsync(i),u=s[0].dataSync(),c=s[1].dataSync();i.dispose(),n.dispose(s);const[l,f]=this.calculateMaxScores(u,s[0].shape[1],s[0].shape[2]),p=n.getBackend();"webgl"===n.getBackend()&&n.setBackend("cpu");const h=n.tidy((()=>{const e=n.tensor2d(c,[s[1].shape[1],s[1].shape[3]]);return n.image.nonMaxSuppression(e,l,t,r,r)})),d=h.dataSync();return h.dispose(),p!==n.getBackend()&&n.setBackend(p),this.buildDetectedObjects(o,a,c,l,d,f)}buildDetectedObjects(e,t,n,i,a,o){const s=a.length,u=[];for(let c=0;ct&&(t=e[a*n+r],o=r);r[a]=t,i[a]=o}return[r,i]}async detect(e,t=20,n=.5){return this.infer(e,t,n)}dispose(){null!=this.model&&this.model.dispose()}}e.ObjectDetection=i,e.load=async function(e={}){if(null==n)throw new Error("Cannot find TensorFlow.js. If you are using a