YOLOv5-GUI icon indicating copy to clipboard operation
YOLOv5-GUI copied to clipboard

when i use camera i got this error

Open VYRION-Ai opened this issue 3 years ago • 5 comments

Thanks for your work i try v6 when i run the code using camer i got this error

`Fusing layers...
Model Summary: 213 layers, 1769989 parameters, 0 gradients, 4.2 GFLOPs
1/1: 0...  Success (inf frames 640x480 at 30.00 FPS)


Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "run2.py", line 120, in run
    annotator = Annotator(im0, line_width=line_thickness, example=str(names))
  File "D:\python_work\GUI\orginal\PyQt5-YOLOv5_V6\utils\plots.py", line 74, in __init__
    assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to Annotator() input images.'
AttributeError: 'list' object has no attribute 'data`

VYRION-Ai avatar May 19 '22 21:05 VYRION-Ai

Oh...I am sorry that I have not come across this strange problem before...Perhaps you could check the version of your Python and related dependencies and that your webcam is working properly. I'll try to reproduce the issue and get back to you if I make any progress:)

cnyvfang avatar May 23 '22 03:05 cnyvfang

@cnyvfang thank you i add this line im0 = np.array(im0, dtype=np.float32)

im0 =im0s.copy() im0 = np.array(im0, dtype=np.float32) annotator = Annotator(im0, line_width=line_thickness, example=str(names))

The input screen is showing up but not the output

VYRION-Ai avatar May 23 '22 11:05 VYRION-Ai

@cnyvfang thank you i add this line im0 = np.array(im0, dtype=np.float32)

im0 =im0s.copy() im0 = np.array(im0, dtype=np.float32) annotator = Annotator(im0, line_width=line_thickness, example=str(names))

The input screen is showing up but not the output

Have you solved the problem of output

XTWLP avatar May 29 '22 02:05 XTWLP

@XTWLP no

VYRION-Ai avatar May 29 '22 05:05 VYRION-Ai

Strangely, I failed to reproduce the problem on my device, it works fine on my PC.

cnyvfang avatar Jun 10 '22 13:06 cnyvfang