用Resnet101+GPT搭建一个玩王者荣耀的AI

Overview

基于pytorch框架用resnet101加GPT搭建AI玩王者荣耀

本源码模型主要用了SamLynnEvans Transformer 的源码的解码部分。以及pytorch自带的预训练模型"resnet101-5d3b4d8f.pth"

注意运行本代码需要注意以下几点 注意!!!!!

1、目前这个模型在用后裔100多局对战数据下训练出来后,对局表现出各种送人头之类的问题,以及代码本身各种不规范,请多原谅。
2、本代码本来只是我试验模型能否玩王者荣耀,B站朋友强烈要求开源。仓促开源估计问题很多,请多原谅。
三、运行环境win10;win7未测试,估计是可以。 需要一张6G或以上显存的英伟达显卡,虽然4G的1050ti勉强也可以。
四、需要一台打开安卓调试并能玩王者荣耀的手机,虚拟机没有试过,理论上应该可行。
五、需要下载scrcpy 的windows版本。 把所有文件解压到项目根目录即可(这是我的笨办法) 。
位置如图
scrcpy
六、pyminitouch库运行时会自动安装minitouch。如果无法自动安装则需要手动安装minitouch ,比较麻烦,如有困难请多多百度。
还有,minitouch不支持Android10
七、本人用的手机分辨率是1080*2160的,本代码并没有针对不同的手机做优化。不同的手机minitouch命令中所描述的位置会有差异,需要对代码做出相应调整,请务必注意。
八、注意游戏的布局,务必要一样。布局可参考B站视频或者我上传的训练用截图。如图。
布局图
九、游戏更新以后可能会导致无法预料的后果,因此并不能保证此代码玩王者荣耀的长期有效性。
我之后可能出视频教程,同时讲讲我的设计思路。部分地区截图不可见,可下载项目在pycharm下打开readme.md即可见。

运行与生成训练数据

需要的库
torch
torchvision
pynput
pyminitouch
可能还有其它库

运行训练好的模型

如果前面的工作做好了就可以把模型跑起来了,这里声明这个经过训练的模型仅仅训练100多局,水平很低,青铜人机都未必能打过。
一、首先下载模型 你可以从google云盘 下载训练过的模型,也可以百度网盘下载
链接:https://pan.baidu.com/s/1Bt7BXukDDCpc1aWFI2iKxg
提取码:5c1k
后放入weights文件夹下
二、先运行 “启动和结束进程.py” 启动scrcpy 把“训练数据截取_A.py” 中的两项改成你的,_DEVICE_ID 是 adb devices后显示的那个id
启动和结束进程.py
三、启动王者荣耀进入5v5人机对战 运行 “训练数据截取_A.py” 即可。

生成训练数据

运行 “训练数据截取_A.py” 时可以通过按键操控角色,这时就可以生成训练用的数据,如果没有操控则会生成一个空文件夹和空json文件。
按"i"键则结束或则是重新运行
按键'w' 's ' 'a' 'd'控制方向 左、下、右箭头对应是1、2、3技能,上箭头长按则攻击。其它按键请参考源码。
每次获取训练图片最好不要超过5000张

你也可以下载训练数据样本(只是样本,数据量不大,不能指望两局对战数据就有效果,我估计这个模型现有参数可以吃下上万场的对战数据)
百度网盘 链接:https://pan.baidu.com/s/1Ak1sLcSRimMWRgagXGahTg 提取码:t4k3
google云盘
解压后注意存放位置,请参考源码。

如何训练

一、数据预处理
将图片用resnet101预处理后再和对应操作数据一起处理后用numpy数组储存备用。
具体要做的就是运行 “处理训练数据5.py”
二、训练
预处理完成以后运行 “训练_B.py”即可。

游戏按键映射本地化

按键映射通过 './json/名称_操作.json' 文件完成,如前文所述,由minitouch进行按压模拟。

  1. 前期准备:

开启“开发者模式”,允许“USB调试”,允许“USB调试(安全设置):允许通过USB调试修改权限或模拟点击”。后两项均在进入开发者选项后可以找到。

  1. 按键可视化,按键轨迹监控:

开启“显示点按操作的视觉反馈”,开启“指针位置”。后者方便查看自己手机屏幕点按的像素点坐标信息,从而生成对应本地手机按键映射的.json文件。

  1. 映射本地化计算说明:

layout_description 此计算以手机充电口朝右握持为例,反向握持同理可推。样例手机分辨率1080x2160。 Android“指针位置”中显示的坐标信息以图中左上角红色原点所示,xy轴如图。此原点不论如何握持(充电口朝左或右),其始终保持在视野左上角,由重力感应判定。 minitouch坐标原点如图中左下角蓝色原点所示,此点为物理固定点,不随手机握持方向改变,反向握持此点在右上角。 另外注意两个坐标系xy轴方向不同。 在图中设定下,Android指针坐标(X,Y)对应minitouch坐标(1080-Y,X):即在点按屏幕中某点时,安卓调试显示的(X,Y)在.json文件中的坐标应为(1080-Y,X)。

  1. 本地映射文件生成:

'check_json.py'为调试和生成本地.json按键映射文件的脚本。重映射时请一一记录每个按键在自己手机中显示的“指针位置”,并按照上述计算方法换算为.json文件中需 要输入的坐标。此脚本会生成一个'./json/local_layout.json'文件,请在'处理训练数据5.py'中进行相应替换。 此外,'处理训练数据5.py'中:‘加一技能’,‘加二技能’,‘加三技能’,‘购买’变量也许进行同样处理。.json文件中指令含义请参照minitouch

Comments
  • ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接

    ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接

    非常感谢dalao的开源代码,今天本来想尝试一下看看实际模型效果,根据up的步骤一步步走,结果在运行"训练数据截取_A.py"时报了一个错误

    ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接
    

    请问一下这是什么原因造成的呢,希望dalao能够抽空回答一下,不胜感激~

    opened by baltam 8
  • 出现RuntimeError: Invalid device, must be cuda device 报错

    出现RuntimeError: Invalid device, must be cuda device 报错

    具体报错如下 这是第一个错误 Type A touch device huawei,ts_kit (720x1560 with 11 contacts) detected on /dev/input/event2 (score 21059) Note: hard-limiting maximum number of contacts to 10 这是第二个错误 Connection established Traceback (most recent call last): File "C:/Users/25634/Desktop/深度学习/训练数据截取_A.py", line 188, in mod = torchvision.models.resnet101(pretrained=True).eval().cuda(device).requires_grad_(False) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\torch\nn\modules\module.py", line 463, in cuda return self._apply(lambda t: t.cuda(device)) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\torch\nn\modules\module.py", line 359, in _apply module._apply(fn) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\torch\nn\modules\module.py", line 381, in _apply param_applied = fn(param) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\torch\nn\modules\module.py", line 463, in return self._apply(lambda t: t.cuda(device)) RuntimeError: Invalid device, must be cuda device

    http://xiazai.cnsafet.cn/1.png

    opened by 2563411574 5
  • pywin32:pip和conda的冲突

    pywin32:pip和conda的冲突

    Traceback (most recent call last): File "/home/greenhandzdl/Desktop/ResnetGPT/训练数据截取_A.py", line 12, in <module> from 运行辅助 import * File "/home/greenhandzdl/Desktop/ResnetGPT/运行辅助.py", line 1, in <module> import win32gui, win32ui, win32con ModuleNotFoundError: No module named 'win32gui' 然后我 ` ┌─[root@GreenhandzdlsWindow]─[/home/greenhandzdl/Desktop/ResnetGPT] └──╼ #pip install win32gui win32ui win32con ERROR: Introspect error on :1.1:/modules/kwalletd5: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying WARNING: Keyring is skipped due to an exception: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.1 was not provided by any .service files. Collecting win32gui Using cached win32gui-221.5.tar.gz (605 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmpl4bralee_in_process.py get_requires_for_build_wheel /tmp/tmp6ks_qi5p cwd: /tmp/pip-install-oev5_sxb/win32gui_5a95d9aa821a43098bbd50354ab86e00 Complete output (20 lines): Traceback (most recent call last): File "/tmp/tmpl4bralee_in_process.py", line 280, in main() File "/tmp/tmpl4bralee_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmpl4bralee_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-1x59y7q1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel return self._get_build_requires( File "/tmp/pip-build-env-1x59y7q1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-1x59y7q1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 258, in run_setup super(_BuildMetaLegacyBackend, File "/tmp/pip-build-env-1x59y7q1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 27, in from win32.distutils.gui import win32gui_build_ext File "/tmp/pip-install-oev5_sxb/win32gui_5a95d9aa821a43098bbd50354ab86e00/win32/distutils/gui.py", line 4, in import winreg ModuleNotFoundError: No module named 'winreg'

    WARNING: Discarding https://files.pythonhosted.org/packages/b8/75/7bed82934e51903f9d48b26b3996161bb2dce1731607b4bb7fd26003ed3e/win32gui-221.5.tar.gz#sha256=b2be0885d526d70b3f9a62f4005e9452cdb4bce67e117f4c14e7aa684bc5b2a5 (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpl4bralee_in_process.py get_requires_for_build_wheel /tmp/tmp6ks_qi5p Check the logs for full command output. Using cached win32gui-221.4.tar.gz (605 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmpotx8n9vp_in_process.py get_requires_for_build_wheel /tmp/tmp7riwy8s4 cwd: /tmp/pip-install-oev5_sxb/win32gui_735679b337704fcd8b411d70877080db Complete output (20 lines): Traceback (most recent call last): File "/tmp/tmpotx8n9vp_in_process.py", line 280, in main() File "/tmp/tmpotx8n9vp_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmpotx8n9vp_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-tjjj0a_u/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel return self._get_build_requires( File "/tmp/pip-build-env-tjjj0a_u/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-tjjj0a_u/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 258, in run_setup super(_BuildMetaLegacyBackend, File "/tmp/pip-build-env-tjjj0a_u/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 26, in from win32.distutils.gui import win32gui_build_ext File "/tmp/pip-install-oev5_sxb/win32gui_735679b337704fcd8b411d70877080db/win32/distutils/gui.py", line 4, in import winreg ModuleNotFoundError: No module named 'winreg'

    WARNING: Discarding https://files.pythonhosted.org/packages/82/93/e3908020a82c2a628ecc05faad79aa947f22eee672f272622ca7ad4d7bf3/win32gui-221.4.tar.gz#sha256=91d1df0a00c8dbbc82bfd8a04039bd26a96d2119307ceb695d1b356f478cecee (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpotx8n9vp_in_process.py get_requires_for_build_wheel /tmp/tmp7riwy8s4 Ch``eck the logs for full command output. Using cached win32gui-221.3.tar.gz (614 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmpqycdzqy1_in_process.py get_requires_for_build_wheel /tmp/tmp0kin20os cwd: /tmp/pip-install-oev5_sxb/win32gui_4a6253462a3f46d285dee8031f929b6d Complete output (20 lines): Traceback (most recent call last): File "/tmp/tmpqycdzqy1_in_process.py", line 280, in main() File "/tmp/tmpqycdzqy1_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmpqycdzqy1_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-xi5r_enz/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel return self._get_build_requires( File "/tmp/pip-build-env-xi5r_enz/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-xi5r_enz/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 258, in run_setup super(_BuildMetaLegacyBackend, File "/tmp/pip-build-env-xi5r_enz/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 26, in from win32.distutils.gui import win32gui_build_ext File "/tmp/pip-install-oev5_sxb/win32gui_4a6253462a3f46d285dee8031f929b6d/win32/distutils/gui.py", line 4, in import winreg ModuleNotFoundError: No module named 'winreg'

    WARNING: Discarding https://files.pythonhosted.org/packages/58/d8/727d452ea900aa4be08b0e264e4a12d1f04e51b60f46ce01e0996f071f85/win32gui-221.3.tar.gz#sha256=d6ebe58330480bde71ad93c0e67b31b58ec6091e281d944f1cb529f4e9611c00 (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpqycdzqy1_in_process.py get_requires_for_build_wheel /tmp/tmp0kin20os Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement win32gui ERROR: No matching distribution found for win32gui `

    opened by greenhandzdl 3
  • 运行后找不到设备:error: device '***********' not found

    运行后找不到设备:error: device '***********' not found

    两个种方式均为找不到设备,有没有人遇到过这样的问题。又是怎么解决的呢

    手动填写设备ID的错误内容: D:\Python\Python37\python.exe D:/Python/AI王者荣耀-m/ResnetGPT/训练数据截取_A.py 设备ID= *********** error: device '**********' not found Traceback (most recent call last): File "D:/Python/AI王者荣耀-m/ResnetGPT/训练数据截取_A.py", line 194, in 设备 = MyMNTDevice(_DEVICE_ID) File "D:\Python\AI王者荣耀-m\ResnetGPT\运行辅助.py", line 10, in init MNTDevice.init(self,ID) File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 117, in init self.start() File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 125, in start self.server = MNTServer(self.device_id) File "D:\Python\Python37\lib\site-packages\pyminitouch\connection.py", line 84, in init assert is_device_connected(device_id) AssertionError

    自动获取设备ID出现错误: 2021-06-03 10:01:19.255 | INFO | pyminitouch.utils:is_device_connected:56 - device 手机型号 online 2021-06-03 10:01:19.255 | INFO | pyminitouch.connection:init:87 - searching a usable port ... 2021-06-03 10:01:21.256 | INFO | pyminitouch.connection:init:89 - device ['4c9f728c'] bind to port 20872 2021-06-03 10:01:21.294 | INFO | pyminitouch.connection:get_abi:35 - device ['4c9f728c'] is error: device '['********']' not found 2021-06-03 10:01:21.382 | INFO | pyminitouch.connection:init:27 - minitouch already existed in ['********'] Traceback (most recent call last): File "D:/Python/AI王者荣耀-m/ResnetGPT/训练数据截取_A.py", line 194, in 设备 = MyMNTDevice(_DEVICE_ID) File "D:\Python\AI王者荣耀-m\ResnetGPT\运行辅助.py", line 10, in init MNTDevice.init(self,ID) File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 117, in init self.start() File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 125, in start self.server = MNTServer(self.device_id) File "D:\Python\Python37\lib\site-packages\pyminitouch\connection.py", line 95, in init self._forward_port() File "D:\Python\Python37\lib\site-packages\pyminitouch\connection.py", line 128, in _forward_port logger.debug("forward command: {}".format(" ".join(command_list))) TypeError: sequence item 2: expected str instance, list found

    opened by qyjava 3
  • AI玩王者数据分享汇总

    AI玩王者数据分享汇总

    AI玩王者数据汇总,开贴汇集数据。 如果您想分享训练数据 回复包含数据的网盘地址和密码即可。 这里先分享我的部分数据 局数:约150局(每局数据大小几百兆到2G不等) 等级:青铜人机 英雄:后裔 是否预处理 :含图片且有预处理

    百度网盘 链接: https://pan.baidu.com/s/19fG_1jK4xBThtmrCg-u4rg 提取码:eytn

    opened by FengQuanLi 3
  • 启动后出现错误:

    启动后出现错误: "minitouch did not work.see ************

    提示minitouch没在工作,进了提示的'https://github.com/williamfzc/pyminitouch/issues/11'网址也没找到有效的解决方案

    2021-06-04 09:06:47.653 | INFO | pyminitouch.utils:is_device_connected:56 - device SKR-A0 online 2021-06-04 09:06:47.653 | INFO | pyminitouch.connection:init:87 - searching a usable port ... 2021-06-04 09:06:49.661 | INFO | pyminitouch.connection:init:89 - device ***** bind to port 20487 2021-06-04 09:06:49.759 | INFO | pyminitouch.connection:get_abi:35 - device ***** is arm64-v8a 2021-06-04 09:06:49.838 | INFO | pyminitouch.connection:init:27 - minitouch already existed in ***** 2021-06-04 09:06:49.838 | DEBUG | pyminitouch.connection:_forward_port:128 - forward command: adb -s ***** forward tcp:20487 localabstract:minitouch 2021-06-04 09:06:49.864 | DEBUG | pyminitouch.connection:_forward_port:130 - output: b'20487\r\n' 2021-06-04 09:06:49.864 | INFO | pyminitouch.connection:_start_mnt:141 - start minitouch: adb -s ***** shell /data/local/tmp/minitouch /data/local/tmp/minitouch[5]: syntax error: unexpected 'newline' Traceback (most recent call last): File "D:/PythonWork/AI王者荣耀/ResnetGPT/训练数据截取_A.py", line 195, in 设备 = MyMNTDevice(_DEVICE_ID) File "D:\PythonWork\AI王者荣耀\ResnetGPT\运行辅助.py", line 10, in init MNTDevice.init(self,ID) File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 117, in init self.start() File "D:\Python\Python37\lib\site-packages\pyminitouch\actions.py", line 125, in start self.server = MNTServer(self.device_id) File "D:\Python\Python37\lib\site-packages\pyminitouch\connection.py", line 103, in init ), "minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11" AssertionError: minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11

    opened by qyjava 2
  • 训练数据截取A时报错

    训练数据截取A时报错

    Traceback (most recent call last): File "D:\代码\ResnetGPT-master\训练数据截取_A.py", line 5, in from Batch import create_masks File "D:\代码\ResnetGPT-master\Batch.py", line 32, in class MyIterator(data.Iterator): AttributeError: module 'torchtext.data' has no attribute 'Iterator'

    显示在class MyIterator(data.Iterator):这个类里面没有iterator属性,求解

    opened by CSong98 2
  • AttributeError: module 'torchtext.data' has no attribute 'Iterator'

    AttributeError: module 'torchtext.data' has no attribute 'Iterator'

    C:\Users\Administrator>python D:\ai\ResnetGPT-master\训练数据截取_A.py Traceback (most recent call last): File "D:\ai\ResnetGPT-master\训练数据截取_A.py", line 5, in from Batch import create_masks File "D:\ai\ResnetGPT-master\Batch.py", line 32, in class MyIterator(data.Iterator): AttributeError: module 'torchtext.data' has no attribute 'Iterator'

    使用miniconda安装的环境,python3.7 ,torchtext-0.9.1,torchvision 等,请问这个报错是什么原因?库的版本问题么

    opened by cccisbug 2
  • 大佬好 请问权限报错是为什么?

    大佬好 请问权限报错是为什么?

    C:\Users\25634\Desktop\深度学习\venv\Scripts\python.exe C:/Users/25634/Desktop/深度学习/训练数据截取_A.py 2021-01-22 17:06:03.123 | INFO | pyminitouch.utils:is_device_connected:56 - device AQM-AL10 online 2021-01-22 17:06:03.123 | INFO | pyminitouch.connection:init:87 - searching a usable port ... 2021-01-22 17:06:05.137 | INFO | pyminitouch.connection:init:89 - device GEY6R20327000152 bind to port 20850 2021-01-22 17:06:05.212 | INFO | pyminitouch.connection:get_abi:35 - device GEY6R20327000152 is arm64-v8a 2021-01-22 17:06:05.285 | INFO | pyminitouch.connection:init:27 - minitouch already existed in GEY6R20327000152 2021-01-22 17:06:05.286 | DEBUG | pyminitouch.connection:_forward_port:128 - forward command: adb -s GEY6R20327000152 forward tcp:20850 localabstract:minitouch 2021-01-22 17:06:05.325 | DEBUG | pyminitouch.connection:_forward_port:130 - output: b'20850\r\n' 2021-01-22 17:06:05.326 | INFO | pyminitouch.connection:_start_mnt:141 - start minitouch: adb -s GEY6R20327000152 shell /data/local/tmp/minitouch open: Permission denied Unable to open device /dev/input/mice for inspectionopen: Permission denied Unable to open device /dev/input/mouse0 for inspectionopen: Permission denied Unable to open device /dev/input/event2 for inspectionopen: Permission denied Unable to open device /dev/input/event3 for inspectionopen: Permission denied Unable to open device /dev/input/event1 for inspectionopen: Permission denied Unable to open device /dev/input/event4 for inspectionopen: Permission denied Unable to open device /dev/input/event0 for inspectionUnable to find a suitable touch device Traceback (most recent call last): File "C:/Users/25634/Desktop/深度学习/训练数据截取_A.py", line 186, in 设备 = MyMNTDevice(_DEVICE_ID) File "C:\Users\25634\Desktop\深度学习\运行辅助.py", line 10, in init MNTDevice.init(self,ID) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\pyminitouch\actions.py", line 117, in init self.start() File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\pyminitouch\actions.py", line 125, in start self.server = MNTServer(self.device_id) File "C:\Users\25634\Desktop\深度学习\venv\lib\site-packages\pyminitouch\connection.py", line 103, in init ), "minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11" AssertionError: minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11

    opened by 2563411574 2
  • 奇怪的报错,是否因为pytorch1.9版本太高了?

    奇怪的报错,是否因为pytorch1.9版本太高了?

    > C:\Users\gavin\.conda\envs\PyTorch19_GPU_Py38\python.exe "D:/@3 深度学习/案例/@6 WZCQ-main 用强化学习训练AI玩王者荣耀/WZCQ-main/训练数据截取_A.py" loading pretrained weights... Traceback (most recent call last): File "D:/@3 深度学习/案例/@6 WZCQ-main 用强化学习训练AI玩王者荣耀/WZCQ-main/训练数据截取_A.py", line 50, in <module> 智能体 = 智能体(动作数=7, 并行条目数=条数, File "D:\@3 深度学习\案例\@6 WZCQ-main 用强化学习训练AI玩王者荣耀\WZCQ-main\模型_策略梯度.py", line 268, in __init__ model = get_model(config, 130, 模型名称) File "D:\@3 深度学习\案例\@6 WZCQ-main 用强化学习训练AI玩王者荣耀\WZCQ-main\模型_策略梯度.py", line 88, in get_model model.load_state_dict(torch.load(f'{opt.load_weights}/' + model_weights)) File"C:\Users\gavin.conda\envs\PyTorch19_GPU_Py38\lib\site-packages\torch\serialization.py",` line 600, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "C:\Users\gavin.conda\envs\PyTorch19_GPU_Py38\lib\site-packages\torch\serialization.py", line 242, in init super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

    Process finished with exit code 1`

    opened by gavin231mao 1
  • 启动出现torch.cuda.is_available()=False等问题的解决方案

    启动出现torch.cuda.is_available()=False等问题的解决方案

    如果是cuda启动不了可以尝试吧代码里的 “ cuda(device) ” 换成 “ cpu() ” 需要更改的文件大概有三个,改完运行就可以了 ( ❛⃘ ∨ ❜⃘⃘ )੭⁂

    修改完之后可能造成无法自动启动“ scrcpy ”,没启动scrcpy那就先手动启动scrcpy在执行“训练数据截取_A.py”

    项目运行环境不一定并没有主页描述的那么高,cpu-i3-8100显卡英达伟1G都跑得起来ヾ(Ő∀Ő๑)ノ

    opened by qyjava 1
  • 我想请教一下这个报错,不太熟悉这个,想请教一下torchtext.data' has no attribute 'Iterator

    我想请教一下这个报错,不太熟悉这个,想请教一下torchtext.data' has no attribute 'Iterator

    Traceback (most recent call last): File "F:\python\python_honorAI\训练数据截取_A.py", line 5, in from Batch import create_masks File "F:\python\python_honorAI\Batch.py", line 31, in class MyIterator(data.Iterator): AttributeError: module 'torchtext.data' has no attribute 'Iterator'

    opened by hl123-123 2
  • 关于android10之后minitouch的兼容问题

    关于android10之后minitouch的兼容问题

    很不错的想法,谢谢使用 pyminitouch :)

    回应下android Q 之后不能使用的问题:

    • minitouch 本身是需要编译使用的
    • pyminitouch 目前直接采用了三方预编译的仓库,而仓库并没有及时更新导致了 android q 之后的文件都找不到
    • 如果需要使用,可以在新的仓库找到你需要的 so 文件。后续有空我再将so同步过去吧,当然如果有好心人有空PR下最好了
    • 或者直接在这里改一下仓库地址试试:https://github.com/williamfzc/pyminitouch/blob/38eaa5443d380a9d1161697b70ec4c454951ab06/pyminitouch/config.py#L15

    各种链接:

    • 现仓库地址:https://github.com/williamfzc/stf-binaries
    • 新仓库地址:https://github.com/openatx/stf-binaries
    • pyminitouch:https://github.com/williamfzc/pyminitouch
    opened by williamfzc 1
  • 在运行处理训练数据5.py文件的时出现ByteTensor和FloatTensor不统一的问题

    在运行处理训练数据5.py文件的时出现ByteTensor和FloatTensor不统一的问题

    问题如下 RuntimeError: Input type (torch.cuda.ByteTensor) and weight type (torch.cuda.FloatTensor) should be the same

    解决方法: 在 _,out = resnet101(img2)这一行前面加上img2=img2.float(),一共有2出

    opened by junasir 0
Owner
冯泉荔
冯泉荔