soumith / matio-ffi.torch Goto Github PK
View Code? Open in Web Editor NEWA LuaJIT FFI interface to MATIO and simple bindings for torch
License: BSD 3-Clause "New" or "Revised" License
A LuaJIT FFI interface to MATIO and simple bindings for torch
License: BSD 3-Clause "New" or "Revised" License
Hey,
My matio was installed from the ubuntu repo and I did follow up with luarocks install matio
but it seems the devils are really unhappy with me:
th> tensor = matio:load('vicon.mat', 'vicon')
[string "tensor = matio:load('vicon.mat', 'vicon')"]:1: attempt to index global 'matio' (a nil value)
stack traceback:
[string "tensor = matio:load('vicon.mat', 'vicon')"]:1: in main chunk
[C]: in function 'xpcall'
/home/lex/torch/install/share/lua/5.1/trepl/init.lua:668: in function 'repl'
.../lex/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
Matlab versioon is 8.6.0.267246 (R2015b).
Any ideas?
The issue is as bellow:
/home/wanggu/torch/install/share/lua/5.1/matio/ffi.lua:20: /usr/local/lib/libmatio.so.2: undefined symbol: H5T_NATIVE_SCHAR_g
stack traceback:
[C]: in function 'load'
/home/wanggu/torch/install/share/lua/5.1/matio/ffi.lua:20: in function </home/wanggu/torch/install/share/lua/5.1/matio/ffi.lua:20>
[C]: in function 'xpcall'
/home/wanggu/torch/install/share/lua/5.1/matio/ffi.lua:20: in main chunk
[C]: at 0x0046b7a0
[C]: in function 'pcall'
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:380: in function 'require'
/home/wanggu/torch/install/share/lua/5.1/matio/init.lua:3: in main chunk
[C]: at 0x0046b7a0
[C]: in function 'pcall'
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:380: in function 'require'
[string "_RESULT={require 'matio'}"]:1: in main chunk
[C]: in function 'xpcall'
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'
...nggu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:384: /home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:384: /home/wanggu/torch/install/share/lua/5.1/matio/ffi.lua:24: Could not find libmatio. Please make sure that you installd MatIO and you have the shared libraries (libmatio.so or libmatio.dylib) in your library path
stack traceback:
[C]: in function 'error'
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
[string "_RESULT={require 'matio'}"]:1: in main chunk
[C]: in function 'xpcall'
/home/wanggu/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'
...nggu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
@soumith How can I fix this?
I am going to load a normal ''.mat" file in the torch. But it has following eror:
Segmentation fault: 11
And I am trying to re-save the data in the matlab with compatible format, but I found that the command in the "test" directory is a bit confusing, the command "save -mat7-binary 'test.mat' a" has made me confused. Does anyone know how to save the ".mat" file correctly so that I can load it in the torch?
Thank you so much.
Hi, I noticed that matio-ffi.torch
only support load mat files. Is there any way to save with mat format?
I am sure there is memory leak after loading mat files. After loading lots of '.mat' files, the memory is occupied.
I tried to add 'mat.varFree()' before 'mat.close()'. But it didn't seem to help.
Is there anything to be done for .mat
files saved with Octave 4.0?
my intention is to save a list of strings from lua to mat file.
t = {}
t[1] = 'Tom'
t[2] = 'Jerry'
matio = require 'matio'
matio.save('test.mat', t)
with the above code I get the following error:
bad argument #1 to 'varCreate' (cannot convert 'number' to 'const char *')
Is there any way to store a list of strings from lua to mat file?
Currently, nD cells are currently always loaded as linearized 1D tables. They should be loaded as nD Lua tables instead.
I followed the instruction to install matio package. However, require 'matio'
throws an exception. libmatio.so: cannot open shared object file
I spent some time to investigate this issue. It turns out the lib file name is mismatched.
My solution is ln -s /usr/lib/x86_64-linux-gnu/libmatio.so.2 /usr/lib/x86_64-linux-gnu/libmatio.so
(my environment is Ubuntu 14.04.1 X64 desktop version.)
Is it common issue in Ubuntu? I suggest to put a notification in README.md for this issue.
$luarocks install matio
matio not found for Lua 5.2.
Checking if available for other Lua versions...
Checking for Lua 5.1...
Checking for Lua 5.3...
Checking for Lua 5.4...
Error: No results matching query were found for Lua 5.2.
Hello,
i was following the installation guide and noticed that libmatio2
is not in the package repository for the Ubuntu 18.04 LTS i am using. I did instead install the newer version libmatio4
by using sudo apt install libmatio4
.
The next command luarocks install matio
finishes without errors as well. It installs the matio module to ~/torch/install/lib/luarocks/rocks/matio
.
Unfortunately, i cant import the module in a torch script. Using the torch interactive console th
to test local matio = require 'matio'
results in the following error message:
th> local matio = require 'matio'
/home/alexander/torch/install/share/lua/5.1/matio/ffi.lua:20: libmatio.so.2: cannot open shared object file: No such file or directory
stack traceback:
[C]: in function 'load'
/home/alexander/torch/install/share/lua/5.1/matio/ffi.lua:20: in function </home/alexander/torch/install/share/lua/5.1/matio/ffi.lua:20>
[C]: in function 'xpcall'
/home/alexander/torch/install/share/lua/5.1/matio/ffi.lua:20: in main chunk
[C]: at 0x565451a2be70
[C]: in function 'pcall'
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:385: in function 'require'
/home/alexander/torch/install/share/lua/5.1/matio/init.lua:3: in main chunk
[C]: at 0x565451a2be70
[C]: in function 'pcall'
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:385: in function 'require'
[string "local matio = require 'matio'"]:1: in main chunk
[C]: in function 'xpcall'
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:679: in function 'repl'
...nder/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
[C]: at 0x5654519c7570
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:389: /home/alexander/torch/install/share/lua/5.1/trepl/init.lua:389: /home/alexander/torch/install/share/lua/5.1/matio/ffi.lua:24: Could not find libmatio. Please make sure that you installd MatIO and you have the shared libraries (libmatio.so or libmatio.dylib) in your library path
stack traceback:
[C]: in function 'error'
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
[string "local matio = require 'matio'"]:1: in main chunk
[C]: in function 'xpcall'
/home/alexander/torch/install/share/lua/5.1/trepl/init.lua:679: in function 'repl'
...nder/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
[C]: at 0x5654519c7570
[0.0016s]
I could resolve this error by creating the following symbolic link:
ln -s /usr/lib/x86_64-linux-gnu/libmatio.so.4 /usr/lib/x86_64-linux-gnu/libmatio.so
I will create a push request to update the readme.
I'm using matio.load
to load a .mat
file. It contains file arrays, xtrain
, xtest
, ytrain
, ytest
and vocab
. matio got Unsupported variable type: 5 while loading xtrain
and ytrain
. And other three loaded correctly.
And the data file can be loaded correctly in matlab.
This is on a system running Ubuntu 12.04. I installed matio using apt-get, and have MATLAB R2013a. The command to install matio, i.e. sudo luarocks install matio executes without any errors. However, when I start Torch, and try to read a MAT file, this is what happens:
matio = require 'matio'
tensor = matio.load('test.mat')
No variables in this file
If I exit Torch at this point, I find that the test.mat MAT file has been rewritten to an empty file of size 128 bytes.
BrodskyMacBookPro:lua---mattorch jmcdonald$ brew install libmatio
Error: No available formula for libmatio
Searching formulae...
Searching taps...
homebrew/science/libmatio
BrodskyMacBookPro:lua---mattorch jmcdonald$ brew install homebrew/science/libmatio
==> Tapping homebrew/science
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-science'...
remote: Counting objects: 537, done.
remote: Compressing objects: 100% (533/533), done.
remote: Total 537 (delta 4), reused 160 (delta 3), pack-reused 0
Receiving objects: 100% (537/537), 421.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (4/4), done.
Checking connectivity... done.
Tapped 530 formulae (557 files, 2.8M)
==> Installing libmatio from homebrew/homebrew-science
==> Downloading https://downloads.sourceforge.net/project/matio/matio/1.5.2/matio-1.5.2.tar.gz
Error: SHA1 mismatch
Expected: d5a83a51eb2550d75811d2dde967ef3e167d4f52
Actual: ea60df615387f47bdfdfe4da48f6567c4ec60f74
Archive: /Library/Caches/Homebrew/libmatio-1.5.2.tar.gz
To retry an incomplete download, remove the file above.
Hello. I'm not familiar with Lua FFI, but I'm hitting this error (arch linux0:
/home/esimo/torch/install/share/lua/5.1/matio/ffi.lua:20: /usr/lib/libmatio.so.2: undefined symbol: H5T_NATIVE_SCHAR_g
As matio is not being linked to hdf5, if you were to compile against it you would have to link against hdf5 also. However, this is not being handled with the Lua FFI interface, and I'm not sure how to fix it, although it does seem like it should be trivial.
I installed matio on ubuntu following the instructions, namely:
1. # apt-get install libmatio2
2. # luarocks install matio
when I tried to run this little testfile.lua :
local matio = require 'matio'
tensor1 = matio.load('testdata.mat')
with torch (# th testfile.lua), I got the following error:
Segmentation fault (core dumped)
This is not a huge issue, but files saved in MATLAB 7.3 format are not supported. E.g
In MATLAB
test = magic(10)
save('test7.mat','test', '-v7')
save('test73.mat','test', '-v7.3')
In torch
matio = require 'matio'
input1 = matio.load('test7.mat', 'test')
input1 = matio.load('test73.mat', 'test') -- ERR: File could not be opened: test73.mat
I am currently getting userdata
as the type of gesture
after loading from the repsective vector.
How can I possibly compare this value gesture
with an integer?
My code looks as follows:
gesture = matio.load(val, 'gesture')
if gesture == 101 then
gesture = th.FloatTensor({10})
print("101 Detected! New value is: ")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.