-
Notifications
You must be signed in to change notification settings - Fork 792
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
EFRS-1114: Google Coral Support for FaceNet - Updated (1.2.0) #1198
base: EFRS-1114
Are you sure you want to change the base?
Conversation
… to remove old tokens that do not have an expiration column
…efore saving it to the database
…ecial_characters_from_names EFRS-1316: Added a custom liquibase change in order to remove special characters from names
…ired_access_and_refresh_tokens branch
…ty_to_delete_expired_access_and_refresh_tokens EFRS-1286: Added the ability to delete expired access and refresh tokens
…ng embeddings" This reverts commit f682e64.
…r email address becomes the owner
i did test them a while ago, but unfortunately couldn't figure out how to get them operational. For anyone testing, be sure to pass the coral device through to the docker container. |
https://github.com/bropat/CompreFace/blob/EFRS-1114/custom-builds/FaceNet-tpu/docker-compose.yml |
I did try that as well, I may have done something wrong along the way, but i remember it not loading properly. (once i opened the web panel, it wouldn't load) |
I will do it in a few days, I am on holidays right now. I will keep you posted. |
I believe this was designed on a coral usb. As, I at first could not get this working on coral pcie version. Yes, I of course passed /dev/apex_0 through the container. I noticed there was no Apex user group within the container. I added that and added www-data to this group. But this did not work. This led me back to permissions with the uswgi. Where I gave up and configured uwsgi to run as root. This was the trick and compreface started. I have a small home lab using double take so I tested some with double take. I noticed you must run 1 process and 1 thread or those processes will timeout waiting for coral use. The sample .env file given by bropat had configured to run two processes which was not working for me. This has now been running for 4 days with no errors in my very small environment of 4 people and 10 cameras. |
I'm trying with USB coral and compreface won't start, the reason why is not clear. Here are the logs
and here is the docker command docker run
-d
--name='CompreFace'
--net='bridge'
--privileged=true
-e TZ="America/Denver"
-e 'EXTERNAL_DB'='true'
-e 'POSTGRES_URL'='jdbc:postgresql://192.168.50.106:5432/compreface'
-e 'POSTGRES_USER'='***'
-e 'POSTGRES_PASSWORD'='***'
-e 'UWSGI_PROCESSES'='1'
-e 'UWSGI_THREADS'='1'
-p '4200:80/tcp'
-v '/mnt/user/appdata/compreface':'/var/lib/postgresql/data':'rw'
--device='/dev/bus/usb'
'bropat/compreface:1.2.0-facenet-tpu' |
Do I need to have a 2nd USB Coral device if I'm already using my Coral for Frigate? |
yes, a coral can not be shared by multiple processes |
The USB TPU Coral is not recognize on my configuration
with the change to the default install docker-compose file (on public site), compreface-core:
restart: unless-stopped
image: bropat/compreface:1.2.0-facenet-tpu
privileged: true
container_name: "compreface-core"
devices:
- /dev/bus/usb:/dev/bus/usb # passes the USB Coral
environment:
- TZ=Europe/Paris
- ML_PORT=3000
- IMG_LENGTH_LIMIT=${max_detect_size}
- UWSGI_PROCESSES=${uwsgi_processes:-2}
- UWSGI_THREADS=${uwsgi_threads:-1} and the TPU coral is not recognize, if the read well the logs
The error The USB TPU Coral seem to be well mount in docker container root@e9e83a810a73:~# ls -al /dev/bus/usb/
total 0
drwxr-xr-x 3 root root 60 Jan 11 23:31 .
drwxr-xr-x 3 root root 60 Jan 11 23:31 ..
drwxr-xr-x 2 root root 80 Jan 11 23:31 002 |
@jmorille you need to change the default env values so there is only 1 process and only 1 thread |
Of course, No concurent access on TPU Coral So I change the env variable
And now only one worker is started,
but same error
Same loop error |
From my previous experience "Failed to load delegate from libedgetpu.so.1" is a very general error. Often this came down to permissions issues accessing the driver. |
I had the same issue as mentioned by @jmorille with libedgetpu.so.1. I fixed it by giving root permission inside of uwsgi.ini. I am not sure if this is a correct fix or just a workaround ? For now it looks like that everything is working. I can see following debug messages: severity=DEBUG request={"method":"POST","path":"/find_faces","filename":"1705248380.281473-yfohwf-latest-dee00a10-f2d2-4816-a8bb-949975122223.jpg","api_key":"","remote_addr":"172.23.0.4"} logger=src.services.facescan.plugins.facenet.coralmtcnn.coralmtcnn module=coralmtcnn traceback=null build_version=dev I need to figure out how to monitor the performance of Coral TPU. I am using M.2 module. |
It's definitely a workaround. Something you wouldn't see in production. It's hard to get metrics from the coral. But you can infer its working by its temperature. |
I confirm also that the fix, change user
I will buy another TPU to have a better configuration for testing. |
I see that edge tpu have 3 mode clock from reduced clock, standard and maximum. Which mode support in this image ? |
The driver that was used was the standard driver. This only matters for the USB coral's. If you have PCI or M2 based coral it will run at the max clock. |
Could you please share me how I can use max clock driver ? |
https://coral.ai/docs/accelerator/get-started/#runtime-on-linux Run that within the compreface container |
Really thanks, I got it! |
I run Frigate successfully in an unprivileged Docker container mapping a single Coral as a device. I just received a second Coral, hoping to use it with CompreFace in a different Docker container. However, any time I plug in the second Coral, Frigate fails to restart. I have tried various solutions, including mapping the individual device, but I can't get past plugging in the second Coral. I have multiple USB controllers. Power is not an issue. If anybody has a working setup, can you post your docker-compose files and the relevant portions of config files for frigate and compreface-core? |
@pospielov fwiw I can confirm that it does work with the above fixes (yml source change, uwsgi root, and single process/thread.) At least with a single USB coral as that is all I have to test with. |
Also tested with the same workarounds but I can't witness any improvements on performance, at least remotely with sollicitations from double-take. I'm basically getting the same response speed than Mobilenet on CPU (n100, AVX2). |
I don't think the point is response time I think the point is reduced CPU usage. Without running on corals CPU usage would spike each time an inference was run. Now it does not at all. Both are fast either way |
You're perfectly right and I'm also much more concerned about long term stability than benchmark performance 😉 I only have one Coral and I'm wondering what is it's best use : for Frigate or for Compreface. Based on "sollicitations" I would assume that it using it for Frigate might be the best choice. |
frigate runs object detection much more frequently than compreface so yes. Personally, I run 2 corals (from a dual tpu m.2) on frigate and another 2 corals (from a dual tpu m.2) on compreface |
It sounds like Coral support is running for some people in beta versions of CompreFace. If that is true, does this mean the intel AVX extensions are no longer a requirement? I would like to attach a USB Coral to a server running Xeon CPUs that lack AVX, use vUSB passthrough in XCP-ng to attach the USB Coral to a docker container running CompreFace. Would this scenario work (Is AVX no longer required to run CompreFace)? |
Ive a dual tpu installed and it is working fine with other apps but not compreface Any ideas or direction???
|
No description provided.