Skip to content

Commit

Permalink
Merge branch 'now-model' of https://github.com/Mattk70/Chirpity-Electron
Browse files Browse the repository at this point in the history
 into now-model
  • Loading branch information
Mattk70 committed Nov 6, 2023
2 parents 0443963 + 6b15b5c commit b1273ea
Show file tree
Hide file tree
Showing 13 changed files with 1,072 additions and 1,026 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

2,075 changes: 1,062 additions & 1,013 deletions index.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion js/model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const tf = require('@tensorflow/tfjs-node');
require('@tensorflow/tfjs-backend-webgpu');
const fs = require('fs');
const path = require('path');
let DEBUG = false;
Expand Down
6 changes: 3 additions & 3 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,8 @@ async function onPredictionDone({
offset = 0,
action = undefined
}) {

// Reset daylight banner
shownDaylightBanner = false;
AUDACITY_LABELS = audacityLabels;
enableMenuItem(['save2db', 'export2audio']);
// Defer further processing until batch complete
Expand Down Expand Up @@ -2663,8 +2664,7 @@ pagination.forEach(item => {
const limit = config.limit;
const offset = (clicked - 1) * limit;
const species = isSpeciesViewFiltered(true);
// Reset daylight banner
shownDaylightBanner = false;

worker.postMessage({
action: 'filter',
species: species,
Expand Down
11 changes: 6 additions & 5 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ const prepSummaryStatement = () => {
const useRange = range?.start;
let summaryStatement = `
WITH ranked_records AS (
SELECT records.dateTime, records.speciesID, records.confidence, records.fileID, cname, sname, callCount, isDaylight
SELECT records.dateTime, records.speciesID, records.confidence, records.fileID, cname, sname, callCount, isDaylight,
RANK() OVER (PARTITION BY records.dateTime ORDER BY records.confidence DESC) AS rank
FROM records
JOIN files ON files.id = records.fileID
Expand All @@ -470,7 +470,7 @@ const prepSummaryStatement = () => {
extraClause += ' AND dateTime BETWEEN ? AND ? ';
}
if (STATE.detect.nocmig){
extraClause += ' AND isDaylight IS NOT TRUE ';
extraClause += ' AND isDaylight != 1 ';
}
if (STATE.blocked.length) {
const excluded = prepParams(STATE.blocked);
Expand Down Expand Up @@ -1596,7 +1596,8 @@ const terminateWorkers = () => {
}

const insertRecord = async (timestamp, key, speciesID, confidence, file) => {
const isDaylight = isDuringDaylight(timestamp, metadata[file].latitude, metadata[file].longitude)
const isDaylight = isDuringDaylight(timestamp, STATE.lat, STATE.lon);
const offset = key * 1000;
let changes, fileID;
confidence = Math.round(confidence);
const db = memoryDB; //STATE.db;
Expand All @@ -1616,7 +1617,7 @@ const insertRecord = async (timestamp, key, speciesID, confidence, file) => {
await db.runAsync(`INSERT OR IGNORE INTO duration VALUES ${durationSQL}`);
}
await db.runAsync('INSERT OR REPLACE INTO records VALUES (?,?,?,?,?,?,?,?,?,?)',
timestamp, key, fileID, speciesID, confidence,
metadata[file].fileStart + offset, key, fileID, speciesID, confidence,
null, null, key + 3, null, isDaylight);
}

Expand Down Expand Up @@ -1704,7 +1705,7 @@ const onInsertManualRecord = async ({ cname, start, end, comment, count, file, l

let response;
const dateTime = fileStart + startMilliseconds;
const isDaylight = isDuringDaylight(dateTime, metadata[file].latitude, metadata[file].longitude)
const isDaylight = isDuringDaylight(dateTime, STATE.lat, STATE.lon);
response = await db.runAsync('INSERT OR REPLACE INTO records VALUES ( ?,?,?,?,?,?,?,?,?,?)',
dateTime, start, fileID, speciesID, 2000, label, comment, end, parseInt(count), isDaylight);

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@
"!BirdNet${/*}",
"!*fixed_roll*${/*}",
"!Help/example.mp3",
"!BirdNET_GLOBAL_3K_V2.2_Labels.txt",
"!venv${/*}",
"!*git*${/*}",
"package-lock.json",
"!package-lock.json",
"!poetry.lock*",
"!pyproject.toml",
"!README.md",
Expand Down Expand Up @@ -185,7 +184,6 @@
"dependencies": {
"@fast-csv/format": "^4.3.5",
"@popperjs/core": "^2.9.2",
"@tensorflow/tfjs-backend-webgpu": "^4.12.0",
"@tensorflow/tfjs-node": "^4.12.0",
"axios": "1.5.1",
"bootstrap": "5.2.2",
Expand Down

0 comments on commit b1273ea

Please sign in to comment.