BUG: Unreadable images interrupt the entire AI-tagging process

Đang mở Phù hợp với người mới
#1,702 2 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 6 ngày

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
82/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ệ
opencv, python
Lĩnh vực
backend, machine-learning

Hướng nghiên cứu

Bắt đầu với backend/app/models/ObjectClassifier.py và backend/app/utils/images.py; theo dõi cách get_classes() xử lý một hình ảnh mà OpenCV không thể tải và cách vòng lặp gắn thẻ cập nhật isTagged. Kiểm tra các bài kiểm thử hiện có cho việc phân loại hình ảnh và xử lý theo lô. Công việc được xem là hoàn tất khi các hình ảnh không đọc được được bỏ qua mà không kết thúc lô, còn các hình ảnh được xử lý thành công nhưng không có phát hiện nào được đánh dấu là đã gắn thẻ.

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

Mô tả

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

Description

The AI-tagging process can terminate unexpectedly when PictoPy encounters an image that OpenCV cannot load or decode(corrupt or unsupported image).

In ObjectClassifier.get_classes() (backend/app/models/ObjectClassifier.py), cv2.imread() returns None when an image cannot be loaded. However, image_util_classify_and_face_detect_images() (backend/app/utils/images.py) directly calls len(classes) without checking for None, resulting in a TypeError that interrupts the entire tagging batch.

Expected Behaviour

  • Unreadable images should be logged and skipped.
  • Their isTagged status should remain False.
  • Processing should continue with the remaining images.
  • Successfully processed images with no detections should still be marked as tagged.

Actual behaviour

  1. Application retrieves multiple untagged images from the database.
  2. YOLO processes images sequentially.
  3. One image is corrupt or unreadable.
  4. get_classes() returns None.
  5. len(None) raises a TypeError.
  6. The entire tagging batch terminates.
  7. Remaining images are not processed during that run.

Why Does This Matter?
A single unreadable image can prevent an entire batch of otherwise valid images from receiving AI-generated tags. Handling such failures individually would improve the reliability and stability of PictoPy's AI-tagging pipeline.

Proposed Solution
Handle the None return value before accessing len(classes). Skip the unreadable image and continue processing the remaining images.

Record
  • I agree to follow this project's Code of Conduct
Ngôn ngữ chính
Python
Star
313
Fork
755
Merge trung bình
6 ngày 36 phút
Pull request đã merge (30 ngày)
8

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.