EthanH3514 / AL_Yolo

👺 基于Yolov5的Apex Legend游戏 AI 辅瞄外挂
Apache License 2.0
290 stars 50 forks source link

关于使用DML存在的问题 #42

Open Kprobem opened 6 months ago

Kprobem commented 6 months ago

更改detect.py def run(self):

Load model

    device = torch_directml.device()

程序正常启动,目标识别报错

`(apex) C:\Users\Lumi.conda\envs\apex\ai>python apex.py 目标检测已开启 Expected package name at the start of dependency specifier rotli==1.0.9 ^ Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 检测到旧版本的YOLOv5模型,正在尝试使用原始加载... Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs Exception in thread Thread-4 (work): Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 169, in work self.run() File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 128, in run pred = non_max_suppression(pred, self.conf_thres, self.iou_thres, self.classes, self.agnostic_nms, max_det=self.max_det) File "C:\Users\Lumi.conda\envs\apex\ai\utils\general.py", line 980, in non_max_suppression x = torch.cat((box, conf, j.float(), mask), 1)[conf.view(-1) > conf_thres] RuntimeError 关闭程序

(apex) C:\Users\Lumi.conda\envs\apex\ai>python apex.py 目标检测已开启 Expected package name at the start of dependency specifier rotli==1.0.9 ^ Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 检测到旧版本的YOLOv5模型,正在尝试使用原始加载... Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs Exception in thread Thread-4 (work): Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 168, in work self.run() File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 127, in run pred = non_max_suppression(pred, self.conf_thres, self.iou_thres, self.classes, self.agnostic_nms, max_det=self.max_det) File "C:\Users\Lumi.conda\envs\apex\ai\utils\general.py", line 980, in non_max_suppression x = torch.cat((box, conf, j.float(), mask), 1)[conf.view(-1) > conf_thres] RuntimeError

目标检测已开启 Expected package name at the start of dependency specifier rotli==1.0.9 ^ You already created a DXCamera Instance for Device 0--Output 0! Returning the existed instance... To change capture parameters you can manually delete the old object using del obj. Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 237, in __capture File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 126, in _grab File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\core\duplicator.py", line 26, in update_frame _ctypes.COMError: (-2005270527, '应用程序进行了无效的调用。调用的参数或某对象的状态不正确。\r\n启用 D3D 调试层以便通过调试消息查看详细信息。', (None, None, None, 0, None))

Exception in thread DXCamera: Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 269, in __capture File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 203, in stop File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1093, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread Screen Capture FPS: 1643148 Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 检测到旧版本的YOLOv5模型,正在尝试使用原始加载... Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 鼠标锁定已开启 鼠标锁定已开启`

Kprobem commented 6 months ago

更改所有device为dml后 (apex) C:\Users\Lumi.conda\envs\apex\ai>python apex.py 目标检测已开启 Expected package name at the start of dependency specifier rotli==1.0.9 ^ Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 检测到旧版本的YOLOv5模型,正在尝试使用原始加载... Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 鼠标锁定已开启 鼠标锁定已开启 鼠标锁定已关闭 Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\core\duplicator.py", line 26, in update_frame _ctypes.COMError: (-2005270490, '键控互斥已弃用。', (None, None, None, 0, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 237, in capture File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 126, in _grab File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\core\duplicator.py", line 35, in update_frame File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\core\duplicator.py", line 20, in post_init__ AttributeError: 'NoneType' object has no attribute 'output'

Exception in thread DXCamera: Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 269, in __capture File "C:\Users\Lumi.conda\envs\apex\ai\dxcam\dxcam.py", line 203, in stop File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1093, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread

Kprobem commented 6 months ago

(apex) C:\Users\Lumi.conda\envs\apex\ai>python apex.py 目标检测已开启 Expected package name at the start of dependency specifier rotli==1.0.9 ^ Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs 检测到旧版本的YOLOv5模型,正在尝试使用原始加载... Fusing layers... Model summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs Exception in thread Thread-4 (work): Traceback (most recent call last): File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\Lumi.conda\envs\apex\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 168, in work self.run() File "C:\Users\Lumi.conda\envs\apex\ai\detect.py", line 127, in run pred = non_max_suppression(pred, self.conf_thres, self.iou_thres, self.classes, self.agnostic_nms, max_det=self.max_det) File "C:\Users\Lumi.conda\envs\apex\ai\utils\general.py", line 981, in non_max_suppression x = torch.cat((box, conf, j.float(), mask), 1)[conf.view(-1) > conf_thres] RuntimeError