Skip to content

Commit 5271681

Browse files
committed
last push before the next build
1 parent ccae6fc commit 5271681

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

AppCode/stream-search.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
<div class="separator"></div>
5252
<button class='fun-button-blue' disabled id="continue-btn"> START </button>
5353
<button class='fun-button-blue' id="main-menu-btn"> Main Menu </button>
54+
<div class="separator"></div>
55+
*choppy depending on system capabilities
5456
</div>
5557

5658
<!-- START THE HTML STREAM VIEW OF VIEW1 -->

AppCode/taga-JS/stream-search/stream-search.js

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//const { max } = require("@tensorflow/tfjs-node")
22
const { ipcRenderer } = require('electron');
33
const PATH = require('path');
4+
const fileType = require('file-type');
45

56
const keywords_only_description =
67
'Displays keywords related to faces stored. Finds images/videos/gifs containing a similar face and displays the keywords from the description.';
@@ -80,6 +81,7 @@ let selection_sources;
8081
let media_source = '';
8182

8283
let face_threshold = 6.4;
84+
let max_sample_num = 3000;
8385

8486
ipcRenderer.invoke('getCaptureID').then((sources) => {
8587
selection_sources = document.getElementById('source-type');
@@ -174,9 +176,9 @@ function Stop_Stream_Search() {
174176
Keywords_Images_Memes_End();
175177
}
176178
stream_ok = false;
177-
clearInterval(face_keywords_interval);
178-
clearInterval(descriptors_interval);
179-
clearInterval(memory_loss_interval);
179+
if (face_keywords_interval) clearInterval(face_keywords_interval);
180+
if (descriptors_interval) clearInterval(descriptors_interval);
181+
if (memory_loss_interval) clearInterval(memory_loss_interval);
180182
stream.getTracks().forEach(function (track) {
181183
track.stop();
182184
});
@@ -419,12 +421,13 @@ async function Stream_Search_Run() {
419421
//END: loop for drawing the boxes of the face rectangles on the canvas, selected box has a different stroke style
420422

421423
//START: in a separate loop, search and fill keywords for a randomly selected face in the faces array rect_face_array (next version should use tree based indexes on clusters)
422-
let db_search_delay = 2500; //amount of time the DB has to find data related to a face, in ms
424+
let db_search_delay = 3000; //amount of time the DB has to find data related to a face, in ms
423425
let max_records = await Number_of_Tagging_Records();
424-
let record_sample_num = Math.min(5000, Math.floor(1 * max_records)); //allow up to 4K records to be searched in each sweep since more may incur too much delay
426+
let record_sample_num = Math.min(max_sample_num, Math.floor(1 * max_records)); //allow up to 4K records to be searched in each sweep since more may incur too much delay
425427
let face_keywords = []; //holds the keywords for the selected image in focus
426428
let face_including_images = []; //holds the images where a face match was found (could be 1 face in many present)
427429
let face_including_memes = []; //holds the memes connected to a face match was found (could be 1 face in many present)
430+
//const file_type_lookup = new Map(); //holds the file types to ignore videos
428431
async function face_db_search() {
429432
//will improve in next version !!!! XXX use tree based methods!!!
430433
face_keywords = []; //reset the keywords
@@ -442,8 +445,22 @@ async function Stream_Search_Run() {
442445
let annotation_obj_tmp = await Get_Tagging_Annotation_From_DB(
443446
filename_tmp
444447
);
448+
445449
let face_descriptors_tmp = annotation_obj_tmp['faceDescriptors'];
446450
if (face_descriptors_tmp.length == 0) continue; //no face
451+
452+
// //check for the type of the file
453+
// if (file_type_lookup.has(filename_tmp)) {
454+
// if (!file_type_lookup.get(filename_tmp)) continue;
455+
// } else {
456+
// let ft_res = await fileType.fromFile(
457+
// PATH.join(TAGA_DATA_DIRECTORY, filename_tmp)
458+
// );
459+
// const usable = !ft_res.mime.includes('video');
460+
// file_type_lookup.set(filename_tmp, usable);
461+
// if (!usable) continue;
462+
// }
463+
447464
let score_tmp = await Get_Descriptors_DistanceScore(
448465
[ref_face_tmp_descriptor],
449466
face_descriptors_tmp
@@ -562,21 +579,21 @@ async function Stream_Search_Run() {
562579
//END: memory
563580
}
564581

565-
function formatBytes(bytes, decimals = 2) {
566-
if (!+bytes) return '0 Bytes';
582+
// function formatBytes(bytes, decimals = 2) {
583+
// if (!+bytes) return '0 Bytes';
567584

568-
const k = 1024;
569-
const dm = decimals < 0 ? 0 : decimals;
570-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
585+
// const k = 1024;
586+
// const dm = decimals < 0 ? 0 : decimals;
587+
// const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
571588

572-
const i = Math.floor(Math.log(bytes) / Math.log(k));
589+
// const i = Math.floor(Math.log(bytes) / Math.log(k));
573590

574-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
575-
}
576-
setInterval(
577-
() => console.log(formatBytes(performance.memory.usedJSHeapSize)),
578-
2000
579-
);
591+
// return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
592+
// }
593+
// setInterval(
594+
// () => console.log(formatBytes(performance.memory.usedJSHeapSize)),
595+
// 2000
596+
// );
580597
//END of stream search functionality view
581598

582599
// let ft_res = await fileType.fromFile( PATH.join(TAGA_DATA_DIRECTORY, current_image_annotation["fileName"]) )

0 commit comments

Comments
 (0)