MaaXYZ / MaaFramework

基于图像识别的自动化黑盒测试框架 | An automation black-box testing framework based on image recognition
GNU Lesser General Public License v3.0
1.46k stars 173 forks source link

NeuralNetworkDetect 在识别的时候发生闪退 #281

Closed hanhuoer closed 3 months ago

hanhuoer commented 3 months ago

情况是这样

昨天,用自己训练的模型出现过这种情况,以为是模型有什么问题,就放下了

今天,尝试用 yolov8 官方提供的 yolov8n.pt 模型,转到 onnx 之后继续,发现还是会闪退

日志级别设置的是 7,没看出来是啥情况,你们有遇到过吗

模型转换命令

yolo export model=yolov8n.pt format=onnx

运行环境

代码片段

压缩包内包含 maa.log

resource.zip

├─.nicegui
├─config
├─debug
│  └─recording
│      └─screenshot
├─image
├─model
│  └─detect
└─pipeline

pipeline

{
    "检测并点击": {
        "action": "Click",
        "recognition": "NeuralNetworkDetect",
        "model": "yolov8n.onnx",
        "cls_size": 80,
        "labels": ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"],
        "expected": [0, 5]
    }
}

重现过程

  1. 打开模拟器
  2. 打开相册
  3. 打开 yolo 提供的 bus.jpg 图片
  4. 启动 maadebugger
  5. 连接 -> 加载资源 -> 运行任务
  6. 闪退

我录了整个过程的 GIF 图贴上来

右下角是 MUMU 12 模拟器

重现过程

MistEO commented 3 months ago

你这个模型输入应该是 640 * 640?把 ROI 设一下设成这么大

hanhuoer commented 3 months ago

你这个模型输入应该是 640 * 640?把 ROI 设一下设成这么大

确实,改完 ROI 可以正常运行了

如果这样用,感觉是不是只能做局部识别

那...现在想要实现全屏识别,是不是在训练模型的时候就要考虑好设备尺寸,以兼容 MaaFramework 。

未来,会考虑兼容模型做全屏识别吗?

{
    "检测并点击": {
        "action": "Click",
        "roi": [0, 0, 640, 640],
        "recognition": "NeuralNetworkDetect",
        "model": "yolov8n.onnx",
        "cls_size": 80,
        "labels": ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"],
        "expected": [0]
    }
}

Hit: Rect(x=52, y=534, w=111, h=105)

检测并点击_2_2024 07 15-15 28 41 0636574

MistEO commented 3 months ago

可以支持下,resize 下就好了,回头加一个

hanhuoer commented 3 months ago

可以支持下,resize 下就好了,回头加一个

那太好了