Я протестировал 100 изображений, и анализ memory_profiler приведен ниже. Почему строка 308 вызывает большой рост памяти?
mxnet == 1.5.1
Line # Mem usage Increment Line Contents
================================================
297 8693.719 MiB 81.809 MiB data = nd.array(im_tensor)
298 8693.719 MiB 0.000 MiB db = mx.io.DataBatch(data=(data,), provide_data=[('data', data.shape)])
299 8630.039 MiB 2.840 MiB self.model.forward(db, is_train=False)
300 8630.039 MiB 2.320 MiB net_out = self.model.get_outputs()
301 8693.719 MiB 2.062 MiB for _idx,s in enumerate(self._feat_stride_fpn):
302 8693.719 MiB 2.062 MiB _key = 'stride%s'%s
303 8693.719 MiB 1.031 MiB stride = int(s)
304 8693.719 MiB 1.031 MiB if self.use_landmarks:
305 8693.719 MiB 1.031 MiB idx = _idx*3
306 else:
307 idx = _idx*2
308 8693.719 MiB 4700.676 MiB scores = net_out[idx].asnumpy()
309 8693.719 MiB 1.289 MiB print scores.shape
310 8693.719 MiB 1.031 MiB scores = scores[:, self._num_anchors['stride%s'%s]:, :, :]
311 8693.719 MiB 1.031 MiB idx+=1
312 8693.719 MiB 2.836 MiB bbox_deltas = net_out[idx].asnumpy()
...