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

Error occurs during face recognition on ARM #292

Closed
Felix-Franz opened this issue Jul 6, 2021 · 4 comments
Closed

Error occurs during face recognition on ARM #292

Felix-Franz opened this issue Jul 6, 2021 · 4 comments
Assignees
Milestone

Comments

@Felix-Franz
Copy link

Describe the bug
Face recognition is not working.

To Reproduce
Steps to reproduce the behavior:

  1. Initially start photonix
  2. Add large media folder
  3. Wait for processing the images
  4. Have a look at the log files to see that this error occurs multiple times

Expected behavior
It looks like an import of a external library fails.
That is not how it is supposed to be.

Server (please complete the following information):

  • Device: Raspberry Pi 4B
  • OS: Raspberry Pi OS 5.6.8-1 (Kernel 5.10.17-v8+)
  • Architecture: arm64

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 91.0.4472.124

Additional context

Console log:

photonix_1  | ImportError: `load_weights` requires h5py when loading weights from HDF5.
photonix_1  | Traceback (most recent call last):
photonix_1  |   File "/srv/photonix/photos/utils/classification.py", line 67, in __process_task
photonix_1  |     self.runner(task.subject_id)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 225, in run_on_photo
photonix_1  |     model = FaceModel(library_id=photo and photo.library_id)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 41, in __init__
photonix_1  |     self.graph = self.load_graph(graph_file)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 61, in load_graph
photonix_1  |     facenet_graph = build_model('Facenet')
photonix_1  |   File "/srv/photonix/classifiers/face/deepface/DeepFace.py", line 37, in build_model
photonix_1  |     model = model()
photonix_1  |   File "/srv/photonix/classifiers/face/deepface/basemodels/Facenet.py", line 540, in loadModel
photonix_1  |     model.load_weights(weights)
photonix_1  |   File "/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2219, in load_weights

docker-compose.yaml:

version: '3'

services:
  postgres:
    image: postgres:11.1-alpine
    environment:
      POSTGRES_DB: photonix
      POSTGRES_PASSWORD: password
    volumes:
      - ./data/db:/var/lib/postgresql/data
    networks:
      - photonix
    restart: always

  redis:
    image: arm32v7/redis:3.2.12
    networks:
      - photonix
    restart: always

  photonix:
    image: photonixapp/photonix:latest
    ports:
      - '85:80'
    environment:
      ENV: prd
      POSTGRES_HOST: postgres
      POSTGRES_DB: photonix
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      REDIS_HOST: redis
      ALLOWED_HOSTS: '*'
    volumes:
      - /path/to/images/:/data/media:ro
      - ./data/raw-photos-processed:/data/raw-photos-processed
      - ./data/cache:/data/cache
      - ./data/models:/data/models
    networks:
      - photonix
    restart: always

networks:
  photonix:
@damianmoore
Copy link
Collaborator

Hi @Felix-Franz, thanks for reporting this. I tried your docker-compose.yml (just changed a volume, port and Redis image) with latest version (v0.14.0) and it detected photos fine. I assume this means the problem is with ARM 64-bit version. I'll try on my Pi 4 next.

@Felix-Franz
Copy link
Author

Felix-Franz commented Jul 12, 2021

I have update to postgres:13-alpine, arm64v8/redis:6-alpine and photonixapp/photonix:0.14.0, but the error still persists:

Console log:

photonix_1  | 2021-07-13 15:54:14,286 ERROR    Error processing task: classify.face - ee15d4b5-6d2d-4cf2-d030-8e2141943913
photonix_1  | Traceback (most recent call last):
photonix_1  |   File "/srv/photonix/photos/utils/classification.py", line 70, in __process_task
photonix_1  |     self.runner(task.subject_id)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 225, in run_on_photo
photonix_1  |     model = FaceModel(library_id=photo and photo.library_id)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 41, in __init__
photonix_1  |     self.graph = self.load_graph(graph_file)
photonix_1  |   File "/srv/photonix/classifiers/face/model.py", line 61, in load_graph
photonix_1  |     facenet_graph = build_model('Facenet')
photonix_1  |   File "/srv/photonix/classifiers/face/deepface/DeepFace.py", line 37, in build_model
photonix_1  |     model = model()
photonix_1  |   File "/srv/photonix/classifiers/face/deepface/basemodels/Facenet.py", line 540, in loadModel
photonix_1  |     model.load_weights(weights)
photonix_1  |   File "/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2219, in load_weights
photonix_1  |     raise ImportError(
photonix_1  | ImportError: `load_weights` requires h5py when loading weights from HDF5.

@damianmoore damianmoore changed the title An error occurs during face recognition training Error occurs during face recognition on ARM Jul 12, 2021
@damianmoore damianmoore self-assigned this Jul 12, 2021
@damianmoore damianmoore added this to the 1.0 milestone Jul 12, 2021
@damianmoore damianmoore added the ai label Jul 12, 2021
@damianmoore
Copy link
Collaborator

damianmoore commented Jul 14, 2021

@Felix-Franz This is now fixed as of 618eeb7. Just building a new release with the fix which is v0.16.0. The problem was a missing shared library for h5py (libhdf5_serial.so provided by libhdf5-dev) which was in the wrong stage of the Docker multi-stage build. I'm assuming the amd64 pre-compiled wheel includes this file as there was no problem on this platform.

@damianmoore damianmoore added this to Done June 2021 in Development tasks Jul 14, 2021
@Felix-Franz
Copy link
Author

Thanks, face recognition is working now! 🎉

@damianmoore damianmoore moved this from Done June 2021 to Done Jul 2021 in Development tasks Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development tasks
Done Jul 2021
Development

No branches or pull requests

2 participants