Editing twilio webserver.ts

Hello All,

I am trying to get the webserver.ts file to detect multiple bounding boxes, or count how many there are. In this section of code, it says 1 bounding box with a threshold of 0.5:

    let r = result.result;
    if (r.bounding_boxes) {
        // one box per label, minimum score 0.5
        let bb: { width: number, height: number, x: number, y: number, value: number, label: string }[] = [];
        for (let b of r.bounding_boxes.filter(x => x.value >= 0.5)) {
            if (!bb.find(x => x.label === b.label)) {
                bb.push(b);
            }

How would we change it to detect multiple bounding boxes, I.E. multiple seats with people in them. For example, we know the total number of chairs in the room so we want twilio to say: “3 out of 24 chairs taken”. So when twilio see’s our class (seattaken bounding boxes) it can say 3 out of 24/4 out of 24/ 5 out of 24/ 23 out of 24 etc… Is this possible? We have it working with just one but are not sure how to do it with multiple ones, we’ve tried a few things but any guidance is appreciated. Thank you.

Hi @jumill87 You can get the count via:

let count = r.bounding_boxes.filter(x => x.value >= 0.5).length;
1 Like

Thank you Jan!

Love your work and videos! Thank you so much!@

Justin

Hey again @janjongboom !

We have gotten it to count but we are only able to count 1 chair:

image

We would like it to detect multiple bounding boxes per class, instead of just 1 bounding box per class. How would we go about doing this? For now, we can only detect one chair empty/one seat taken box. We have been trying to fix this for a few days now and cannot come up with anything atm. Any help would be greatly appreciated. Thank you again, your work and mission is amazing.

Sincerely,

Justin Miller

We have it detecting multiple boxes now, thanks.