CompreFace icon indicating copy to clipboard operation
CompreFace copied to clipboard

The images remain in the `img` table after deleting the parent subject or service

Open d-a-gerashenko opened this issue 4 months ago • 0 comments

The images remain in the img table after deleting the parent subject or service.

Steps to reproduce the behavior:

  1. docker exec -ti bash
  2. psql -U postgres
  3. \c frs
  4. Use the web interface (API) to create a service, subject (type == recognition, name == UNIQUE_SUBJECT_NAME) and upload an image.
  5. select i.id img_id, m.app_id app_id, s.id subject_id, m.id model_id, e.id embeggin_id from img i join embedding e on i.id = e.img_id join subject s on s.id = e.subject_id join model m on m.api_key = s.api_key where s.subject_name = 'UNIQUE_SUBJECT_NAME';
  6. Remember img_id.
  7. Delete the subject via the web-UI (API).
  8. select count(id) from img where id='<img_id from the step 6>'; (the result is 1 but this image is not used anymore).

Images are deleted from the "img" table only when images (not parent entities) are directly deleted via the web interface.

Versions: ADMIN_VERSION=1.2.0 API_VERSION=1.2.0 FE_VERSION=1.2.0 CORE_VERSION=1.2.0-arcface-r100 POSTGRES_VERSION=1.2.0

To get all such images: select count(i.id) from img i left join embedding e on e.img_id = i.id where e.id is null

To clean up: delete from img where id in (select i.id from img i left join embedding e on e.img_id = i.id where e.id is null).

d-a-gerashenko avatar Aug 13 '25 12:08 d-a-gerashenko