Exception:Channel swap needs to have the same number of dimensions as the input channels
ValueError: Mean channels incompatible with input.
File “d:/caffe-master/zzfl/testfenlei.py”, line 78
SyntaxError: Non-ASCII character ‘\xca’ in file d:/caffe-master/zzfl/testfenlei.py on line 78, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
IOError: [Errno 22] invalid mode (‘rb’) or filename: 'D:/caffe-master/zzfl/d:/caffe-master/zzfl/train/150013046730.jpg 0\n’
解決辦法:讀取路徑前加r即可
dataset = scipy.io.loadmat(r’F:\test_data.mat’)
這種錯誤的出現是在使用built-in函數file()或者open()的時候。或者是因爲文件的打開模式不對,或者是文件名有問題。前者的話只需要注意文件是否可讀或者可寫就可以了。後者則是與文件路徑相關的問題,需要在文件名前加r或者R轉義,如:file(r"e:\Test.txt",‘r’).或者將反斜槓\變成兩個,如file(“e:\Test.txt”,‘r’).
例如
scipy.io.loadmat('F:\Data.mat')
IOError: [Errno 22] invalid mode ('rb') or filename: 'F:\Data.mat'
解決辦法
scipy.io.loadmat('F:\\Data.mat') //只需加反斜線即可
部分報錯問題仍有待解決!希望能共同探討!