diff --git a/js/model.js b/js/model.js index 71a4b1c6..693a75ff 100644 --- a/js/model.js +++ b/js/model.js @@ -54,8 +54,8 @@ function loadModel(params){ myModel.width = width; // Create a mask tensor where the specified indexes are set to 0 and others to 1 - //const indexesToZero = [25, 30, 110, 319, 378, 403, 404, 405, 406]; - const indexesToZero = []; + const indexesToZero = [25, 30, 110, 319, 378, 403, 404, 405, 406]; + myModel.mask = tf.tensor2d(Array.from({ length: 408 }, (_, i) => indexesToZero.includes(i) ? 0 : 1), [1, 408]); myModel.labels = labels; await myModel.loadModel(); diff --git a/js/worker.js b/js/worker.js index 1068736c..b1329feb 100644 --- a/js/worker.js +++ b/js/worker.js @@ -1170,9 +1170,9 @@ const setMetadata = async ({ file, proxy = file, source_file = file }) => { fileStart = new Date(savedMeta.fileStart); fileEnd = new Date(fileStart.getTime() + (METADATA[file].duration * 1000)); } else { - METADATA[file].stat = fs.statSync(source_file); - fileEnd = new Date(METADATA[file].stat.mtime); - fileStart = new Date(METADATA[file].stat.mtime - (METADATA[file].duration * 1000)); + const stat = fs.statSync(source_file); + fileEnd = new Date(stat.mtime); + fileStart = new Date(stat.mtime - (METADATA[file].duration * 1000)); } if (STATE.useGUANO && file.toLowerCase().endsWith('wav')){ const {extractGuanoMetadata} = await import('./guano.js').catch(error => { @@ -1185,7 +1185,7 @@ const setMetadata = async ({ file, proxy = file, source_file = file }) => { if (location){ const [lat, lon] = location.split(' '); const roundedFloat = (string) => Math.round(parseFloat(string) * 10000) / 10000; - onSetCustomLocation({ lat: roundedFloat(lat), lon: roundedFloat(lon), place: location, files: [file] }) + await onSetCustomLocation({ lat: roundedFloat(lat), lon: roundedFloat(lon), place: location, files: [file] }) } METADATA[file].guano = JSON.stringify(guano); }