Skip to content

OpenCV DNN_TARGET_NPU not supported exception in dnn target validation #26240

@huilam

Description

@huilam

System Information

OpenCV version: 4.10.0
Operating System / Platform: Ubuntu 22.04
Compiler & compiler version: Java JDK 11

Detailed description

== OnnxModel from ==
https://github.com/opencv/opencv_zoo/blob/main/models/human_segmentation_pphumanseg/human_segmentation_pphumanseg_2023mar.onnx

== Working For ==
Dnn Backend : 2 (DNN_BACKEND_INFERENCE_ENGINE)
Dnn Target : 1 (DNN_TARGET_OPENCL)

== Error When ==
Dnn Backend : 2 (DNN_BACKEND_INFERENCE_ENGINE)
Dnn Target : 9 (DNN_TARGET_NPU)

Throw following Exception :

Unknown OpenVINO target:
'preferableTarget == DNN_TARGET_CPU || preferableTarget == DNN_TARGET_OPENCL || preferableTarget == DNN_TARGET_OPENCL_FP16 || preferableTarget == DNN_TARGET_MYRIAD || preferableTarget == DNN_TARGET_HDDL || preferableTarget == DNN_TARGET_FPGA'
where
'(int)preferableTarget' is 9
]

Steps to reproduce

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.opencv.core.Mat;
import org.opencv.dnn.Dnn;
import org.opencv.dnn.Net;

import hl.opencv.util.OpenCvUtil;

public class Test {

public static void main(String[] args)
{
	OpenCvUtil.initOpenCV();
	
	File fileOnnx = new File("./human_segmentation_pphumanseg_2023mar.onnx");
	Net net = Dnn.readNetFromONNX(fileOnnx.getAbsolutePath());
	net.setPreferableBackend(Dnn.DNN_BACKEND_INFERENCE_ENGINE);
	net.setPreferableTarget(Dnn.DNN_TARGET_NPU);
	
	// Run inference
	List<Mat>outputs = new ArrayList<>();
	net.forward(outputs, net.getUnconnectedOutLayersNames());

			
}

}

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions