Closed breezedeus closed 2 years ago
用 memory_profiler 打了下内存消耗:
memory_profiler
169 3045.3 MiB 0.0 MiB h, w, _ = resize_img.shape 170 3054.2 MiB 8.9 MiB resize_img = normalize_img_array(resize_img) 171 3054.2 MiB 0.0 MiB im_res = mx.nd.array(resize_img) 172 3054.5 MiB 0.3 MiB im_res = self._trans(im_res) 173 174 3054.7 MiB 0.2 MiB t1 = time.time() 175 3064.7 MiB 10.0 MiB seg_maps = self._model(im_res.expand_dims(axis=0).as_in_context(self._context)) 176 4056.1 MiB 991.4 MiB mx.nd.waitall() 177 4056.1 MiB 0.0 MiB seg_maps = seg_maps.asnumpy() 178 4056.1 MiB 0.0 MiB t2 = time.time() 179 4056.1 MiB 0.0 MiB boxes, scores, rects = detect_pse( 180 4056.1 MiB 0.0 MiB seg_maps, 181 4056.1 MiB 0.0 MiB threshold=pse_threshold, 182 4056.1 MiB 0.0 MiB threshold_k=pse_threshold,
发现是 mx.nd.waitall()每预测一张图片就会消耗不少内存,而这些内存好像没完全被释放,导致内存消耗越来越大。
mx.nd.waitall()
网上搜了下,好像是MXNet的一个未解问题: Memory leak when running cpu inference - Gluon - MXNet Forum
用
memory_profiler
打了下内存消耗:发现是
mx.nd.waitall()
每预测一张图片就会消耗不少内存,而这些内存好像没完全被释放,导致内存消耗越来越大。网上搜了下,好像是MXNet的一个未解问题: Memory leak when running cpu inference - Gluon - MXNet Forum