gpt4 book ai didi

c++ - Intel NCS2 vpu不支持动态批处理

转载 作者:行者123 更新时间:2023-12-02 10:20:55 24 4
gpt4 key购买 nike

我试图在Intel Neural Compute Stick硬件上运行FP16 person-detection-retail-0013和person-reidentification-retail-0079,但是一旦我运行应用程序以将网络加载到设备上,就会出现以下异常:

[INFERENCE ENGINE EXCEPTION] Dynamic batch is not supported

我将最大批处理大小设置为1加载了网络,并从行人跟踪器演示开始了我的项目,进入了OpenVINO工具包:

main.cpp-> CreatePedestrianTracker
    CnnConfig reid_config(reid_model, reid_weights);
reid_config.max_batch_size = 16;

try {
if (ie.GetConfig(deviceName, CONFIG_KEY(DYN_BATCH_ENABLED)).as<std::string>() !=
PluginConfigParams::YES) {
reid_config.max_batch_size = 1;
std::cerr << "[DEBUG] Dynamic batch is not supported for " << deviceName << ". Fall back
to batch 1." << std::endl;
}
}
catch (const InferenceEngine::details::InferenceEngineException& e) {
reid_config.max_batch_size = 1;
std::cerr << e.what() << " for " << deviceName << ". Fall back to batch 1." << std::endl;
}

Cnn.cpp->无效CnnBase::InferBatch
void CnnBase::InferBatch(
const std::vector<cv::Mat>& frames,
std::function<void(const InferenceEngine::BlobMap&, size_t)> fetch_results) const {
const size_t batch_size = input_blob_->getTensorDesc().getDims()[0];

size_t num_imgs = frames.size();
for (size_t batch_i = 0; batch_i < num_imgs; batch_i += batch_size) {

const size_t current_batch_size = std::min(batch_size, num_imgs - batch_i);

for (size_t b = 0; b < current_batch_size; b++) {
matU8ToBlob<uint8_t>(frames[batch_i + b], input_blob_, b);
}

if ((deviceName_.find("MYRIAD") == std::string::npos) && (deviceName_.find("HDDL") ==
std::string::npos)) {
infer_request_.SetBatch(current_batch_size);
}

infer_request_.Infer();

fetch_results(outputs_, current_batch_size);
}
}

我想问题可能出在检测网络的拓 flutter 结构上,但是我问是否有人遇到过同样的问题并解决了问题。
谢谢。

最佳答案

恐怕,无数插件不支持动态批处理。请尝试该演示的更新版本。您可以在这里找到它,例如:https://github.com/opencv/open_model_zoo/tree/master/demos/pedestrian_tracker_demo
该演示已更新为完全不使用动态批处理。

关于c++ - Intel NCS2 vpu不支持动态批处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60227602/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com