Franklin-Zhang0 / Yolo-v8-Apex-Aim-assist

95 stars 20 forks source link

我运行成功但并没有瞄准 #9

Open iu6888 opened 1 year ago

iu6888 commented 1 year ago

我已经成功运行显示Main Start但没有截图框并且无法瞄准

Franklin-Zhang0 commented 1 year ago

该程序不会显示截图框,只有在你长按鼠标左键或右键的时候才会瞄准,并且默认只检测屏幕中心1/2的区域,你可以先在游戏外使用一些apex图片测试,鼠标应该会自动移动到图片中的人物上,如果游戏外可以,游戏内不行,你可以试试把游戏调成无边框模式。如果游戏外也不行,你可以截图一下控制台我看看。

iu6888 commented 1 year ago

在控制台界面鼠标会卡,进到游戏就变正常 ![Uploading 3ce18d9cc41a1762db34cfe2e048e83.png…]()

iu6888 commented 1 year ago

![Uploading 3ce18d9cc41a1762db34cfe2e048e83.png…]()

Franklin-Zhang0 commented 1 year ago
屏幕截图

我看不到你上传的图片,请在评论栏的左下角点击attach files by dragging....来上传图片。鉴于你鼠标变卡的情况,有可能是cpu在推理,你需要检查有没有安装pytorch的cuda版本。如果已经安装,那么可能你的显卡配置不足以支撑游戏和推理同时进行。

if you have a cuda capable gpu, you can running the following extra command ··· pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116 ···

iu6888 commented 1 year ago

我的显卡是3060t安装玩torch在游戏可以使用了但是控制台fps只有10-20左右,瞄准假人经常过头,无法跟着运动假人,我要如何解决

Franklin-Zhang0 commented 1 year ago

应该是推理速度不足,你可以尝试安装tensorRT环境并转换trt模型来加速推理,可以参考这个fork repo,写得很详细

iu6888 commented 1 year ago

我不知道我是否成功安装tensort,但也无法自动瞄准假人

Franklin-Zhang0 commented 1 year ago

.pt模型是不需要tensorRT的,但是识别帧率较低。tensorRT安装好了之后还需要把.pt模型转化成.trt模型,并在args.py里面修改model为对应的.trt模型才能起效。

iu6888 commented 1 year ago

我要怎么做

Franklin-Zhang0 commented 1 year ago

转化模型的方法请看我上面发的repo,里面都有写。修改模型也仅仅只需要将args.py里面的model参数从原来默认的"apex_8n.pt"改为你转换出来的模型名字就行了。

iu6888 commented 1 year ago

Traceback (most recent call last): File "D:\zm\Yolo-v8-Apex-Aim-assist-master\Yolo-v8-Apex-Aim-assist-master\main.py", line 64, in boxes = predict_trt(args,img) File "D:\zm\Yolo-v8-Apex-Aim-assist-master\Yolo-v8-Apex-Aim-assist-master\trt.py", line 48, in predict_trt boxes = pred.inference(img, conf=args.conf, end2end=True) File "D:\zm\Yolo-v8-Apex-Aim-assist-master\Yolo-v8-Apex-Aim-assist-master\utils\utils.py", line 109, in inference num, final_boxes, final_scores, final_cls_inds = data ValueError: not enough values to unpack (expected 4, got 1)

Franklin-Zhang0 commented 1 year ago

你在转换模型的时候有没有输入--end2end 参数,没有的话,可能导致这个情况。 转换的代码应该类似:

python export.py -o yolov8n.onnx -e yolov8n.trt --end2end --v8

其中,yolov8n.onnx和yolov8n.trt的文件名需要按照你转换的模型相应改变。 转化好之后,不要忘了把转化好的模型复制过去,替换原来的trt模型。 如果这些操作都是正确的,我也不知道导致的原因了。

iu6888 commented 1 year ago

我输入并未给我trt文件只给了一个onnx文件

Franklin-Zhang0 commented 1 year ago

onnx文件没法用于预测,要么使用原始.pt,要么转化成.trt

fatinghenji commented 1 year ago

同样遇到严重的性能问题。即使使用 trt 模型 在 4070ti 上游戏内仅有 10fps 左右。切出游戏后即可上升至 60fps 左右。

Franklin-Zhang0 commented 1 year ago

不需要传递参数,trt模型无法使用cpu推理,只能使用gpu。如果使用pt模型推理,只要安装了cuda版本的pytorch,就会默认自动调用gpu。 这种性能问题通常是由于游戏占用了过多gpu资源导致,有两类解决办法。

  1. 限制游戏gpu使用量 你可以在英伟达控制面板中限制游戏帧数,或者在游戏内开启垂直同步,降低游戏画质,让游戏以无边框窗口模式运行等等。
  2. 选择gpu消耗较小的模型 选择8n模型,使用trt,fp16,int8量化等等
fatinghenji commented 1 year ago

限制帧数后问题解决。

jjjkkk688 commented 1 year ago

我的也是这样,有输出listener start Main start Start detection: True Start detection: True Start detection: False 但是没有瞄准

1109507252 commented 1 year ago

转化模型的方法请看我上面发的repo,里面都有写。修改模型也仅仅只需要将args.py里面的model参数从原来默认的"apex_8n.pt"改为你转换出来的模型名字就行了。

不知道为什么不能把onnx转换成trt。转换的时候没有输出

f348564110 commented 1 year ago

您好,在您提到的repo里需要安装pycuda,但是使用pip install pycuda的话会显示版本不对的问题。请问您使用的pycuda和对应的cuda是什么版本的?