minor refactor
This commit is contained in:
parent
af5f1dabbc
commit
a4a12d1382
|
@ -20,9 +20,10 @@ class SceneDetectionService {
|
||||||
|
|
||||||
async run(file: File) {
|
async run(file: File) {
|
||||||
const bmp = await createImageBitmap(file);
|
const bmp = await createImageBitmap(file);
|
||||||
tf.ready().then(async () => {
|
|
||||||
const currTime = new Date().getTime();
|
|
||||||
|
|
||||||
|
await tf.ready();
|
||||||
|
|
||||||
|
const currTime = new Date().getTime();
|
||||||
const output = tf.tidy(() => {
|
const output = tf.tidy(() => {
|
||||||
let tensor = tf.browser.fromPixels(bmp);
|
let tensor = tf.browser.fromPixels(bmp);
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ class SceneDetectionService {
|
||||||
const data = await (output as tf.Tensor).data();
|
const data = await (output as tf.Tensor).data();
|
||||||
const scenes = this.getScenes(data as Float32Array);
|
const scenes = this.getScenes(data as Float32Array);
|
||||||
console.log('scenes', scenes);
|
console.log('scenes', scenes);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getScenes(outputData: Float32Array) {
|
getScenes(outputData: Float32Array) {
|
||||||
|
|
Loading…
Reference in a new issue