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

Mispositioned imported face regions and missing person thumbnails #12440

Open
1 of 3 tasks
wonx opened this issue Sep 7, 2024 · 8 comments
Open
1 of 3 tasks

Mispositioned imported face regions and missing person thumbnails #12440

wonx opened this issue Sep 7, 2024 · 8 comments
Labels
good first issue Good for newcomers

Comments

@wonx
Copy link

wonx commented Sep 7, 2024

The bug

Yesterday I tested the recently implemented face import feature (this is something I had been waiting for a long time, thanks!), but I noticed some issues. Some face regions appear to be misplaced, so, when you hover over the person's thumbnail in the info sidebar, the face rectangle does not correspond to the person's face. In my case, These faces were tagged in Digikam (and in some cases, in Picasa).
Untitled

Moreover, face thumbnails from these pictures are not generated, and the affected person won't appear in the People sidebar.
Captura

Seems to particularly affect photos taken from iPhones (mostly vertical pictures), in occasions it affects other devices, I just found the issue in pictures taken from a motorola moto g71 5G and a SONY ILCE-5000.

I've seen that behavior before. Digikam also had this bug in the past: https://bugs.kde.org/show_bug.cgi?id=372340
And same for pigallery2: bpatrik/pigallery2#515

I can provide picture samples if needed, although I'd prefer to do that in private.

The OS that Immich Server is running on

Debian 12

Version of Immich Server

v1.114.0

Version of Immich Mobile App

1.113.1 build.157

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/md0/Media/Fotos:/Biblioteques/Fotos:ro
      - /mnt/md0/Personal/Marc/Fotos:/Biblioteques/Fotos Marc:ro
      - /mnt/md0/mountpoints/shared_with_marc:/Biblioteques/Fotos Nextcloud Shared Marc:ro
    env_file:
      - stack.env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:e3b17ba9479deec4b7d1eeec1548a253acc5374d68d3b27937fcfe4df8d18c7e
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      #start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c", "shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=/opt/appdata/immich/library
DB_DATA_LOCATION=/opt/appdata/immich/postgres
IMMICH_VERSION=release
DB_PASSWORD=<redacted>
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

  1. Upgraded immich to version v1.114.0
  2. Re-imported metadata (Administration, Jobs, Extract Metadata, All)
  3. Wait for the import to end.
  4. Open pictures with people faces.
    ...

Relevant log output

No response

Additional information

No response

@mertalev
Copy link
Contributor

mertalev commented Sep 8, 2024

Hmmm, I guess we need to handle orientation.

@foux
Copy link
Contributor

foux commented Sep 9, 2024

I can confirm the issue with face positioning, I have the same problem

@tofutim
Copy link

tofutim commented Sep 30, 2024

@wonx in picasa-snap on Ubuntu 24, I'm stuck "starting application.." - hoping to do face id there

@Hixxey
Copy link

Hixxey commented Oct 1, 2024

I just tested this and get similar results. The face region from Digikam is in the wrong position.
Screenshot 2024-10-01 194151
face regions

@wonx
Copy link
Author

wonx commented Oct 2, 2024

@tofutim

Mmm, something must have broken the compatibility in Ubuntu 24.04. Do you mind opening a bug report (https://github.com/wonx/picasasnap/issues) and I'll have a look when I find a moment?

@gschintgen
Copy link

gschintgen commented Dec 21, 2024

FWIW I can confirm that face import (which is great to have!) has some issues.

In more detail: I'm using Digikam to do the actual photo management and import my library as external library into Immich. Immich had already scanned the images before the face tag import feature was implemented, so the pictures do have face regions in Immich's database, but most of them stayed anonymous. I've now updated Immich to 1.123.0 and re-run metadata import and as far as I can tell it worked fine to import the names and face regions.

BUT:

  1. The faces now have two almost identical regions shown in the pictures' details: one anonymous by Immich, one imported. I suppose I can fix this somehow by disabling the face detection feature and then running the face detection reset job to clear out Immich's detected regions. May be this could be handled a bit nicer? (E.g. recognize the regions as identical when they're overlapping by >80%)
  2. This is what's really bothering me: All of the imported faces have broken thumbnails. "Error loading image". Edit: Changing it via "Select featured photo" fixes it, so that's great, but there are lots of people in my library... It seems that Immich neglects to "randomly" assign a suitable thumbnail to imported people.

@mertalev
Copy link
Contributor

The faces now have two almost identical regions shown in the pictures' details: one anonymous by Immich, one imported. I suppose I can fix this somehow by disabling the face detection feature and then running the face detection reset job to clear out Immich's detected regions. May be this could be handled a bit nicer? (E.g. recognize the regions as identical when they're overlapping by >80%)

There is an overlap check, but it's in the face detection code that runs after metadata extraction. It doesn't handle the reverse order (but it ideally should).

I'd have to look into the issue with thumbnails, but my hunch is that the timing of the jobs is off - maybe the person thumbnail job runs before metadata extraction finishes, etc.

@gschintgen
Copy link

I'd have to look into the issue with thumbnails, but my hunch is that the timing of the jobs is off

I've now manually started the face detection refresh job and it fixes the missing thumbnails! But it will take quite some time to process all the pictures, so I can't yet tell if it will also merge the overlapping face regions. But at least the eye sore is gone :-)

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

No branches or pull requests

6 participants