Skip to content

Commit

Permalink
fixed Birdnet notBirds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Feb 5, 2024
1 parent d9b5807 commit 6fa1570
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
48 changes: 15 additions & 33 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<!doctype html>
<html lang="en">

<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline'; worker-src 'self' 'unsafe-inline' 'unsafe-eval' "-->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' https:">

<!-- Bootstrap & CSS-->
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css" />
<script defer src="./node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
Expand All @@ -31,9 +28,7 @@
</script>
<!-- App title -->
<title>Chirpity Bird Call Detection</title>

</head>

<body>
<!-- Loading Spinner Overlay -->
<div id="loadingOverlay" class="overlay d-none">
Expand Down Expand Up @@ -141,8 +136,6 @@ <h5>Saved Records</h5>
</div>
</div>
</div>


<!-- Navigation bar -->
<div id="navPadding" class="position-absolute top-0 w-100">
<nav class="navbar navbar-expand-md navbar-dark bg-dark" id="primary_nav_wrap">
Expand Down Expand Up @@ -277,7 +270,6 @@ <h5>Saved Records</h5>
</div>
</div>
</div>

<div class="form-group rounded p-2 mb-2 bg-light">
<span class="circle" title="Filters the detections returned in results.">?</span>
<div class="row pe-3">
Expand All @@ -297,8 +289,7 @@ <h5>Saved Records</h5>
<input id="species-frequency-threshold" type="number" class="form-control" style="width: 30%;" value="0.005" step="0.001" min="0.001" max="1" aria-label="species frequency threshold" aria-describedby="species-frequency-threshold">
<span class="text-nowrap"><label class="col-auto m-2 mt-0" for="species-week">Use Week</label><input id="species-week" type="checkbox" class="form-check-input form-check-inline"></span>
</div>
</div>

</div>
<div class="form-group rounded p-2 mb-2 bg-light">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox"
Expand Down Expand Up @@ -352,10 +343,8 @@ <h5>Saved Records</h5>
<option value="uk">Українська</option>
<option value="zh">中文</option>
</select>

</div>
</div>

</div>
</div>
</div>
<div class="row">
Expand Down Expand Up @@ -397,7 +386,6 @@ <h5>Saved Records</h5>
</div>
</div>
</div>

<div class="row">
<div class="col p-0">
<div class="form-group rounded p-2 mb-2 bg-light">
Expand Down Expand Up @@ -551,23 +539,23 @@ <h5>Saved Records</h5>
<option value="viridis">Viridis</option>
<option value="cdom">CDom</option>
<option value="temperature">Temperature</option>
<!-- <option value="density">Density</option>-->
<!-- <option value="oxygen">Oxygen</option>-->
<!-- <option value="copper">Copper</option>-->
<!-- <option value="earth">Earth</option>-->
<!-- <option value="density">Density</option>-->
<!-- <option value="oxygen">Oxygen</option>-->
<!-- <option value="copper">Copper</option>-->
<!-- <option value="earth">Earth</option>-->
<option value="inferno">Inferno</option>
<option value="magma">Magma</option>
<option value="plasma">Plasma</option>
<option value="hot">Hot</option>
<!-- <option value="cubehelix">CubeHelix</option>-->
<!-- <option value="phase">Phase</option>-->
<!-- <option value="YlOrRd">Yellow/red</option>-->
<!-- <option value="picnic">Picnic</option>-->
<!-- <option value="electric">Electric</option>-->
<!-- <option value="bluered">BlueRed</option>-->
<!-- <option value="blackbody">Blackbody</option>-->
<!-- <option value="rainbow">Rainbow</option>-->
<!-- <option value="rainbow-soft">Rainbow</option>-->
<!-- <option value="cubehelix">CubeHelix</option>-->
<!-- <option value="phase">Phase</option>-->
<!-- <option value="YlOrRd">Yellow/red</option>-->
<!-- <option value="picnic">Picnic</option>-->
<!-- <option value="electric">Electric</option>-->
<!-- <option value="bluered">BlueRed</option>-->
<option value="blackbody">Blackbody</option>
<!-- <option value="rainbow">Rainbow</option>-->
<!-- <option value="rainbow-soft">Rainbow</option>-->
</select>
</div>
</div>
Expand All @@ -590,7 +578,6 @@ <h5>Saved Records</h5>
<div class="col">
<div class="chirpity-only form-group rounded p-2 mb-2 bg-light">
<div class="form-check form-switch">

<input class="form-check-input" type="checkbox"
role="switch" id="context">
<label class="form-check-label" for="context">
Expand Down Expand Up @@ -1034,7 +1021,6 @@ <h5 class="modal-title" id="locationModalLabel">Set Location</h5>
<div id="progressDiv" class="col-2 d-none"><span id="fileNumber"></span><br>
<progress id="progress-bar" max="100" style="width:90%"></progress>
</div>

<div id="complete" class="col-2 pe-2" style="display:none">
</div>
<div class="col pe-1">
Expand Down Expand Up @@ -1120,7 +1106,6 @@ <h5 class="modal-title" id="locationModalLabel">Set Location</h5>
<div class="col d-none">
<fieldset class="border border rounded bg-light p-2">
<legend class="h6">Sum Detections by:</legend>

<div class="form-row">
<div class="form-check-inline">
<input class="form-check-input" type="radio" name="showTotals" id="hourTotal" value="Hour">
Expand All @@ -1135,10 +1120,7 @@ <h5 class="modal-title" id="locationModalLabel">Set Location</h5>
<label class="form-check-label" for="weekTotal">Week</label>
</div>
</div>


<legend class="h6">Group Detections by:</legend>

<div class="form-row">
<div class="form-check-inline">
<input class="form-check-input" type="radio" name="groupTotals" id="dayGroup" value="Day">
Expand Down
14 changes: 13 additions & 1 deletion js/BirdNet2.4.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,23 @@ onmessage = async (e) => {
case "load": {
const version = e.data.model;
DEBUG && console.log("load request to worker");
const { height: height, width: width, labels: labels, location: location } = JSON.parse(fs.readFileSync(path.join(__dirname, `../${version}_model_config.json`), "utf8"));
const { height: height, width: width, location: location } = JSON.parse(fs.readFileSync(path.join(__dirname, `../${version}_model_config.json`), "utf8"));
const appPath = "../" + location + "/";
const list = e.data.list;
const batch = e.data.batchSize;
const backend = e.data.backend;
let labels;
const labelFile = `../labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_en.txt`;
await fetch(labelFile).then(response => {
if (! response.ok) throw new Error('Network response was not ok');
return response.text();
}).then(filecontents => {
labels = filecontents.trim().split(/\r?\n/);
}).catch(error =>{
console.error('There was a problem fetching the label file:', error);
})


// labels.push(...MYSTERIES);
// postMessage({
// message: "labels",
Expand Down
1 change: 1 addition & 0 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,7 @@ const prepSummaryStatement = (blocked) => {
STATE.globalOffset = 0

SEEN_LIST_UPDATE = true;
UI.postMessage({ event: "results-complete" });
if (response["updateResults"] && STATE.db) {
await Promise.all([getResults(), getSummary()]);
if (["explore", "chart"].includes(STATE.mode)) {
Expand Down

0 comments on commit 6fa1570

Please sign in to comment.