LucasThePatator / FaceDetectCrop

1 stars 0 forks source link

error "AttributeError: 'NoneType' object has no attribute 'shape'" when processing fresh reference images #4

Closed m-btt closed 1 year ago

m-btt commented 1 year ago

Same error occurs for different failures during testing, follows:

Traceback (most recent call last): File "D:\Firefox Downloads\poop main\main.py", line 257, in <module> sort(args) File "D:\Firefox Downloads\poop main\main.py", line 196, in sort classifier.make_ref_db(args.reference) File "D:\Firefox Downloads\poop main\main.py", line 79, in make_ref_db if faces.shape[0] > 1: AttributeError: 'NoneType' object has no attribute 'shape'

Full log of one test run:

$ python main.py -r reference -m sort -i "D:\Firefox Downloads\poop main\desktop folders" -o desktop Processing reference database... 2521 - Coach Chanmi: 100%|███████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 16.38it/s] 2521 - Heedo - Kim Taeri: 0%| | 0/181 [00:00<?, ?it/s] Folders: 5%|███▎ | 1/22 [00:00<00:04, 4.29it/s] Traceback (most recent call last): File "D:\Firefox Downloads\poop main\main.py", line 257, in <module> sort(args) File "D:\Firefox Downloads\poop main\main.py", line 196, in sort classifier.make_ref_db(args.reference) File "D:\Firefox Downloads\poop main\main.py", line 79, in make_ref_db if faces.shape[0] > 1: AttributeError: 'NoneType' object has no attribute 'shape'

Testing more to narrow down root cause, at the moment the suspicion is error is being raised when a face is not found in a reference picture.

ETA: When I say processing fresh reference images, I mean there is no pre-existing references database being used. Upon this error, process is stopped and killed, and no database file is created. No logs either at this moment due to #3

m-btt commented 1 year ago

Gathering NOK files so far supports that the issue is likely caused when a face is not identified like mentioned.

KTR examples: 204900616_170408341733915_7858538057275611471_n 209021547_170408648400551_6036433180448590929_n

KJY examples: 0d4a8aae5df6b8b2ede5e7ca22eb9448 DWf4u-aW0AQOP96

Propose two actions:

  1. When face not identified, ignore and proceed with processing remaining reference pictures;
  2. Add event to log

Potential additional one:

  1. Move any invalid reference images to an appropriate folder (e.g. invalid-references folder where all invalid reference images found during processing are put)