Local realtime person detection for RTSP cameras

The database it is talking about is called frigate.db and is in the clips directory. Any chance something happened to that file?

All of those messages are from ffmpeg. If you aren’t seeing issues, then you can set the ffmpeg log level back to fatal in your global_args.

Most definitely! I had so many clips from testing in there that I manually deleted them along with that .db file.
It was automatically remade so I guess I just thought it would be ok. I guess I need to restart the addon after doing that.
I ended up doing just that and it is working now. Glad it wasn’t anything wrong with the software and it was just my mistake.
Just wanted to post what I found in case it was something that might be an issue since this is a beta.

Thanks for the reply.

So you just enabled save slips and it works? Omitting map argument works also as ffmpeg auto selects the correct stream.

So your issue was not enabling the save slips option in the first place

That makes sense. The next beta release will include a config option to specify the location of the database file if you want to store it somewhere else.

2 Likes

I ran my library of ~3000 clips through frigate with both the MobileNet SSD (current model) and the MobileDet SSD (model in next beta) and the new model seems to be a good improvement. Note that you may see different results since these are clips from my own cameras. Based on the table below, the new default threshold will be .7. Increasing it to .75 should significantly reduce the likelihood of a false positive at the expense of missing some objects.
image

6 Likes

I changed the log level back to fatal and all those error’s aren’t showing now.

I do have this in my logs though

Exception in thread recording_maint:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/psutil/_common.py", line 449, in wrapper
    ret = self._cache[fun]
AttributeError: _cache
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py", line 1515, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/psutil/_common.py", line 452, in wrapper
    return fun(self)
  File "/usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py", line 1557, in _parse_stat_file
    with open_binary("%s/%s/stat" % (self._procfs_path, self.pid)) as f:
  File "/usr/local/lib/python3.8/dist-packages/psutil/_common.py", line 713, in open_binary
    return open(fname, "rb", **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/proc/5648/stat'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/opt/frigate/frigate/record.py", line 122, in run
    self.move_files()
  File "/opt/frigate/frigate/record.py", line 48, in move_files
    if process.name() != 'ffmpeg':
  File "/usr/local/lib/python3.8/dist-packages/psutil/__init__.py", line 634, in name
    name = self._proc.name()
  File "/usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py", line 1515, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py", line 1610, in name
    name = self._parse_stat_file()['name']
  File "/usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py", line 1522, in wrapper
    raise NoSuchProcess(self.pid, self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=5648)

That is a rare edge case that I have fixed for the next beta already. Just restart.

1 Like

Is it this MobileDet model? https://arxiv.org/pdf/2004.14525.pdf That came out in April 2020?

The improvements looks really good – I assume your tests were done on specifically looking for Persons?

Yes. The edgetpu version was recently added. I am only testing for persons. I think I have a few false positive clips with cats and dogs in my test set, but not many. I’m not sure how much better it will handle those.

Is it simply just a matter of shutting down and restarting Frigate via docker-compose in order to pull the new image/fixes?

I do this

  1. docker-compose pull
  2. docker-compose up -d

if you have other containers in the compose file it will do a pull on all of them. You can probably tell it to just pull a specific one if you wanted.

edit: a restart will not re-pull the image

I generally recommend using the immutable tags (version specific), so the process to update would be to update the image tag in the docker-compose.yml file and run docker-compose up -d. If you are using the stable tags, then the steps from @hasshoolio work.

Ha, just learned something. I use tags and would update the compose file before the pull.
Now I know I don’t need to do that, just the up -d got the new image. Thanks!

So if I use this as my docker-compose file:

version: "3.6"
services:
  frigate:
      container_name: frigate
      restart: unless-stopped
      privileged: true
      image: blakeblackshear/frigate:0.8.0-beta1-amd64
      volumes:
      ...

That is still the same beta image that we are working with, correct? so a docker-compose up -d should pull the new image this way?

That image won’t be updated. The new version will be published as 0.8.0-beta2-amd64 .

Ok I see. How does one keep up with your scheduled pushes? Your 0.8.0-beta2 tree still has the older image listed in the readme.

On reboot it re-appears right away. Although it doesn’t seem to affect how things work.

I do have a few questions on the new version.

  1. I’m trying to wrap my head around the new HA integration that works with the beta.
    In the stable release, the mqtt topic of frigate/camera_name/object_name controlled a binary sensor that was either on or off. I used this as an outdoor security motion sensor. When an object was detected, the binary sensor turned on, the lights turned on. When it turned off, it would start a timer to turn the lights off. If this happened while the alarm was armed (either home or away), it would send notifications to our phone with the best.jpg snapshot.

With the new beta and HA integration, this topic now gives an object count. I’m sure I could make an automation that when the count increases, turn on lights, but I’m not seeing a path anywheres that could act as “off” to start the timer to turn off the lights…

  1. I love the idea of 2 streams. I’d like to use the 4k stream to capture images. How do I differentiate the width/height of the 2 streams? I have one stream that is 640x320, the other is 3840x2160. Looking at the ffmpeg settings example, it appears there’s only the option to set 1 width/height.

You can watch the repo on github and tell it to notify you for new releases.

  1. When they value is 0, turn off. When the value is >0 turn on. You can make a template binary sensor if you prefer.
  2. The width and height in the config are specific to the stream with the detect role. The other streams can be whatever you want. Frigate doesn’t care.