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

Get Frigate working (with Coral TPU) #4

Closed
geerlingguy opened this issue Oct 5, 2022 · 8 comments
Closed

Get Frigate working (with Coral TPU) #4

geerlingguy opened this issue Oct 5, 2022 · 8 comments

Comments

@geerlingguy
Copy link
Owner

geerlingguy commented Oct 5, 2022

I would like to see if I can get Frigate working well... it seems to have a lot of momentum, especially around GPU or TPU-accelerated use.

They have a suggested Docker Compose setup: https://docs.frigate.video/frigate/installation

It looks like they have arm64 images available, yay! https://hub.docker.com/r/blakeblackshear/frigate/tags

@geerlingguy
Copy link
Owner Author

geerlingguy commented Oct 5, 2022

Downside to Coral support—only the USB Coral module will work with the Raspberry Pi currently (see notes: https://pipci.jeffgeerling.com/cards_m2/coral-accelerator-ae-key.html).

The M.2 PCIe versions won't work because of driver issues with the CM4 PCIe bus. (Note: Pi 5 may work with the PCIe version... however that version requires some specific / older Python libraries that could cause incompatibilities with Frigate...).

But could still be a good option, we'll see. I might need to use a different CM4 IO board than the one I'm currently using (BitPiRat) so I can have a USB 2.0 interface.

@geerlingguy
Copy link
Owner Author

I have it running:

Screen Shot 2023-01-12 at 11 45 56 AM

However, nothing happens, and if I go to docker logs, I see:

[2023-01-12 11:46:08] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
*************************************************************
*************************************************************
***    Your config file is not valid!                     ***
***    Please check the docs at                           ***
***    https://docs.frigate.video/configuration/index     ***
*************************************************************
*************************************************************
***    Config Validation Errors                           ***
*************************************************************
2 validation errors for FrigateConfig
mqtt
  field required (type=value_error.missing)
cameras
  field required (type=value_error.missing)
Traceback (most recent call last):
  File "/opt/frigate/frigate/app.py", line 332, in start
    self.init_config()
  File "/opt/frigate/frigate/app.py", line 82, in init_config
    user_config = FrigateConfig.parse_file(config_file)
  File "/opt/frigate/frigate/config.py", line 942, in parse_file
    return cls.parse_obj(config)
  File "/usr/local/lib/python3.9/dist-packages/pydantic/main.py", line 521, in parse_obj
    return cls(**obj)
  File "/usr/local/lib/python3.9/dist-packages/pydantic/main.py", line 341, in __init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 2 validation errors for FrigateConfig
mqtt
  field required (type=value_error.missing)
cameras
  field required (type=value_error.missing)

*************************************************************
***    End Config Validation Errors                       ***
*************************************************************
[cmd] python3 exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
...

@geerlingguy
Copy link
Owner Author

@geerlingguy
Copy link
Owner Author

MQTT's auth is a bit annoying. You have to manually create user / password pairs if you want to do that, after the mosquitto container is running...

@geerlingguy
Copy link
Owner Author

Things are mostly working, but MQTT is not starting up correctly because I don't have the automated hashing of the user/pass pair working correctly yet. I might do something like install mqtt client on the managed server (or run it in a Docker container temporarily or something), just to encrypt the auth file passwords.

It's a bit annoying but might be doable. Just didn't want to have to add in more mqtt-specific tasks in the playbook.

@geerlingguy
Copy link
Owner Author

@geerlingguy
Copy link
Owner Author

I have everything working (including event detection with USB Coral TPU), but I need to clean things up a bit and finish abstracting out the configuration so I can make it work with multiple locations more easily (right now the frigate config hardcodes one camera, my Annke C800 at 4K resolution).

frigate-pi-5

There were a few issues I had to sort out.

First, I ran into the dumb Python thinks I'm not bright enough to manage my own system install, ha!, so I added this task to fix up the This environment is externally managed error:

    - name: Ignore PEP 668 because it's silly.
      ansible.builtin.file:
        path: /usr/lib/python3.11/EXTERNALLY-MANAGED
        state: absent

I also ran into problems with Ansible's current docker_compose module—see: ansible-collections/community.docker#739 (and older discussion at ansible-collections/community.docker#586).

Then I messed with the C800 camera stream settings until I could get it working (it looks like it's a popular enough camera model it has it's own little section in the Frigate docs: https://docs.frigate.video/configuration/camera_specific/#annke-c800).

@geerlingguy
Copy link
Owner Author

This is well in hand at this point, running quite stable. Going to close this issue and move more work to #8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant