Closed Guptajakala closed 5 years ago
Oh, it's due to tiny differences of float between gpu and cpu. When casting to int, it may have a diff of 1, so totally same assertion is too strong here. This problem tends to come out if we have 100 rand poses. You can check this by putting these codes before assertion:
for(size_t i=0; i<mat4_v.size(); i++){
int diff_v = std::accumulate(result_diff.data() + i*height*width,
result_diff.data() + (i+1)*height*width, 0);
if(diff_v > 0){
std::cout << "test: " << diff_v << std::endl;
cv::Mat depth = cv::Mat(height, width, CV_32SC1, result_diff.data() + i*height*width);
cv::imshow("diff_mask", depth>0);
cv::waitKey(0);
}
}
@meiqua
This is the problem. Thank you!
When I change the code here
Then the result of GPU and CPU is different. Is there anything I'm doing wrong?