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

Đang mở Phù hợp với người mới
#1,780 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

@jayssSmm đang làm issue này rồi.

Từ ngày 26/11/2026.

  • #1785 của @omkar-suryavanshi — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, pytorch
Lĩnh vực
machine-learning, search

Hướng nghiên cứu

Bắt đầu với backend/app/utils/SigLIP.py và kiểm tra siglip_util_preprocess_image(); issue xác định luồng mở và thay đổi kích thước ảnh. Thêm một unit test sử dụng JPEG có EXIF Orientation=6, như issue đề xuất. Công việc hoàn tất khi đầu ra tiền xử lý đúng chiều và test xác minh việc xử lý hướng ảnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
322
Fork
793
Merge trung bình
6 ngày 9 giờ
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AOSSIE-Org/PictoPy

Tất cả issue của AOSSIE-Org/PictoPy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.