赋值出错
Created by: zhengzhe97
paddle版本:1.7.1 想对这个loc_t进行赋值,但是出现了错误,是否有办法进行赋值 代码部分:
loc_t = fluid.layers.zeros([batch_size, num_priors, 4], 'float32')
gt_box_t = []
conf_t = []
idx_t = []
labels = []
for idx in range(batch_size):
num = gt_num[idx]
truths = gt_box[idx, 0:num]
labels.append(gt_class[idx, 0:num])
crowd_boxes = None
pos_threshold = 0.5
neg_threshold = 0.4
loc, conf, best_truth_idx = match_tensor(pos_threshold, neg_threshold,
truths, priors, labels[idx], crowd_boxes,
loc_t, conf_t, idx_t, idx)
loc_t[idx] = loc
错误如下
Traceback (most recent call last):
File "tools/train.py", line 323, in <module>
main()
File "tools/train.py", line 116, in main
train_fetches = model.train(feed_vars)
File "/home/aistudio/work/PaddleDetection-release-0.2/ppdet/modeling/architectures/yolactplus.py", line 98, in train
return self.build(feed_vars, 'train')
File "/home/aistudio/work/PaddleDetection-release-0.2/ppdet/modeling/architectures/yolactplus.py", line 88, in build
gt_box, gt_class, gt_segm, is_crowd, gt_num)
File "/home/aistudio/work/PaddleDetection-release-0.2/ppdet/modeling/anchor_heads/yolact_head.py", line 683, in get_loss
get_target_tensor(gt_box, priors, gt_class, is_crowd, gt_num, loc_data, batch_size, num_priors)
File "/home/aistudio/work/PaddleDetection-release-0.2/ppdet/modeling/anchor_heads/yolact_head.py", line 1385, in get_target_tensor
loc_t[idx] = loc
TypeError: 'Variable' object does not support item assignment