paddle-lite运行ppyolo或yolov3的推断时闪退且无任何报错
收藏
在安卓的demo上有同样问题,将PP-YOLO tiny的量化模型使用:
./opt_linux --model_file=ppyolo_tiny_quant/__model__ --param_file=ppyolo_tiny_quant/__params__ --optimize_out=model
转换成nb格式后替换到yolo_detection_demo中能正常运行。
但如果是普通PP-YOLO tiny模型,使用
python tools/export_model.py -c configs/ppyolo/ppyolo_tiny_650e_coco.yml ./opt_linux --model_file=ppyolo_tiny_650e_coco/model.pdmodel --param_file=ppyolo_tiny_650e_coco/model.pdiparams --optimize_out=model
转换成nb格式模型再替换进去,然后修改输入如下:
void Detector::Preprocess(const cv::Mat &rgbaImage) { // Set the data of input image auto inputTensor = predictor_->GetInput(1); std::vector inputShape = {1, 3, inputHeight_, inputWidth_}; inputTensor->Resize(inputShape); auto inputData = inputTensor->mutable_data(); cv::Mat resizedRGBAImage; cv::resize(rgbaImage, resizedRGBAImage, cv::Size(inputShape[3], inputShape[2])); cv::Mat resizedRGBImage; cv::cvtColor(resizedRGBAImage, resizedRGBImage, cv::COLOR_BGRA2RGB); resizedRGBImage.convertTo(resizedRGBImage, CV_32FC3, 1.0 / 255.0f); NHWC3ToNC3HW(reinterpret_cast(resizedRGBImage.data), inputData, inputMean_.data(), inputStd_.data(), inputShape[3], inputShape[2]); // Set the size of input image auto sizeTensor = predictor_->GetInput(0); sizeTensor->Resize({1, 2}); auto sizeData = sizeTensor->mutable_data(); sizeData[0] = inputShape[3]; sizeData[1] = inputShape[2]; auto scaleTensor = predictor_->GetInput(2); sizeTensor->Resize({1, 2}); auto scaleData = sizeTensor->mutable_data(); scaleData[0] = 1; scaleData[1] = 1; }
程序运行到`predictor_->Run();`后会直接闪退且没有任何报错。
都是表中同一行的模型:PP-YOLO tiny模型
替换到使用Java API的object_detection_demo中也同样如此。
试了下其他的PP-YOLO模型也会这样,YOLOv3也是,都是运行到`PaddlePredictor->Run()`会直接闪退且没有错误信息。
在paddle-lite上运行有什么特别的要求吗,为什么PP-YOLO tiny的量化模型能运行,它对应的普通模型就不行?
即使是有问题也应该给个错误信息啊,现在却没有任何报错。
posted by @tinggg12345 in https://github.com/PaddlePaddle/Paddle-Lite/issues/6752#issue-977652942
0
收藏
请登录后评论
你好,我也遇到同样的问题了,我训练的ppyolo tiny模型放到android demo里面运行就闪退。你前面说的量化模型是怎么来的,我用export_model.py 导出的就是 mode.pdmodel和model.pdiparams文件啊,怎么生成你说的__model__ 文件?