mirror of https://github.com/vladmandic/human
updated model defaults
parent
2161a7df3a
commit
10f4b300f9
Binary file not shown.
After Width: | Height: | Size: 425 KiB |
Binary file not shown.
After Width: | Height: | Size: 394 KiB |
|
@ -76,10 +76,10 @@ export default {
|
||||||
// e.g., if model is running st 25 FPS, we can re-use existing bounding
|
// e.g., if model is running st 25 FPS, we can re-use existing bounding
|
||||||
// box for updated face analysis as the head probably hasn't moved much
|
// box for updated face analysis as the head probably hasn't moved much
|
||||||
// in short time (10 * 1/25 = 0.25 sec)
|
// in short time (10 * 1/25 = 0.25 sec)
|
||||||
minConfidence: 0.5, // threshold for discarding a prediction
|
minConfidence: 0.2, // threshold for discarding a prediction
|
||||||
iouThreshold: 0.2, // threshold for deciding whether boxes overlap too much in
|
iouThreshold: 0.2, // threshold for deciding whether boxes overlap too much in
|
||||||
// non-maximum suppression (0.1 means drop if overlap 10%)
|
// non-maximum suppression (0.1 means drop if overlap 10%)
|
||||||
scoreThreshold: 0.5, // threshold for deciding when to remove boxes based on score
|
scoreThreshold: 0.2, // threshold for deciding when to remove boxes based on score
|
||||||
// in non-maximum suppression,
|
// in non-maximum suppression,
|
||||||
// this is applied on detection objects only and before minConfidence
|
// this is applied on detection objects only and before minConfidence
|
||||||
},
|
},
|
||||||
|
@ -108,8 +108,8 @@ export default {
|
||||||
|
|
||||||
gender: {
|
gender: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
minConfidence: 0.1, // threshold for discarding a prediction
|
minConfidence: 0.4, // threshold for discarding a prediction
|
||||||
modelPath: '../models/gender-ssrnet-imdb.json', // can be 'gender', 'gender-ssrnet-imdb' or 'gender-ssrnet-wiki'
|
modelPath: '../models/gender.json', // can be 'gender', 'gender-ssrnet-imdb' or 'gender-ssrnet-wiki'
|
||||||
inputSize: 64, // fixed value
|
inputSize: 64, // fixed value
|
||||||
skipFrames: 41, // how many frames to go without re-running the detector
|
skipFrames: 41, // how many frames to go without re-running the detector
|
||||||
// only used for video inputs
|
// only used for video inputs
|
||||||
|
|
|
@ -36,7 +36,7 @@ const ui = {
|
||||||
facing: true,
|
facing: true,
|
||||||
useWorker: false,
|
useWorker: false,
|
||||||
worker: 'worker.js',
|
worker: 'worker.js',
|
||||||
samples: ['../assets/sample6.jpg', '../assets/sample1.jpg', '../assets/sample4.jpg', '../assets/sample5.jpg', '../assets/sample3.jpg', '../assets/sample2.jpg'],
|
samples: ['../assets/sample6.jpg', '../assets/sample1.jpg', '../assets/sample4.jpg', '../assets/sample5.jpg', '../assets/sample3.jpg', '../assets/sample2.jpg', '../assets/sample7.jpg', '../assets/sample8.jpg'],
|
||||||
compare: '../assets/sample-me.jpg',
|
compare: '../assets/sample-me.jpg',
|
||||||
drawBoxes: true,
|
drawBoxes: true,
|
||||||
drawPoints: false,
|
drawPoints: false,
|
||||||
|
@ -395,7 +395,7 @@ async function detectVideo() {
|
||||||
async function detectSampleImages() {
|
async function detectSampleImages() {
|
||||||
document.getElementById('play').style.display = 'none';
|
document.getElementById('play').style.display = 'none';
|
||||||
userConfig.videoOptimized = false;
|
userConfig.videoOptimized = false;
|
||||||
const size = Math.trunc(window.devicePixelRatio * (8 + (4 * ui.columns)));
|
const size = Math.trunc(window.devicePixelRatio * (12 + (4 * ui.columns)));
|
||||||
ui.baseFont = ui.baseFontProto.replace(/{size}/, `${size}px`);
|
ui.baseFont = ui.baseFontProto.replace(/{size}/, `${size}px`);
|
||||||
ui.baseLineHeight = size + 2;
|
ui.baseLineHeight = size + 2;
|
||||||
document.getElementById('canvas').style.display = 'none';
|
document.getElementById('canvas').style.display = 'none';
|
||||||
|
|
10
demo/draw.js
10
demo/draw.js
|
@ -32,7 +32,7 @@ async function drawFace(result, canvas, ui, triangulation) {
|
||||||
}
|
}
|
||||||
// silly hack since fillText does not suport new line
|
// silly hack since fillText does not suport new line
|
||||||
const labels = [];
|
const labels = [];
|
||||||
// labels.push(`${Math.trunc(100 * face.confidence)}% face`);
|
labels.push(`detect confidence: ${Math.trunc(100 * face.confidence)}%`);
|
||||||
if (face.genderConfidence) labels.push(`${face.gender || ''} ${Math.trunc(100 * face.genderConfidence)}% confident`);
|
if (face.genderConfidence) labels.push(`${face.gender || ''} ${Math.trunc(100 * face.genderConfidence)}% confident`);
|
||||||
// if (face.genderConfidence) labels.push(face.gender);
|
// if (face.genderConfidence) labels.push(face.gender);
|
||||||
if (face.age) labels.push(`age: ${face.age || ''}`);
|
if (face.age) labels.push(`age: ${face.age || ''}`);
|
||||||
|
@ -43,11 +43,13 @@ async function drawFace(result, canvas, ui, triangulation) {
|
||||||
}
|
}
|
||||||
if (labels.length === 0) labels.push('face');
|
if (labels.length === 0) labels.push('face');
|
||||||
ctx.fillStyle = ui.baseLabel;
|
ctx.fillStyle = ui.baseLabel;
|
||||||
for (let i = 0; i < labels.length; i++) {
|
for (let i = labels.length - 1; i >= 0; i--) {
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black';
|
||||||
ctx.fillText(labels[i], face.box[0] + 1, face.box[1] - ((labels.length - i) * ui.baseLineHeight) + 6);
|
const x = Math.max(face.box[0], 0);
|
||||||
|
const y = i * ui.baseLineHeight + face.box[1];
|
||||||
|
ctx.fillText(labels[i], x + 5, y + 16);
|
||||||
ctx.fillStyle = ui.baseLabel;
|
ctx.fillStyle = ui.baseLabel;
|
||||||
ctx.fillText(labels[i], face.box[0] + 0, face.box[1] - ((labels.length - i) * ui.baseLineHeight) + 5);
|
ctx.fillText(labels[i], x + 4, y + 15);
|
||||||
}
|
}
|
||||||
ctx.fillStyle = ui.baseColor;
|
ctx.fillStyle = ui.baseColor;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"dist/human.esm.js": {
|
"dist/human.esm.js": {
|
||||||
"bytes": 1347292,
|
"bytes": 1347010,
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"demo/draw.js": {
|
"demo/draw.js": {
|
||||||
"bytes": 10798,
|
"bytes": 10783,
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"demo/menu.js": {
|
"demo/menu.js": {
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"demo/browser.js": {
|
"demo/browser.js": {
|
||||||
"bytes": 26720,
|
"bytes": 26771,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "dist/human.esm.js",
|
"path": "dist/human.esm.js",
|
||||||
|
@ -43,17 +43,17 @@
|
||||||
"imports": [],
|
"imports": [],
|
||||||
"exports": [],
|
"exports": [],
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
"bytes": 2022090
|
"bytes": 2022011
|
||||||
},
|
},
|
||||||
"dist/demo-browser-index.js": {
|
"dist/demo-browser-index.js": {
|
||||||
"imports": [],
|
"imports": [],
|
||||||
"exports": [],
|
"exports": [],
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"dist/human.esm.js": {
|
"dist/human.esm.js": {
|
||||||
"bytesInOutput": 1339816
|
"bytesInOutput": 1339534
|
||||||
},
|
},
|
||||||
"demo/draw.js": {
|
"demo/draw.js": {
|
||||||
"bytesInOutput": 6204
|
"bytesInOutput": 6241
|
||||||
},
|
},
|
||||||
"demo/menu.js": {
|
"demo/menu.js": {
|
||||||
"bytesInOutput": 10696
|
"bytesInOutput": 10696
|
||||||
|
@ -62,10 +62,10 @@
|
||||||
"bytesInOutput": 6759
|
"bytesInOutput": 6759
|
||||||
},
|
},
|
||||||
"demo/browser.js": {
|
"demo/browser.js": {
|
||||||
"bytesInOutput": 17340
|
"bytesInOutput": 17389
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bytes": 1388200
|
"bytes": 1388004
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytes": 2228,
|
"bytes": 2237,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -392,7 +392,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytes": 5869,
|
"bytes": 5872,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -409,7 +409,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytes": 9786,
|
"bytes": 9774,
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytes": 19720,
|
"bytes": 19726,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
"imports": [],
|
"imports": [],
|
||||||
"exports": [],
|
"exports": [],
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
"bytes": 1924855
|
"bytes": 1924674
|
||||||
},
|
},
|
||||||
"dist/human.esm.js": {
|
"dist/human.esm.js": {
|
||||||
"imports": [],
|
"imports": [],
|
||||||
|
@ -520,7 +520,7 @@
|
||||||
"bytesInOutput": 1064610
|
"bytesInOutput": 1064610
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytesInOutput": 1205
|
"bytesInOutput": 1053
|
||||||
},
|
},
|
||||||
"src/blazeface/blazeface.ts": {
|
"src/blazeface/blazeface.ts": {
|
||||||
"bytesInOutput": 2185
|
"bytesInOutput": 2185
|
||||||
|
@ -538,7 +538,7 @@
|
||||||
"bytesInOutput": 5040
|
"bytesInOutput": 5040
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytesInOutput": 10441
|
"bytesInOutput": 10347
|
||||||
},
|
},
|
||||||
"src/faceboxes/faceboxes.ts": {
|
"src/faceboxes/faceboxes.ts": {
|
||||||
"bytesInOutput": 1549
|
"bytesInOutput": 1549
|
||||||
|
@ -610,10 +610,10 @@
|
||||||
"bytesInOutput": 10975
|
"bytesInOutput": 10975
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytesInOutput": 2379
|
"bytesInOutput": 2355
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytesInOutput": 1426
|
"bytesInOutput": 1414
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
"bytesInOutput": 55295
|
"bytesInOutput": 55295
|
||||||
|
@ -622,7 +622,7 @@
|
||||||
"bytesInOutput": 2572
|
"bytesInOutput": 2572
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bytes": 1347292
|
"bytes": 1347010
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytes": 2228,
|
"bytes": 2237,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -392,7 +392,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytes": 5869,
|
"bytes": 5872,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -409,7 +409,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytes": 9786,
|
"bytes": 9774,
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytes": 19720,
|
"bytes": 19726,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
"imports": [],
|
"imports": [],
|
||||||
"exports": [],
|
"exports": [],
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
"bytes": 1924866
|
"bytes": 1924685
|
||||||
},
|
},
|
||||||
"dist/human.ts": {
|
"dist/human.ts": {
|
||||||
"imports": [],
|
"imports": [],
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
"bytesInOutput": 1690
|
"bytesInOutput": 1690
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytesInOutput": 10477
|
"bytesInOutput": 10383
|
||||||
},
|
},
|
||||||
"src/log.ts": {
|
"src/log.ts": {
|
||||||
"bytesInOutput": 252
|
"bytesInOutput": 252
|
||||||
|
@ -521,7 +521,7 @@
|
||||||
"bytesInOutput": 1064610
|
"bytesInOutput": 1064610
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytesInOutput": 1205
|
"bytesInOutput": 1053
|
||||||
},
|
},
|
||||||
"src/blazeface/blazeface.ts": {
|
"src/blazeface/blazeface.ts": {
|
||||||
"bytesInOutput": 2185
|
"bytesInOutput": 2185
|
||||||
|
@ -608,10 +608,10 @@
|
||||||
"bytesInOutput": 10975
|
"bytesInOutput": 10975
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytesInOutput": 2379
|
"bytesInOutput": 2355
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytesInOutput": 1426
|
"bytesInOutput": 1414
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
"bytesInOutput": 55295
|
"bytesInOutput": 55295
|
||||||
|
@ -620,7 +620,7 @@
|
||||||
"bytesInOutput": 2572
|
"bytesInOutput": 2572
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bytes": 1347334
|
"bytes": 1347052
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytes": 2228,
|
"bytes": 2237,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -392,7 +392,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytes": 5869,
|
"bytes": 5872,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -409,7 +409,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytes": 9786,
|
"bytes": 9774,
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
"imports": []
|
"imports": []
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytes": 19720,
|
"bytes": 19726,
|
||||||
"imports": [
|
"imports": [
|
||||||
{
|
{
|
||||||
"path": "src/log.ts",
|
"path": "src/log.ts",
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
"imports": [],
|
"imports": [],
|
||||||
"exports": [],
|
"exports": [],
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
"bytes": 705440
|
"bytes": 705259
|
||||||
},
|
},
|
||||||
"dist/human.node-gpu.js": {
|
"dist/human.node-gpu.js": {
|
||||||
"imports": [],
|
"imports": [],
|
||||||
|
@ -515,13 +515,13 @@
|
||||||
"bytesInOutput": 1677
|
"bytesInOutput": 1677
|
||||||
},
|
},
|
||||||
"src/human.ts": {
|
"src/human.ts": {
|
||||||
"bytesInOutput": 10449
|
"bytesInOutput": 10355
|
||||||
},
|
},
|
||||||
"src/log.ts": {
|
"src/log.ts": {
|
||||||
"bytesInOutput": 251
|
"bytesInOutput": 251
|
||||||
},
|
},
|
||||||
"src/tfjs/backend.ts": {
|
"src/tfjs/backend.ts": {
|
||||||
"bytesInOutput": 1304
|
"bytesInOutput": 1145
|
||||||
},
|
},
|
||||||
"src/blazeface/blazeface.ts": {
|
"src/blazeface/blazeface.ts": {
|
||||||
"bytesInOutput": 2329
|
"bytesInOutput": 2329
|
||||||
|
@ -605,13 +605,13 @@
|
||||||
"bytesInOutput": 2391
|
"bytesInOutput": 2391
|
||||||
},
|
},
|
||||||
"src/image.ts": {
|
"src/image.ts": {
|
||||||
"bytesInOutput": 2362
|
"bytesInOutput": 2339
|
||||||
},
|
},
|
||||||
"src/imagefx.js": {
|
"src/imagefx.js": {
|
||||||
"bytesInOutput": 10973
|
"bytesInOutput": 10973
|
||||||
},
|
},
|
||||||
"config.js": {
|
"config.js": {
|
||||||
"bytesInOutput": 1426
|
"bytesInOutput": 1414
|
||||||
},
|
},
|
||||||
"src/sample.ts": {
|
"src/sample.ts": {
|
||||||
"bytesInOutput": 55295
|
"bytesInOutput": 55295
|
||||||
|
@ -620,7 +620,7 @@
|
||||||
"bytesInOutput": 2569
|
"bytesInOutput": 2569
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bytes": 276845
|
"bytes": 276557
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@ export function cutBoxFromImageAndResize(box, image, cropSize) {
|
||||||
return tf.image.cropAndResize(image, boxes, [0], cropSize);
|
return tf.image.cropAndResize(image, boxes, [0], cropSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function enlargeBox(box, factor = 1.5) {
|
export function enlargeBox(box, factor = 1.6) {
|
||||||
const center = getBoxCenter(box);
|
const center = getBoxCenter(box);
|
||||||
const size = getBoxSize(box);
|
const size = getBoxSize(box);
|
||||||
const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];
|
const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];
|
||||||
|
|
|
@ -219,8 +219,8 @@ class Human {
|
||||||
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
||||||
this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', this.config.deallocate ? 0 : -1);
|
this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', this.config.deallocate ? 0 : -1);
|
||||||
}
|
}
|
||||||
this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
// this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
||||||
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
// this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||||
const gl = await this.tf.backend().getGPGPUContext().gl;
|
const gl = await this.tf.backend().getGPGPUContext().gl;
|
||||||
log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
|
log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ export function process(input, config) {
|
||||||
outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas.width, inCanvas.height) : document.createElement('canvas');
|
outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas.width, inCanvas.height) : document.createElement('canvas');
|
||||||
if (outCanvas.width !== inCanvas.width) outCanvas.width = inCanvas.width;
|
if (outCanvas.width !== inCanvas.width) outCanvas.width = inCanvas.width;
|
||||||
if (outCanvas.height !== inCanvas.height) outCanvas.height = inCanvas.height;
|
if (outCanvas.height !== inCanvas.height) outCanvas.height = inCanvas.height;
|
||||||
log('created FX filter');
|
// log('created FX filter');
|
||||||
fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')
|
fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')
|
||||||
}
|
}
|
||||||
if (!fx) return inCanvas;
|
if (!fx) return inCanvas;
|
||||||
|
|
|
@ -63,9 +63,9 @@ export function register() {
|
||||||
try {
|
try {
|
||||||
tf.ENV.set('WEBGL_VERSION', 2);
|
tf.ENV.set('WEBGL_VERSION', 2);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));
|
// tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));
|
||||||
tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
// tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
||||||
tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
// tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log('error: cannot set WebGL backend flags:', err);
|
log('error: cannot set WebGL backend flags:', err);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue