BUG: Unreadable images interrupt the entire AI-tagging process

未关闭 适合新手
#1,702 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
opencv, python

调研方向

从 backend/app/models/ObjectClassifier.py 和 backend/app/utils/images.py 开始;追踪 get_classes() 如何处理 OpenCV 无法加载的图像,以及标记循环如何更新 isTagged。检查现有的图像分类和批处理测试。完成标准是:无法读取的图像会被跳过,且不会导致批次结束;成功处理但没有检测结果的图像会被标记为已标记。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Python
星标
313
派生
755
平均合并
6 天 36 分钟
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AOSSIE-Org/PictoPy 的其他 Issue

查看 AOSSIE-Org/PictoPy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。