FashionAI_Keypoints icon indicating copy to clipboard operation
FashionAI_Keypoints copied to clipboard

i find a bug in submit.py hope you can fix it

Open GuanlinLee opened this issue 6 years ago • 17 comments

when i use a trained model of FPN,submit.py have an error called

p4_out = torch.add(self.P4_conv1(C4), F.upsample(p5_out, scale_factor=2)) RuntimeError: The size of tensor a (23) must match the size of tensor b (24) at non-singleton dimension 3

i think something wrong when put the pics into model hope you can fix it

GuanlinLee avatar Mar 28 '18 01:03 GuanlinLee

please change your test size from 368 to 384, because 368 could not be divided by 32. :)

Xiangyu-CAS avatar Mar 28 '18 10:03 Xiangyu-CAS

its already fixed to 384,i tried to find out but it still cant work btw,im using py3 instead of py2.can this cause the error?

GuanlinLee avatar Mar 29 '18 01:03 GuanlinLee

it is ok to use py3. The error (23 vs 24) is caused by shape miss match in concat. The shape of C4 is 368/16=23, while shape of p5 is 23/2=12 and shape of p5_upsample is 12*2=24. If you have change test size correctly, the exact size of C4 should be 384/16=24.

Xiangyu-CAS avatar Mar 30 '18 09:03 Xiangyu-CAS

so, if this kind of error still occurs on your project, it means you failed to change test size

Xiangyu-CAS avatar Mar 30 '18 09:03 Xiangyu-CAS

Try to replace util.padRightDownCorner(imageToTest, stride, 128) to
util.padRightDownCorner(imageToTest, 32, 128). I will update this project later.

Xiangyu-CAS avatar Mar 30 '18 09:03 Xiangyu-CAS

@Xiangyu-CAS I have one question about the heatmap. In your project, the code as following, def _generate_heatmap(img, kpt, stride, sigma): height, width, _ = img.shape heatmap = np.zeros((height / stride, width / stride, len(kpt) + 1), dtype=np.float32) # (24 points + background) height, width, num_point = heatmap.shape start = stride / 2.0 - 0.5

num = len(kpt)
for i in range(num):
	**if kpt[i][2] == -1:  # not labeled 
		continue**
	x = kpt[i][0]
	y = kpt[i][1]
	for h in range(height):
		for w in range(width):
			xx = start + w * stride
			yy = start + h * stride
			dis = ((xx - x) * (xx - x) + (yy - y) * (yy - y)) / 2.0 / sigma / sigma  # the function of the dis
			if dis > 4.6052:
				continue
			heatmap[h][w][i] += math.exp(-dis)
			if heatmap[h][w][i] > 1:
				heatmap[h][w][i] = 1

**heatmap[:, :, -1] = 1.0 - np.max(heatmap[:, :, :-1], axis=2)  # for background**
return heatmap

I'm confused by getting the heatmap. My question is , if one picture only has 13 keypoints (the number of the total keypoints ), and the batch_size is 1. I want to know which number is the ground truth(or the ground truth heatmap). The number is 24+1 or 13+1 ?? Looking forward any answers. Thanks.

Ai-is-light avatar Mar 31 '18 03:03 Ai-is-light

@Ai-is-light There are several categories in dataset, 24 + 1 classes is designed for all kinds of pictures. If one picture only have 13 keypoints, the other keypoint heatmaps (24-13) should be blank.

In my solution, I used one model to predict all these 5 categories for convinient, but you could get a more decent performance by training several models for each kind. We have got 7% in leaderboard by ensembling 5 models.

Xiangyu-CAS avatar Mar 31 '18 20:03 Xiangyu-CAS

Good score! Thanks for sharing your idea, I did that for the baseline. I have been training 5 models for each class during long time training. But, there are some question .Firstly, I upload my results without following the order of the test.csv, and ; secondly, when I test the dress-class , I directly set the other keypoints which are not included in the dress-class, like the keypoints of trousers set -1_-1_-1. However, I got the answer of the system is invalid upload result. When you ensemble 5 models, taking the dress class as an example, did you directly set the trousers of -1_-1_-1? Looking forward any answers. Thanks.

Ai-is-light avatar Apr 05 '18 09:04 Ai-is-light

@Ai-is-light My test results followed the exact order of test.csv. I am not very clear about your statements, when you test dress-class, you don't need to deal with other classes, because every class has a corresponding model.

Xiangyu-CAS avatar Apr 05 '18 13:04 Xiangyu-CAS

这比赛你还在做吗

argman avatar Apr 09 '18 02:04 argman

@argman 当业余爱好在做。。。你是旷视文字组的么。。。

Xiangyu-CAS avatar Apr 09 '18 02:04 Xiangyu-CAS

@Xiangyu-CAS 不是啊,也是业余选手:)

argman avatar Apr 09 '18 03:04 argman

@argman 好吧,hh,我去年也做了一段时间文字检测,当时还看了下你的EAST实现,感觉 ID好眼熟。你要也参加的话可以交流交流。。。

Xiangyu-CAS avatar Apr 09 '18 06:04 Xiangyu-CAS

@Xiangyu-CAS modidy.py 是啥用的?

hongge831 avatar Apr 10 '18 02:04 hongge831

@hongge831 漏检的惩罚权重较大,modify是为了投机取巧的。如果两个对称点里面漏了一个,那么自动按照中心对称原则计算出另一个点。事实证明用modify了之后,评测性能提升了

Xiangyu-CAS avatar Apr 10 '18 03:04 Xiangyu-CAS

@Xiangyu-CAS 您好,请问预测点是否可见是怎么判断的呢?

hongge831 avatar Apr 10 '18 11:04 hongge831

@hongge831 不管可不可见,都置为1

Xiangyu-CAS avatar Apr 10 '18 13:04 Xiangyu-CAS