Skip to content

Detect several images #7

@razvan-tanase

Description

@razvan-tanase

I am trying to use your face detector script to get the bboxes on several images but it does not work how it is expected. First of all, your README describes that you can pass several images packed in a list to get multi-image predictions with the following example:
bboxes,points = model.predict([image1,image2])
but does not mention if the image1 and image2 are the paths to that images or the object you get after you open them with PIL (for example: Image.open('image1'), assuming they have the same root directory). I get the following errors in this cases:

Traceback (most recent call last):
File "C:\YOLOv5\yoloface\detect.py", line 65, in
_main(arguments)
File "C:\YOLOv5\yoloface\detect.py", line 58, in _main
bboxes, points = model.predict(orgimg)
File "C:\YOLOv5\yoloface\face_detector.py", line 159, in predict
images = self._preprocess(images)
File "C:\YOLOv5\yoloface\face_detector.py", line 73, in _preprocess
h0, w0 = img.shape[:2] # orig hw
ValueError: not enough values to unpack (expected 2, got 1)

from this call: orgimg = np.array([Image.open('00000002.png'), Image.open('00000001.png')]) bboxes, points = model.predict(orgimg) (when I pass the images as PIL objects)

Traceback (most recent call last):
File "C:\YOLOv5\yoloface\detect.py", line 65, in
_main(arguments)
File "C:\YOLOv5\yoloface\detect.py", line 58, in _main
bboxes, points = model.predict(orgimg)
File "C:\YOLOv5\yoloface\face_detector.py", line 159, in predict
images = self._preprocess(images)
File "C:\YOLOv5\yoloface\face_detector.py", line 73, in _preprocess
h0, w0 = img.shape[:2] # orig hw
ValueError: not enough values to unpack (expected 2, got 1)

from this call: orgimg = np.array(['00000002.png', '00000001.png']) bboxes, points = model.predict(orgimg) (where I pass the images as paths to them)

Traceback (most recent call last):
File "C:\YOLOv5\yoloface\detect.py", line 65, in
_main(arguments)
File "C:\YOLOv5\yoloface\detect.py", line 58, in _main
bboxes, points = model.predict(['00000002.png', '00000001.png'])
File "C:\YOLOv5\yoloface\face_detector.py", line 159, in predict
images = self._preprocess(images)
File "C:\YOLOv5\yoloface\face_detector.py", line 73, in _preprocess
h0, w0 = img.shape[:2] # orig hw
AttributeError: 'str' object has no attribute 'shape'

from this call: bboxes, points = model.predict(['00000002.png', '00000001.png']) (where I pass the images as paths to them)

and

Traceback (most recent call last):
File "C:\YOLOv5\yoloface\detect.py", line 65, in
_main(arguments)
File "C:\YOLOv5\yoloface\detect.py", line 58, in _main
bboxes, points = model.predict([Image.open('00000002.png'), Image.open('00000001.png')])
File "C:\YOLOv5\yoloface\face_detector.py", line 159, in predict
images = self._preprocess(images)
File "C:\YOLOv5\yoloface\face_detector.py", line 73, in _preprocess
h0, w0 = img.shape[:2] # orig hw
File "C:\Users\rtanase\Anaconda3\envs\detect\lib\site-packages\PIL\Image.py", line 519, in getattr
raise AttributeError(name)
AttributeError: shape

from this call: bboxes, points = model.predict([Image.open('00000002.png'), Image.open('00000001.png')]) (when I pass the images as PIL objects)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions