idmission-web-sdk 1.0.194 → 1.0.195
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk2.cjs.development.js +15 -31
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +15 -31
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +15 -31
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
48
48
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
49
49
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
50
50
|
|
|
51
|
-
var webSdkVersion = '1.0.
|
|
51
|
+
var webSdkVersion = '1.0.195';
|
|
52
52
|
|
|
53
53
|
function getPlatform() {
|
|
54
54
|
if (typeof window === 'undefined') return;
|
|
@@ -1910,33 +1910,30 @@ var CameraProvider = function CameraProvider(_a) {
|
|
|
1910
1910
|
var documentDetectionModel;
|
|
1911
1911
|
function loadDocumentDetectionModel(url) {
|
|
1912
1912
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1913
|
-
var zeroes, tfInt32, tf4d_, tf4d,
|
|
1914
|
-
return tslib.__generator(this, function (
|
|
1915
|
-
switch (
|
|
1913
|
+
var zeroes, tfInt32, tf4d_, tf4d, outputKeys;
|
|
1914
|
+
return tslib.__generator(this, function (_a) {
|
|
1915
|
+
switch (_a.label) {
|
|
1916
1916
|
case 0:
|
|
1917
1917
|
if (documentDetectionModel) return [2 /*return*/, documentDetectionModel];
|
|
1918
1918
|
return [4 /*yield*/, tf__namespace.loadGraphModel(url)];
|
|
1919
1919
|
case 1:
|
|
1920
|
-
documentDetectionModel =
|
|
1920
|
+
documentDetectionModel = _a.sent();
|
|
1921
1921
|
return [4 /*yield*/, tf__namespace.ready()];
|
|
1922
1922
|
case 2:
|
|
1923
|
-
|
|
1924
|
-
|
|
1923
|
+
_a.sent();
|
|
1924
|
+
_a.label = 3;
|
|
1925
1925
|
case 3:
|
|
1926
|
-
|
|
1926
|
+
_a.trys.push([3,, 5, 6]);
|
|
1927
1927
|
tf__namespace.engine().startScope();
|
|
1928
1928
|
zeroes = tf__namespace.zeros([448, 448, 3]);
|
|
1929
1929
|
tfInt32 = tf__namespace.cast(zeroes, 'int32');
|
|
1930
1930
|
tf4d_ = tf__namespace.tensor4d(Array.from(tfInt32.dataSync()), [1, 448, 448, 3]);
|
|
1931
1931
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
1932
|
-
|
|
1933
|
-
|
|
1932
|
+
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)
|
|
1933
|
+
// interrogate the model to determine the output positions
|
|
1934
|
+
];
|
|
1934
1935
|
case 4:
|
|
1935
|
-
|
|
1936
|
-
tfInt32.dispose();
|
|
1937
|
-
tf4d.dispose();
|
|
1938
|
-
tf4d_.dispose();
|
|
1939
|
-
tf__namespace.dispose(zeroes);
|
|
1936
|
+
_a.sent();
|
|
1940
1937
|
outputKeys = documentDetectionModel.outputs.map(function (o) {
|
|
1941
1938
|
return o.name;
|
|
1942
1939
|
});
|
|
@@ -2012,10 +2009,6 @@ function loadFocusModel(url) {
|
|
|
2012
2009
|
case 5:
|
|
2013
2010
|
_e.sent();
|
|
2014
2011
|
tf__namespace.dispose(warmupResult);
|
|
2015
|
-
tfInt32.dispose();
|
|
2016
|
-
tf4d.dispose();
|
|
2017
|
-
tf4d_.dispose();
|
|
2018
|
-
tf__namespace.dispose(zeroes);
|
|
2019
2012
|
return [3 /*break*/, 7];
|
|
2020
2013
|
case 6:
|
|
2021
2014
|
tf__namespace.engine().endScope();
|
|
@@ -9044,30 +9037,26 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9044
9037
|
_e.label = 1;
|
|
9045
9038
|
case 1:
|
|
9046
9039
|
_e.trys.push([1, 7, 8, 9]);
|
|
9040
|
+
console.log(' Tensors before:', tf__namespace.memory().numTensors);
|
|
9047
9041
|
tf__namespace.engine().startScope();
|
|
9048
9042
|
tfImg = tf__namespace.browser.fromPixels(image);
|
|
9049
9043
|
if (logPredictions) console.time('resize');
|
|
9050
9044
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]);
|
|
9051
9045
|
if (logPredictions) console.timeEnd('resize');
|
|
9052
|
-
tfImg.dispose();
|
|
9053
9046
|
if (logPredictions) console.time('convert to int32');
|
|
9054
9047
|
tfInt32 = tf__namespace.cast(tfResize, 'int32');
|
|
9055
|
-
tfResize.dispose();
|
|
9056
9048
|
_b = (_a = tf__namespace).tensor4d;
|
|
9057
9049
|
_d = (_c = Array).from;
|
|
9058
9050
|
return [4 /*yield*/, tfInt32.data()];
|
|
9059
9051
|
case 2:
|
|
9060
9052
|
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
9061
|
-
tfInt32.dispose();
|
|
9062
9053
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
9063
9054
|
if (logPredictions) console.timeEnd('convert to int32');
|
|
9064
|
-
tf4d_.dispose();
|
|
9065
9055
|
if (logPredictions) console.time('predictions');
|
|
9066
9056
|
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)];
|
|
9067
9057
|
case 3:
|
|
9068
9058
|
result = _e.sent();
|
|
9069
9059
|
if (logPredictions) console.timeEnd('predictions');
|
|
9070
|
-
tf4d.dispose();
|
|
9071
9060
|
predictions = result;
|
|
9072
9061
|
if (logPredictions) {
|
|
9073
9062
|
console.log('predictions made!', predictions.map(function (r) {
|
|
@@ -9086,7 +9075,6 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9086
9075
|
labels = labels.map(function (l) {
|
|
9087
9076
|
return Math.round(l);
|
|
9088
9077
|
});
|
|
9089
|
-
tf__namespace.dispose(result);
|
|
9090
9078
|
time = new Date().getTime() - startedAt.getTime();
|
|
9091
9079
|
return [2 /*return*/, {
|
|
9092
9080
|
boxes: boxes,
|
|
@@ -9105,6 +9093,8 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9105
9093
|
}];
|
|
9106
9094
|
case 8:
|
|
9107
9095
|
tf__namespace.engine().endScope();
|
|
9096
|
+
// tf.engine().disposeVariables()
|
|
9097
|
+
console.log('Tensors afters:', tf__namespace.memory().numTensors);
|
|
9108
9098
|
return [7 /*endfinally*/];
|
|
9109
9099
|
case 9:
|
|
9110
9100
|
return [2 /*return*/];
|
|
@@ -9152,27 +9142,21 @@ function makeFocusPrediction(imageData, canvases, bbox, logPredictions) {
|
|
|
9152
9142
|
tfImg = tf__namespace.browser.fromPixels(imageData);
|
|
9153
9143
|
}
|
|
9154
9144
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]).div(tf__namespace.scalar(127.5)).sub(tf__namespace.scalar(1));
|
|
9155
|
-
tfImg.dispose();
|
|
9156
9145
|
tfInt32 = tf__namespace.cast(tfResize, 'float32');
|
|
9157
|
-
tfResize.dispose();
|
|
9158
9146
|
_d = (_c = tf__namespace).tensor4d;
|
|
9159
9147
|
_f = (_e = Array).from;
|
|
9160
9148
|
return [4 /*yield*/, tfInt32.data()];
|
|
9161
9149
|
case 2:
|
|
9162
9150
|
tf4d_ = _d.apply(_c, [_f.apply(_e, [_g.sent()]), [1, 448, 448, 3]]);
|
|
9163
|
-
tfInt32.dispose();
|
|
9164
9151
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
9165
|
-
tf4d_.dispose();
|
|
9166
9152
|
if (logPredictions) console.time('focus prediction');
|
|
9167
9153
|
return [4 /*yield*/, focusModel.predict(tf4d)];
|
|
9168
9154
|
case 3:
|
|
9169
9155
|
predictions = _g.sent();
|
|
9170
|
-
tf4d.dispose();
|
|
9171
9156
|
return [4 /*yield*/, predictions.array()];
|
|
9172
9157
|
case 4:
|
|
9173
9158
|
focusPrediction = _g.sent()[0];
|
|
9174
9159
|
if (logPredictions) console.timeEnd('focus prediction');
|
|
9175
|
-
tf__namespace.dispose(predictions);
|
|
9176
9160
|
predictionTime = new Date().getTime() - startedAt.getTime();
|
|
9177
9161
|
return [2 /*return*/, [focusPrediction, predictionTime]];
|
|
9178
9162
|
case 5:
|