Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API/Alerts] top_score not parsed correctly? #161

Open
SHU-red opened this issue Oct 31, 2024 · 15 comments
Open

[API/Alerts] top_score not parsed correctly? #161

SHU-red opened this issue Oct 31, 2024 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@SHU-red
Copy link

SHU-red commented Oct 31, 2024

Describe the bug

  • Yesterday i made use of your awesome and cleanly documented project β†’ Thanks for that πŸ™
  • Everything is up and my telegram notifications are working
  • I wanted to use the alerts - labels - min_score setting to only get notified above a certain score
  • I did set it to 75 and did not get any notification anymore, despite having many events with higher score than 75
  • In the telegram message text (which i did not change from default) is the correct label & score

I checked my /api/events endpoint and got (which shows a top-level top_score of "null", within the data section the correct score is shown

[
  {
    "box": null,
    "camera": "garage",
    "data":
      {
        "attributes": [],
        "box":
          [
            0.428125,
            0.1425925925925926,
            0.37864583333333335,
            0.8527777777777777,
          ],
        "region":
          [0.3104166666666667, 0.0, 0.6145833333333334, 1.0925925925925926],
        "score": 0.9731574058532715,
        "top_score": 0.9655845165252686,
        "type": "object",
      },
    "end_time": 1730320228.789495,
    "false_positive": null,
    "has_clip": true,
    "has_snapshot": true,
    "id": "1730320212.849335-3ck4p9",
    "label": "person",
    "plus_id": null,
    "retain_indefinitely": false,
    "start_time": 1730320207.849335,
    "sub_label": null,
    "thumbnail": "nonono",
    "top_score": null,
    "zones": [],
  },
]

Expected behavior

  • After setting min_score to 75 i shall still get notifications but only for images containing objects with higher score of 75

To Reproduce
Steps to reproduce the behavior:

Versions:

  • Frigate NVR: 0.14.1-f4f3cfa
  • Frigate-Notify: 0.3.5

Frigate-Notify Config:

alerts:
  labels:
    min_score: 75

Additional context

  • Everything above is just guessed
  • If im wrong i can try to dig more deep into my specific problem but it feels like the (?lately?) done changed in frigate-api could lead to this inconsistency
  • BTW: Is there a way to set a score per label?
@SHU-red SHU-red added the bug Something isn't working label Oct 31, 2024
@0x2142
Copy link
Owner

0x2142 commented Oct 31, 2024

Hi there,
Thanks for catching this. After a bit of digging, it looks like in #54 I fixed the issue with the top-level top_score being 0% - which was in response to changes made by the Frigate project. However, that was more-or-less only for the text added to notifications. The ability to filter events based on a minimum score wasn't implemented for a few months later - and unfortunately this filtering occurs in the code long before I re-map the score from the earlier fix.

So I'll have to make a few changes to get this addressed

@0x2142 0x2142 self-assigned this Oct 31, 2024
@SHU-red
Copy link
Author

SHU-red commented Oct 31, 2024

Thank you very much
I really appreciate your hard work

That said, I just wanted to mention that I would love to be able to set a separate min Score for each label

E.g.:
Cats: 90%
Person: 85%

Just because I think you have to touch this code anyways πŸ˜‰

@freefd
Copy link
Contributor

freefd commented Oct 31, 2024

I just wanted to mention that I would love to be able to set a separate min Score for each label
E.g.:
Cats: 90%
Person: 85%

Dear @SHU-red, kindly create a separate improvement request for this, as not to mix improvement and issue in the same thread.

In addition, about the score over sub label:

Dear @NickM-27, can you guide us here, please, if the sub labels of after block in Frigate event can have the score attribute?
Thank you.

@NickM-27
Copy link

The /events topic contains a tuple for that specific object and the score, the /reviews topic just has a list of sub labels that were detected during that review time period

@freefd
Copy link
Contributor

freefd commented Oct 31, 2024

@NickM-27, thanks a lot for the quick response!
Does this mean that once Frigate-notify starts working with the /reviews topic instead of /events, the scores of sub labels will become unavailable and hence filtering on these sub label scores cannot be implemented after switching?

@SHU-red
Copy link
Author

SHU-red commented Oct 31, 2024

Dear @SHU-red, kindly create a separate improvement request for this, as not to mix improvement and issue in the same thread.

Fully aggree πŸ‘‰ #164

@0x2142
Copy link
Owner

0x2142 commented Oct 31, 2024

Hi @SHU-red - I added a quick fix for your original issue in the latest dev build. If you don't want to use the dev branch, and need the fix sooner - let me know & maybe I can throw together a quick release for this.

@SHU-red
Copy link
Author

SHU-red commented Oct 31, 2024

Damn u fast!
Thank you!!!! Its not that urgent but i will immediately pull the latest :dev container and feel refreshed πŸ˜†

@NickM-27
Copy link

NickM-27 commented Oct 31, 2024

Does this mean that once Frigate-notify starts working with the /reviews topic instead of /events, the scores of sub labels will become unavailable and hence filtering on these sub label scores cannot be implemented after switching?

correct, and personally I don't see a reason for a notification script to implement this, as realistically it should be up to the user to configure the software that creates the sub label to only create it if the confidence is high enough. Once frigate has the sub label, it should be trusted

@freefd
Copy link
Contributor

freefd commented Oct 31, 2024

Once frigate has the sub label, it should be trusted

Good point, ok. Thanks again.

@SHU-red, finally, sub labels are out of the scope of #164.

@SHU-red
Copy link
Author

SHU-red commented Oct 31, 2024

Hi @SHU-red - I added a quick fix for your original issue in the latest dev build. If you don't want to use the dev branch, and need the fix sooner - let me know & maybe I can throw together a quick release for this.

Not sure if this is related to your fix

{events}

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x78ab84]

goroutine 1 [running]:

github.com/0x2142/frigate-notify/config.Config.validate({{{0x852f67, 0x6}}, 0xc0001a20f0, 0xc000005188, 0x0})

	/app/config/validate.go:120 +0x12c4

github.com/0x2142/frigate-notify/config.LoadConfig({0x0?, 0x91f72d?})

	/app/config/config.go:212 +0x405

main.main()

	/app/main.go:87 +0x11a9

@0x2142
Copy link
Owner

0x2142 commented Oct 31, 2024

@SHU-red - Yeah, I had a lot of other changes included in that build that caused your error. I just pushed another image - this error should be fixed for you as well.

@SHU-red
Copy link
Author

SHU-red commented Oct 31, 2024

OK now notifications seem to be popping up again
But (and i absolutely do not care) the score for the label in the notification message shows 0%
I absolutely dont care for a dev version

Thank you very much

@freefd
Copy link
Contributor

freefd commented Nov 18, 2024

@SHU-red is it still relevant or can it be closed as solved?

@SHU-red
Copy link
Author

SHU-red commented Nov 18, 2024

Is this fix already implemented in the non-dev tag?
Anyways you can close this, working for me on dev since then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants