odd_size flags every non-modal image size when IQR is 0

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

Chưa có ai nhận issue này.

Đá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
75/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ệ
numpy, pandas, python
Lĩnh vực
computer-vision, data

Hướng nghiên cứu

Bắt đầu bằng cách đọc SizeProperty.get_scores trong issue_managers/image_property.py, tập trung vào nhánh threshold_gap == 0 và cách nhánh này xác định các cờ odd_size. Tái hiện hành vi với hai phân bố kích thước ảnh trong issue, rồi so sánh số lượng được đánh dấu sau khi thay đổi; kết quả mong đợi được nêu là các kích thước thiểu số không bị đánh dấu hết là ngoại lệ trong cả hai phân bố.

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

Mô tả

When more than roughly 70-75 % of a dataset share one image size, q1 == q3 in
SizeProperty.get_scores (issue_managers/image_property.py). The threshold_gap == 0 branch
then sets self.threshold = 1.0, so every image whose size differs from that one value at all
is flagged as odd_size, even if it is only slightly larger or smaller.

This is common with photos downscaled to a fixed maximum side (phone photos all end up 384x512,
and anything with a different aspect ratio or a smaller original becomes "odd"). Whether a
dataset hits the branch depends on whether the modal share is above or below the quartile, so a
small change in composition switches between "nothing flagged" and "all minority sizes flagged".

Reproduction (cleanvision 0.3.7, Pillow 10.2.0, numpy 2.2.6, pandas 2.2.3):

import tempfile
from pathlib import Path

import numpy as np
from PIL import Image
from cleanvision import Imagelab

rng = np.random.default_rng(0)


def n_flagged(counts):
	with tempfile.TemporaryDirectory() as d:
		for (w, h), n in counts.items():
			for i in range(n):
				Image.fromarray(rng.integers(0, 255, (h, w, 3), dtype=np.uint8)).save(Path(d) / f"{w}x{h}_{i}.png")
		lab = Imagelab(data_path=d, verbose=False)
		lab.find_issues(issue_types={"odd_size": {}}, verbose=False)
		return int(lab.issues["is_odd_size_issue"].sum())


print(n_flagged({(384, 512): 140, (512, 512): 30, (512, 288): 30}))  # 60
print(n_flagged({(384, 512): 100, (512, 512): 60, (512, 288): 40}))  # 0

Expected: the same few (or no) images flagged in both cases (512x512 and 512x288 are not
outliers in either).

Possible fixes, any of these would do:

  • fall back to a relative tolerance around the median (e.g. flag only beyond a factor of x)
    instead of exact equality when IQR is 0
  • or skip the check with a warning when IQR is 0
Ngôn ngữ chính
Python
Star
1.2k
Fork
87
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 cleanlab/cleanvision

Tất cả issue của cleanlab/cleanvision

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.