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

オープン 初心者向け
#1,780 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@jayssSmm がすでに取り組んでいます。

2026年11月26日 から。

  • #1785 @omkar-suryavanshi による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, pytorch

調査の方向性

backend/app/utils/SigLIP.pyから始めて、siglip_util_preprocess_image()を調べてください。issueでは画像を開いてリサイズする経路が示されています。issueの提案どおり、EXIF Orientation=6のJPEGを使ったユニットテストを追加してください。前処理の出力が正しい向きになり、テストで向きの処理が検証されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
322
フォーク
793
平均マージ
6日 9時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AOSSIE-Org/PictoPy のほかの issue

AOSSIE-Org/PictoPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。