Suggestion to consider improving MatFile support by using code from csmatio to read and write .mat files - ilnumerics

is anyone using MatFile classes in ilnumerics?
I just tried to open a MAT file created using csmatio and found I could not import it into ilnumerics application.
Hit throw new Exception("element data type is not supported");
as there is no support for mxSTRUCT_CLASS in the method
private ILBaseArray read_miMATRIX(BinaryReader br).
Is it a lot of work to add support for mxSTRUCT_CLASS?

ILNumerics will add support for HDF5 soon. This will also provide access to recent Matlab mat files. There are no plans to improve the old ILMatFile interface currently.

Related

Can I save python function as .tflite?

I want to preprocess an audio file and convert it to spectrogram before inserting it to my tflite model in flutter app. is there a way I can run my preprocessing function (.py) on flutter by converting it to .tflite?
That's currently not supported. You would have to include the preprocessing steps in the model itself (as TF ops, if the ops are supported in TFLite) so that it's included in converted TFLite model, or preprocess it manually outside the model in Flutter.
Kindly close the issue / mark this as the accepted answer if your issue is resolved.

Matlab converting library to model

I'm working on a script to convert a Simulink library to a plain model, meaning it can be simulated, it does not auto-lock etc.
Is there a way to do this with code aside from basically copy-pasting every single block into a new model? And if it isn't, what is the most efficient way to do the "copy-paste".
I was not able to find any clues as how to approach this problem here, or on Google, or on the official documentation or on the MathWorks forum so I'm at a loss on how to proceed.
Thank you in advance!
I don't think it's possible to convert a library to a model, but you can programmatically add library blocks to models like so:
sys = 'testModel';
new_system(sys);
open_system(sys);
add_block('Simulink/Sources/Sine Wave', [sys, '/MySineWave']);
save_system(sys);
close_system(sys);
sim(sys);
You could even use the find_system command to list all the blocks in a library and then loop through them all and create a new model for each using the above code.

How to repair Simulink SLX file?

One of my Simulink SLX files has stopped opening as a model. Apparently it was corrupted. Are there any means to repair such a files or extract some information of them? File looks like being a MZ executable. Where is the block schema stored?
SLX is a compressed file which contains XML files with model information. You can try opening the SLX file in winzip and check. See http://www.mathworks.com/help/simulink/ug/saving-a-model.html#btbr7kx-1 for SLX format. I do not think there is any utility to repair corrupted SLX files.
DiffPlug's Simulink Viewer has an .slx parser that was developed independent of The Mathworks, and it's a little more "lenient" than The Mathworks' implementation. You might want to try opening your model in DiffPlug's viewer (it's free, so you don't have much to lose I guess...).
That way you'll at least be able to scout around the model so you can see what piece has been corrupted.
Disclaimer: I work for DiffPlug.
If there's a lot of time invested in the model, I'd be happy to open your model up and poke around inside it using our internal API. It'd only take me a few minutes, and it might be an easy fix like a mis-matched Stateflow id.
Remove the extension 'original' from the file name 'X.slx.original'. This worked for me.
You can actually still load the system using load_system(), use bdroot to see if it loaded, then use save_system() to save what is returned by bdroot, using a new filename. The new model should open correctly.

training a new model using pascal kit

need some help on this.
Currently I am doing a project on computer vision that requires me to train a new model to detect a certain object.
In this case, I am using the system provided by P. Felzenszwalb, D. McAllester, D. Ramaman and his team => Discriminatively trained deformable part models which is implemented in Matlab.
Project webpage: http://www.cs.uchicago.edu/~pff/latent/.
However I have no idea how to direct the system to use my dataset(a collection of images and annotation) which is different from the the PASCAL datasets so as to train a new model.
By directing, I meant a line of code that allows me to change the dataset the system reads from, for training a model.
E.g.
% directory for caching models, intermediate data, and results
cachedir = ['/var/tmp/rbg/YOURPATH/' VOCyear '/'];
I tried looking at their Readme and documentation guides but they do not make any mention. Do correct me if I am wrong.
Let me know if I have not made my problem clear enough.
I tried looking at some files such as global.m but no go.
Your help is much appreciated and thanks in advance!
You can try to read pascal.m in the DPM package(voc-release5), there are similar code working on VOC2007/2010 dataset.
There are plenty of parts that need to be adapted to achieve this. For example the voc_config has to be adapted in order to read from your files.
The same with the pascal_train.m function. Depending on the images and the way you parse them, this may require quite some time to adapt this function.
Other functions to consider:
imreadx
pascal_test
pascaleval

Export from OpenCascade, import into OpenSceneGraph

We have a modeling tool which uses OCC, and a 3d editor using OSG. What I want to do is, export the model from the first tool and import into the second tool. I have been searching the web for days, but I can't find a solution.
Three things can solve my problem:
An exporter for OCC to export into OSG supported formats (.ive, .osg, and many more),
An importer for OSG to import from OCC supported formats (.stp, .step, .igs, .iges, .brp, .brep ),
A converter tool for converting between two formats, one format supported by OCC and one format supported by OSG.
Has anybody done this before, or know of anything that can help?
I am trying to avoid writing a custom exporter for OCC.
I found a solution. OpenCascade has an import/export example, which can export VRML files without texture support. Some modifications on the import export code and some modifications on other parts (where the OCC model is represented by VRML classes) was enough to successfully export my model to a VRML file. Then i built the VRML plugin for OpenSceneGraph and successfully imported the model.
CADExchanger (OCC based) does a pretty good job converting between BRep and other formats (STEP, IGES, STL, VRML...)
Why don't you have a look at pythonocc.org.
I'm assuming OSG takes meshes?
Load the STEP / IGES file in (python)OCC, grab its mesh, push the verts / indices to OSG.
Would that work?