1. 程式人生 > >caffe matlab matcaffe 載入輸入網路net時報錯

caffe matlab matcaffe 載入輸入網路net時報錯

如題,報錯資訊如下:

Warning: The following error was caught while executing 'caffe.Net' class destructor:
Error using caffe_
Usage: caffe_('delete_solver', hNet)

Error in caffe.Net/delete (line 72)
      caffe_('delete_net', self.hNet_self);

報錯原因:舊一點版本的caffe的matlab介面中的函式Net.m源程式有bug。

When constructing a network, the internal object initialization of Matlab actually creates a new network and replaces the already instantiated object, causing an empty network to be deleted. This PR checks if the caffe net pointer is defined before calling the net-deletion-function in caffe_.cpp.  ( 取自https://github.com/BVLC/caffe/pull/5588


修復方法:重新安裝新版本的caffe,或者進入目錄,在對應的函式處進行修改:

Net.m
修改如下:

    function delete (self)   %caffe重新建立網路時會自動刪除之前建立的網路
      if self.isvalid  (或者~isempty(self.hNet_self))
      caffe_('delete_net', self.hNet_self);
      end
    end