如何生成ground truth?
liu6381810 opened this issue · 3 comments
您好
我想请问下如何生成PAF的ground truth
在论文中,如何判断一个点是否在limb上,有一个参数是控制
垂直方向的距离的,但是没有明确说是多少。
我在你的这个函数putVecMaps
里看到了一个阈值1
如果我理解不错的话dist = np.absolute(ba_x * bc_y - ba_y * bc_x)
计算的是
垂直方向的距离。
那么阈值只有1个像素点不是会很小吗?还是我的理解有问题。
谢谢!!
刚才又去看了下代码,发现是除以8以后的1个像素,那对应回原图大概两边加起来就是16?不知道这样理解对不对?
Yes, I followed the original code https://github.com/CMU-Perceptual-Computing-Lab/caffe_train/blob/master/src/caffe/cpm_data_transformer.cpp#L1106. But I don't know if there is a better way. I checked the generated paf in some images. Some are not good, maybe because the human size varies.
for (int g_y = min_y; g_y < max_y; g_y++){
for (int g_x = min_x; g_x < max_x; g_x++){
Point2f ba;
ba.x = g_x - centerA.x;
ba.y = g_y - centerA.y;
float dist = std::abs(ba.x*bc.y -ba.y*bc.x);
// float A = cosine * (g_x - x_p) + sine * (g_y - y_p);
// float B = sine * (g_x - x_p) - cosine * (g_y - y_p);
// float judge = A * A / a_sqrt + B * B / b_sqrt;
if(dist <= thre){
//if(judge <= 1){
int cnt = count.at<uchar>(g_y, g_x);
//LOG(INFO) << "putVecMaps here we start for " << g_x << " " << g_y;
if (cnt == 0){
entryX[g_y*grid_x + g_x] = bc.x;
entryY[g_y*grid_x + g_x] = bc.y;
}
else{
entryX[g_y*grid_x + g_x] = (entryX[g_y*grid_x + g_x]*cnt + bc.x) / (cnt + 1);
entryY[g_y*grid_x + g_x] = (entryY[g_y*grid_x + g_x]*cnt + bc.y) / (cnt + 1);
count.at<uchar>(g_y, g_x) = cnt + 1;
}
}
}
@dragonfly90 Thanks for you reply.
I generate the ground truth followed the same code.
But the question is for the heat map, the size is 46*46, but only a few points set to values > 0 with all other points set to 0. When I use these data to train the network, it tends to predict all the points to 0 and even so the loss is very low because we use mse loss. So is there any trick in the training procedure?
I would appreciate it if you can give me any advice. Thanks!