cnyvfang / YOLOv5-GUI

🎉Qt-GUI implementation of the YOLOv5 algorithm (ver.6 and ver.5). 🎉YOLOv5算法(ver.6及ver.5)的Qt-GUI实现
GNU General Public License v3.0
27 stars 8 forks source link

when i use camera i got this error #2

Open VYRION-Ai opened 2 years ago

VYRION-Ai commented 2 years ago

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`
cnyvfang commented 2 years ago

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:)

VYRION-Ai commented 2 years ago

@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

XTWLP commented 2 years ago

@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

VYRION-Ai commented 2 years ago

@XTWLP no

cnyvfang commented 2 years ago

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