【发布时间】:2022-10-23 13:52:21
【问题描述】:
我正在使用 yolo v7 制作一个项目。 我使用 Obs 作为 yolo v7 的虚拟摄像头 obs 的输入是特定的应用程序/游戏屏幕
这是我写的终端行。
py .\yolov7\detect.py --weights .\yolov7-tiny.pt --source 0 --conf-thres 0.2 --save-txt --view-img
终端输出:
Namespace(weights=['.\\yolov7-tiny.pt'], source='0', img_size=640, conf_thres=0.2, iou_thres=0.45, device='', view_img=True, save_txt=True, save_conf=False, nosave=False, classes=None, agnostic_nms=False, augment=False, update=False, project='runs/detect', name='exp', exist_ok=False, no_trace=False)
YOLOR v0.1-115-g072f76c torch 1.12.1+cu116 CUDA:0 (NVIDIA GeForce GTX 1650, 4095.6875MB)
Fusing layers...
Model Summary: 200 layers, 6219709 parameters, 229245 gradients
Convert model to Traced-model...
traced_script_module saved!
model is traced!
1/1: 0... [swscaler @ 000001d35d7340c0] Warning: data is not aligned! This can lead to a speed loss
success (640x480 at 0.00 FPS).
Exception in thread Thread-1 (update):
Traceback (most recent call last):
File "C:\Users\Thiroshan\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\Thiroshan\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Thiroshan\Desktop\python\Projects\Reinforcement\Aim_ai_fps\yolov7\utils\datasets.py", line 318, in update
time.sleep(1 / self.fps) # wait time
ZeroDivisionError: float division by zero
C:\Users\Thiroshan\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2895.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
视频检测除网络摄像头(Obs 虚拟摄像头)外运行良好 为了在没有 obs 的情况下测试网络摄像头,我没有网络摄像头
我使用检查 Obs 虚拟相机开放式CV它工作得很好
让我知道为什么 yolo v7 有网络摄像头问题
# import the opencv library
import cv2
# define a video capture object
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
# by frame
ret, frame = vid.read()
# Display the resulting frame
cv2.imshow('frame', frame)
# the 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
【问题讨论】:
标签: object-detection yolo obs