Skip to content

Commit

Permalink
removed stat key from METADATA
Browse files Browse the repository at this point in the history
re-enabled model.js indexesToZero
  • Loading branch information
Mattk70 committed Oct 10, 2024
1 parent b4caa4d commit b0a1509
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions js/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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);
}
Expand Down

0 comments on commit b0a1509

Please sign in to comment.