现在的版本已经将variable和tenosr合并,所以只用torch.max(a,1).numpy()就可以了。 准确率的计算 pred_y = torch.max(predict, 1)[1].numpy() label_y = torch.max(label, 1)[1].data.numpy() accuracy = (pred_y == label_y).sum() / len(label_y) predict- softmax函数输出 label- 样本标...
Returns: List[float]: A list of top-k accuracy values. """ maxk = max(topk) batch_size = target.size(0) # (N,C) # 获取预测分数最高的 k 个索引 values, indices = output.topk(maxk, 1, True, True) indices = indices.t() # 转置以适应 target 的形状 (N,K)->(K,N) expand...
self.correct_count += correct.sum() 开发者ID:Jordan-Sauchuk,项目名称:allennlp,代码行数:45,代码来源:categorical_accuracy.py
File "main.py", line 192, in train prec1, prec5 = accuracy(output.data, target, topk=(1,5)) File "main.py", line 329, in accuracy _, pred = output.topk(maxk, 1, True, True) RuntimeError: invalid argument 5: k not in range for dimension at /pytorch/torch/lib/THC/generic/...
CenterNet achieves the best speed-accuracy trade-off on the MS COCO dataset, with 28.1% AP at 142 FPS, 37.4% AP at 52 FPS, and 45.1% AP with multi-scale testing at 1.4 FPS. We use the same approach to estimate 3D bounding box in the KITTI benchmark and human pose on the COCO ...