BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)

Abierto Apto para principiantes
#1,780 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@jayssSmm ya está trabajando en esto.

Desde el 26/11/2026.

  • #1785 de @omkar-suryavanshi — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

Empieza por backend/app/utils/SigLIP.py e inspecciona siglip_util_preprocess_image(); el issue señala la ruta de apertura y redimensionamiento de imágenes. Añade una prueba unitaria con un JPEG con EXIF Orientation=6, como sugiere el issue. Se considera terminado cuando la salida del preprocesamiento está derecha y la prueba verifica el manejo de la orientación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug enhancement
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

While going through the semantic search code I noticed that siglip_util_preprocess_image() in backend/app/utils/SigLIP.py doesn't handle EXIF orientation.

Phones usually store portrait photos as landscape pixels + an EXIF Orientation tag (like 6 = rotate 90° clockwise). Viewers read that tag and show the photo upright. But here the image is just opened and resized:

img = (
    Image.open(img_path)
    .convert("RGB")
    .resize((resolution, resolution), Image.BICUBIC)
)

so SigLIP ends up getting portrait phone photos turned sideways. That would hurt semantic search and semantic labels for basically any portrait photo taken on a phone.

The face/object side is fine btw, cv2.imread already applies EXIF orientation. So right now the same photo is upright for YOLO/FaceNet but sideways for SigLIP.

How I checked

I ran the actual siglip_util_preprocess_image() on a real phone photo with Orientation = 6 and turned the output tensor back into an image:

What you see What SigLIP gets
(drag 1_what_you_see.png here) (drag 2_what_siglip_sees.png here)

Also tried a small test image saved with Orientation=6 (red left half, blue right half). It displays with red on top, but SigLIP gets red on the left:

Displayed size (w,h):  (200, 400)
SigLIP input:   red in top half=0.50, red in left half=1.00
Upright photo:  red in top half=1.00, red in left half=0.50

Checked on dev at 3c6b10f.

Not a duplicate of

  • #1570 / #1596 - same cause, but only fixes thumbnails
  • #1727 - only the OpenCV loaders for faces/objects

Neither touches SigLIP.py.

Possible fix

Add ImageOps.exif_transpose() right after Image.open() and a unit test with an Orientation=6 JPEG. It's a small change.

One thing I wasn't sure about: photos that are already embedded will keep the old sideways embeddings. Should they get re-embedded as part of this, or is that better as a separate issue?

I'd like to work on this if that's okay.

1_what_you_see 2_what_siglip_sees
Record
  • I agree to follow this project's Code of Conduct
Lenguaje dominante
Python
Estrellas
322
Forks
793
Merge medio
6 d 9 h
PR fusionados (30 d)
20

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AOSSIE-Org/PictoPy

Todos los issues de AOSSIE-Org/PictoPy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.