我遇到了一个问题,当我从此repo应用arcface实现时,出现了错误。
从此行代码开始:
face_imgs_resized = np.array(face_imgs_resized)
face_imgs_resized = np.rollaxis(face_imgs_resized, 3, 1)
data = self.mx.nd.array(face_imgs_resized)
db = self.mx.io.DataBatch(data=(data,))
self.model.forward(db, is_train=False)
错误:
self.model.forward(db, is_train=False)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/module/module.py", line 625, in forward
self.exec_group.forward(data_batch, is_train)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/module/executor_group.py", line 450, in forward
load_data(data_batch, self.data_arrays, self.data_layouts)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/module/executor_group.py", line 74, in _load_data
_load_general(batch.data, targets, major_axis)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/module/executor_group.py", line 48, in _load_general
d_src[slice_idx.start:slice_idx.stop].copyto(d_dst)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 506, in __getitem
return self._get_nd_basic_indexing(key)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 787, in _get_nd_basic_indexing
return self._slice(key.start, key.stop)
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 902, in _slice
start, stop, _ = _get_index_range(start, stop, self.shape[0])
File "/root/miniconda/envs/roy/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 2327, in _get_index_range
raise IndexError('Slicing stop %d exceeds limit of %d' % (stop, length))
IndexError: Slicing stop 2 exceeds limit of 1
所以有人以前遇到过此错误吗?并且请教我如何解决它。
答案 0 :(得分:0)
当DataBatch接受一个NDArrays数组时,您正在将NDArray传递给DataBatch,每个数组的大小为batch_size。
你可以试试吗?
Parent: I am Parent 1
Child: I am Default Parent