result is empty when run_model=2(openpose)
duoduo1018 opened this issue · 11 comments
“prepare about 1000 images serialize it to 3480640 vector then put it into calibratorData. ” But the result is still empty. like this link #24
calibratorData.resize(fileNames.size());
for (size_t i = 0; i < calibratorData.size(); i++)
{
calibratorData[i].resize(3 * H * W);
cv::Mat img0 = cv::imread(fileNames[i]);
if (img0.empty())
{
std::cout << "error: can not read image" << std::endl;
return -1;
}
//image Process
cv::cvtColor(img0, img0, cv::COLOR_BGR2RGB);
cv::resize(img0, img0, cv::Size(W, H));//cv::Size(640, 480)
//get image data
std::vector<float> inputData = GetInputData(img0, 1, C, H, W);
//
calibratorData[i] = inputData;
img0.release();
}
//Get image data
std::vector GetInputData(const cv::Mat& img, int N, int C, int H, int W)
{
// int N = 1;
// int C = 3;
// int H = 480;
// int W = 640;
std::vector inputData;
inputData.resize(N * C * H * W);
unsigned char* data = img.data;
for (int n = 0; n < N; n++)
{
for (int c = 0; c < C; c++)
{
for (int i = 0; i < W * H; i++)
{
inputData[i + c * W * H + n * C * H * W] = (float)data[i * C + c];
}
}
}
return inputData;
}
- Does the calibration success?
- could you paste the cmake log and running log?
Hi @duoduo1018 did you solve your problem? I don't have time to debug your problem these days due to work reason. I read the log seems the running is normal, did you pre-process your calibrate data before you pass it to the calibrator as you did on the test image?
I did some processing, but I don’t know if it’s right.
//image Process
cv::cvtColor(img0, img0, cv::COLOR_BGR2RGB);
cv::resize(img0, img0, cv::Size(W, H));//cv::Size(640, 480)
I did some processing, but I don’t know if it’s right.
Try normalize the calibrator data like
https://github.com/zerollzeng/tensorrt-zoo/blob/238c83103bb97aa799ebc67f4dee583e1939fe20/openpose/OpenPose.cu#L93\
to rgb -> resize -> normalize
to rgb -> resize -> normalize
Thank you very, very much. Now I can get the result.
@duoduo1018 how about the speed? can you post a comparison?
does 1000 images sufficient for openpose? I never done this before