zerollzeng / tensorrt-zoo

openpose, yolov3 with tiny-tensorrt
86 stars 25 forks source link

代码不全 #27

Closed shuxuzhipeng closed 4 years ago

shuxuzhipeng commented 4 years ago

缺少util.h 也没有nvdsinfer_custombboxparser.cu, 我处理推理结果的时候 只是把 57个特征图还原成原图大小, 再去找每一个的最大值, 可是这样的结果 和关键点对不上,请问是处理的方式不对,还是有可能 。engine 或者tensorrt 推理可能有问题? 能发一遍完整的代码吗,想运行出你的效果

zerollzeng commented 4 years ago

can you post more information? for openpose the post processing code include in this repo.

shuxuzhipeng commented 4 years ago

std::vector net_output; net_output.resize(78 60 80); / Find the output layer / static int outputLayerIndex = -1; if (outputLayerIndex == -1) { for (unsigned int i = 0; i < outputLayersInfo.size(); i++) { if (strcmp(outputLayersInfo[i].layerName, "net_output") == 0) { outputLayerIndex = i; break; } } if (outputLayerIndex == -1) { std::cerr << "Could not find net_output layer buffer while parsing" << std::endl; return false; } } memcpy((void)outputLayersInfo[outputLayerIndex].buffer, (void)(net_output.data()), 78 60 80 * 4); i cant understand, why u copy the new pointer to outputlayer. The outputLaysInfo store the results of inference, isn't that? and after this, u dont treat it any more? so i cant understand how u treat the results of inference of tensorrt

shuxuzhipeng commented 4 years ago

float netOutput = (float ) outputLayersInfo[outputLayerIndex].buffer; int sizes[] = {46,46}; std::vector netOutputParts; std::cout<<"netOutput "<< netOutput<<std::endl; std::cout<<"netOutput "<< ++netOutput<<std::endl; std::cout<<"netOutput "<< --netOutput<<std::endl; for(int i=0; i<18; i++){ cv::Mat MatKeypoint(2,sizes,CV_32FC1, netOutput + i4646); std::cout<<"pointer "<< (netOutput + i4646)<<std::endl; cv::Mat resizedPart; cv::resize(MatKeypoint,resizedPart,cv::Size(333,500)); netOutputParts.push_back(resizedPart); } std::vector keyPoints; for(int i=0; i<18; ++i){ //std::vector keyPoints; double maxVal; cv::Point maxLoc; cv::minMaxLoc(netOutputParts[i],0,&maxVal,0,&maxLoc); keyPoints.push_back(KeyPoint(i, maxVal,maxLoc, netOutputParts[i].at(maxLoc.y,maxLoc.x))); } i treat the result like this, but i cant get the correct point. ![Screenshot from 2020-07-22

Screenshot from 2020-07-20 00-46-49

shuxuzhipeng commented 4 years ago

`In file included from /home/ctc/openpose/tensorrt-zoo/openpose/nvdsinfer_openpose_engine.cpp:2:0: /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:7:10: fatal error: Trt.h: No such file or directory

include "Trt.h"

      ^~~~~~~

compilation terminated. CMakeFiles/testopenpose.dir/build.make:110: recipe for target 'CMakeFiles/testopenpose.dir/nvdsinfer_openpose_engine.cpp.o' failed make[2]: [CMakeFiles/testopenpose.dir/nvdsinfer_openpose_engine.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/testopenpose.dir/all' failed make[1]: [CMakeFiles/testopenpose.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 ` i cant make neither

zerollzeng commented 4 years ago

please use some code block for readability, and can you run the correct result with testopenpose?

zerollzeng commented 4 years ago

take a look at https://github.com/zerollzeng/tensorrt-zoo/blob/master/docs/openpose.md and https://github.com/zerollzeng/tensorrt-zoo/blob/master/README.md please make sure your meet all the installation requirements.

shuxuzhipeng commented 4 years ago

`
float netOutput = (float ) outputLayersInfo[outputLayerIndex].buffer;

    int sizes[] = {46,46};
std::vector<cv::Mat> netOutputParts;
for(int i=0; i<18; i++){
    cv::Mat MatKeypoint(2,sizes,CV_32FC1, netOutput + i*46*46);
    std::cout<<"pointer "<< (netOutput + i*46*46)<<std::endl;
    cv::Mat resizedPart;
    cv::resize(MatKeypoint,resizedPart,cv::Size(333,500));
    //cv::Mat smoothProbMap; no difference
    //cv::GaussianBlur(resizedPart,smoothProbMap,cv::Size(3,3),0,0);
    netOutputParts.push_back(resizedPart);
}
std::vector<KeyPoint> keyPoints;
for(int i=0; i<18; ++i){
    //std::vector<KeyPoint> keyPoints;
    double maxVal;
    cv::Point maxLoc;
    cv::minMaxLoc(netOutputParts[i],0,&maxVal,0,&maxLoc);
    keyPoints.push_back(KeyPoint(i, maxVal,maxLoc, netOutputParts[i].at<float>(maxLoc.y,maxLoc.x)));
}`

this is my solution to treat output info, i cant pass the compile the error is /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:78:147: error: void value not ignored as it ought to be caffeModel, saveEngine, outputBlobName, maxBatchSize, runMode, calibratorData); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu: In member function ‘void OpenPose::DoInference(std::vector<float>&, std::vector<float>&)’: /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:114:16: error: expected primary-expression before ‘<’ token Normalize<<<numBlocks, 512 , 0>>>((float*)mpInputGpu); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:114:37: error: expected primary-expression before ‘>’ token Normalize<<<numBlocks, 512 , 0>>>((float*)mpInputGpu); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:142:27: error: expected primary-expression before ‘<’ token op::resizeKernel<<<numBlocks, threadsPerBlock>>>((float*)mpResizeMapGpu,(float*)mpHeatMapGpu,widthSouce,heightSource,widthTarget,heightTarget); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:142:56: error: expected primary-expression before ‘>’ token op::resizeKernel<<<numBlocks, threadsPerBlock>>>((float*)mpResizeMapGpu,(float*)mpHeatMapGpu,widthSouce,heightSource,widthTarget,heightTarget);

shuxuzhipeng commented 4 years ago

take a look at https://github.com/zerollzeng/tensorrt-zoo/blob/master/docs/openpose.md and https://github.com/zerollzeng/tensorrt-zoo/blob/master/README.md please make sure your meet all the installation requirements.

im sure i got all the requirements, i use the jetson xavier nx.

shuxuzhipeng commented 4 years ago

` float netOutput = (float ) outputLayersInfo[outputLayerIndex].buffer;

    int sizes[] = {46,46};
std::vector<cv::Mat> netOutputParts;
for(int i=0; i<18; i++){
  cv::Mat MatKeypoint(2,sizes,CV_32FC1, netOutput + i*46*46);
  std::cout<<"pointer "<< (netOutput + i*46*46)<<std::endl;
  cv::Mat resizedPart;
  cv::resize(MatKeypoint,resizedPart,cv::Size(333,500));
  //cv::Mat smoothProbMap; no difference
  //cv::GaussianBlur(resizedPart,smoothProbMap,cv::Size(3,3),0,0);
  netOutputParts.push_back(resizedPart);
}
std::vector<KeyPoint> keyPoints;
for(int i=0; i<18; ++i){
  //std::vector<KeyPoint> keyPoints;
  double maxVal;
  cv::Point maxLoc;
  cv::minMaxLoc(netOutputParts[i],0,&maxVal,0,&maxLoc);
  keyPoints.push_back(KeyPoint(i, maxVal,maxLoc, netOutputParts[i].at<float>(maxLoc.y,maxLoc.x)));
}`

this is my solution to treat output info, i cant pass the compile the error is /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:78:147: error: void value not ignored as it ought to be caffeModel, saveEngine, outputBlobName, maxBatchSize, runMode, calibratorData); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu: In member function ‘void OpenPose::DoInference(std::vector<float>&, std::vector<float>&)’: /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:114:16: error: expected primary-expression before ‘<’ token Normalize<<<numBlocks, 512 , 0>>>((float*)mpInputGpu); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:114:37: error: expected primary-expression before ‘>’ token Normalize<<<numBlocks, 512 , 0>>>((float*)mpInputGpu); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:142:27: error: expected primary-expression before ‘<’ token op::resizeKernel<<<numBlocks, threadsPerBlock>>>((float*)mpResizeMapGpu,(float*)mpHeatMapGpu,widthSouce,heightSource,widthTarget,heightTarget); ^ /home/ctc/openpose/tensorrt-zoo/openpose/OpenPose.cu:142:56: error: expected primary-expression before ‘>’ token op::resizeKernel<<<numBlocks, threadsPerBlock>>>((float*)mpResizeMapGpu,(float*)mpHeatMapGpu,widthSouce,heightSource,widthTarget,heightTarget);

perhaps problem is u dont add nvcc compile? i guess, but i dont know how to add it in cmake file.

shuxuzhipeng commented 4 years ago

is there any other solutions?

zerollzeng commented 4 years ago

nah, this repo was mainly developed under desktop gpu, sry I can't help you with this since it's been a long time