dangweili / pedestrian-attribute-recognition-pytorch

A simple baseline for pedestrian attribute recognition in surveillance scenarios
332 stars 80 forks source link

weight problem #16

Open litongxin666 opened 5 years ago

litongxin666 commented 5 years ago

weights = torch.zeros(targets_var.shape) for i in range(targets_var.shape[0]): for j in range(targets_var.shape[1]): if targets_var.data.cpu()[i, j] == -1: weights[i, j] = weight_neg[j] elif targets_var.data.cpu()[i, j] == 1:

if targets_var.data.cpu()[i, j] == -1: should be changed to targets_var.data.cpu()[i, j] == 0

dangweili commented 5 years ago

@litongxin666 I re-config the weight in train_deepmar_resnet50.py, line 344-352

abnercloud commented 4 years ago

Hello, @dangweili ,Thanks to the great codebase! I has some confusions as follow:

In train_deepmar_resnet50.py, line 355: targets_var[targets_var == -1] = 0 What is the meaning of this line?

In evaluate.py, line 45-46: pt_result[pt_result>=0] = 1 pt_result[pt_result<0] = 0 And, why do we use 0 here?

In demo.py, line 129, 137: if score[0, idx] >= 0: Why do we think that greater than 0 means this attribute?

abnercloud commented 4 years ago

criterion = F.binary_cross_entropy_with_logits After logits, do sigmoid operation. Therefore, 0 is the boundary?

abnercloud commented 4 years ago

What I am confused about is why the label is set to -1 when the data set is loaded.

abnercloud commented 4 years ago

What I am confused about is why the label is set to -1 when the data set is loaded.

Of course, 0 and -1 do not matter.