Too many indices (2) for tensor of dimension 1请问怎么解决
收藏
0.050307 loss_bbox_cls_stage1: 0.014719 loss_bbox_reg_stage1: 0.010405 loss_bbox_cls_stage2: 0.003506 loss_bbox_reg_stage2: 0.000950 loss: 0.181882 eta: 13:57:46 batch_cost: 1.3416 data_cost: 0.0002 ips: 0.7454 images/s
[05/24 23:35:20] ppdet.engine INFO: Epoch: [0] [300/560] learning_rate: 0.000301 loss_rpn_cls: 0.008877 loss_rpn_reg: 0.017190 loss_bbox_cls_stage0: 0.054097 loss_bbox_reg_stage0: 0.058181 loss_bbox_cls_stage1: 0.014931 loss_bbox_reg_stage1: 0.013839 loss_bbox_cls_stage2: 0.003676 loss_bbox_reg_stage2: 0.001843 loss: 0.188855 eta: 14:06:25 batch_cost: 1.3390 data_cost: 0.0003 ips: 0.7468 images/s
[05/24 23:37:22] ppdet.engine INFO: Epoch: [0] [400/560] learning_rate: 0.000401 loss_rpn_cls: 0.012049 loss_rpn_reg: 0.012965 loss_bbox_cls_stage0: 0.071150 loss_bbox_reg_stage0: 0.074250 loss_bbox_cls_stage1: 0.022468 loss_bbox_reg_stage1: 0.028261 loss_bbox_cls_stage2: 0.005516 loss_bbox_reg_stage2: 0.005390 loss: 0.246684 eta: 13:51:04 batch_cost: 1.2239 data_cost: 0.0003 ips: 0.8171 images/s
Traceback (most recent call last):
File "tools/train.py", line 204, in
main()
File "tools/train.py", line 200, in main
run(FLAGS, cfg)
File "tools/train.py", line 153, in run
trainer.train(FLAGS.eval)
File "/home/aistudio/PaddleDetection/ppdet/engine/trainer.py", line 542, in train
outputs = model(data)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in __call__
return self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/meta_arch.py", line 60, in forward
out = self.get_loss()
File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/cascade_rcnn.py", line 125, in get_loss
rpn_loss, bbox_loss, mask_loss = self._forward()
File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/cascade_rcnn.py", line 94, in _forward
self.inputs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in __call__
return self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleDetection/ppdet/modeling/heads/cascade_head.py", line 271, in forward
pred_bbox = self._get_pred_bbox(deltas, rois, self.bbox_weight[i])
File "/home/aistudio/PaddleDetection/ppdet/modeling/heads/cascade_head.py", line 310, in _get_pred_bbox
pred_bbox = delta2bbox(deltas, pred_proposals, weights)
File "/home/aistudio/PaddleDetection/ppdet/modeling/bbox_utils.py", line 56, in delta2bbox
dx = deltas[:, 0::4] / wx
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/varbase_patch_methods.py", line 753, in __getitem__
return self._getitem_index_not_tensor(item)
ValueError: (InvalidArgument) Too many indices (2) for tensor of dimension 1.
[Hint: Expected valid_indexs <= rank == true, but received valid_indexs <= rank:0 != true:1.] (at /paddle/paddle/fluid/pybind/slice_utils.h:306)
0
收藏
请登录后评论
+1 我也想问
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[29], line 8 6 anim = Visualization3D(*x_all_opts, z_values=z_all_opts, labels=labels, colors=colors, fig=fig, ax=ax) 7 ax.legend(loc='upper left') ----> 8 HTML(anim.to_html5_video())
File ~\AppData\Roaming\Python\Python310\site-packages\matplotlib\animation.py:1270, in Animation.to_html5_video(self, embed_limit)
1266 Writer = writers[mpl.rcParams['animation.writer']]
1267 writer = Writer(codec='h264', 1268 bitrate=mpl.rcParams['animation.bitrate'],
1269 fps=1000. / self._interval)
-> 1270 self.save(str(path), writer=writer)
=1271 # Now open and base64 encode. 1272 vid64 = base64.encodebytes(path.read_bytes())
File ~\AppData\Roaming\Python\Python310\site-packages\matplotlib\animation.py:1091,
in Animation.save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)
1088 for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
1089 for anim, d in zip(all_anim, data):
1090 # TODO: See if turning off blit is really necessary
-> 1091 anim._draw_next_frame(d, blit=False)
1092 if progress_callback is not None:
1093 progress_callback(frame_number, total_frames)
File ~\AppData\Roaming\Python\Python310\site-packages\matplotlib\animation.py:
1126, in Animation._draw_next_frame(self, framedata, blit)
1122 def _draw_next_frame(self, framedata, blit):
1123 # Breaks down the drawing of the next frame into steps of pre- and
1124 # post- draw, as well as the drawing of the frame itself.
1125 self._pre_draw(framedata, blit)
-> 1126 self._draw_frame(framedata)
1127 self._post_draw(framedata, blit)
File ~\AppData\Roaming\Python\Python310\site-packages\matplotlib\animation.py:
1720, in FuncAnimation._draw_frame(self, framedata)
1716 self._save_seq = self._save_seq[-self.save_count:]
1718 # Call the func with framedata and args. If blitting is desired,
1719 # func needs to return a sequence of any artists that were modified.
-> 1720 self._drawn_artists = self._func(framedata, *self._args)
1722 if self._blit:
1724 err = RuntimeError('The animation function must return a sequence ' 1725 'of Artist objects.') Cell In[27], line 43, in Visualization3D.animate(self, i) 41 for line, xy_value, z_value in zip(self.lines, self.xy_values, self.z_values): 42 line.set_data(xy_value[:i, 0], xy_value[:i, 1]) ---> 43 line.set_3d_properties(z_value[:i]) 44 return self.lines File d:\anaconda3\lib\site-packages\paddle\fluid\dygraph\varbase_patch_methods.py:753, in monkey_patch_varbase..__getitem__(self, item) 749 return _getitem_impl_(self, item) 751 else: 752 # 2. Call c++ func getitem_index_not_tensor to speedup. --> 753 return self._getitem_index_not_tensor(item) ValueError: (InvalidArgument) Too many indices (1) for tensor of dimension 0. [Hint: Expected valid_indexs <= rank == true, but received valid_indexs <= rank:0 != true:1.] (at ..\paddle/fluid/pybind/slice_utils.h:306)
也遇到这种情况了,pd2.6+py3.8 。paddleclas/ppcl/metric/metrics.py line405和paddleclas/ppcl/engine/train/utils.py line 38
都是*.numpy()[0]报的错,是numpy1.24.3版本不对吗