{
  "id": "opencv/dnn-readnet-from-onnx-parse-error",
  "signature": "cv2.error: OpenCV(4.8.0) /tmp/opencv-4.8.0/modules/dnn/src/onnx/onnx_importer.cpp:203: error: (-2:Unspecified error) Failed to parse ONNX model: No Op registered for 'NonMaxSuppression' with domain_version of 12 in function 'readNetFromONNX'",
  "signature_zh": "cv2.error: OpenCV(4.8.0) /tmp/opencv-4.8.0/modules/dnn/src/onnx/onnx_importer.cpp:203: error: (-2:未指定错误) 无法解析 ONNX 模型：在域版本 12 中未注册 'NonMaxSuppression' 操作 在函数 'readNetFromONNX' 中",
  "regex": "Failed to parse ONNX model.*No Op registered for.*domain_version",
  "domain": "opencv",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "ONNX model uses an operator (e.g., NonMaxSuppression) that is not supported by the OpenCV DNN module for the given opset version.",
  "root_cause_type": "generic",
  "root_cause_zh": "ONNX 模型使用了 OpenCV DNN 模块在给定操作集版本中不支持的操作符（例如 NonMaxSuppression）。",
  "versions": [
    {
      "version": "4.7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.10.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Downgrading OpenCV may remove support for newer ONNX opsets but won't add missing operators.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "ONNX Runtime is a separate inference engine; installing it doesn't modify OpenCV's DNN module.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Changing the model file name or path doesn't affect operator parsing.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Export the ONNX model with a lower opset version (e.g., 11) that includes all operators supported by OpenCV: `torch.onnx.export(model, dummy_input, 'model.onnx', opset_version=11)`",
      "success_rate": 0.75,
      "how": "Export the ONNX model with a lower opset version (e.g., 11) that includes all operators supported by OpenCV: `torch.onnx.export(model, dummy_input, 'model.onnx', opset_version=11)`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use OpenCV's DNN with a different backend like Intel OpenVINO: `net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)`",
      "success_rate": 0.7,
      "how": "Use OpenCV's DNN with a different backend like Intel OpenVINO: `net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Convert the ONNX model to a different format (e.g., TensorFlow SavedModel) and load with OpenCV's TensorFlow importer.",
      "success_rate": 0.65,
      "how": "Convert the ONNX model to a different format (e.g., TensorFlow SavedModel) and load with OpenCV's TensorFlow importer.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Export the ONNX model with a lower opset version (e.g., 11) that includes all operators supported by OpenCV: `torch.onnx.export(model, dummy_input, 'model.onnx', opset_version=11)`",
    "Use OpenCV's DNN with a different backend like Intel OpenVINO: `net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)`",
    "Convert the ONNX model to a different format (e.g., TensorFlow SavedModel) and load with OpenCV's TensorFlow importer."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga29f34df9376379a603acd8df581ac8d7",
  "official_doc_section": null,
  "error_code": "-2",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}