import matlab trained cnn into opencv dnn module - matlab

Is it possible to convert a trained convolutional neural network saved as .mat into a .pb format?
I was thinking to import it in opencv using cv::dnn::readNetFromTensorflow()
Are there any alteratives, o I just should retrain the network directly in tensorflow or keras?

I just found about Open Neural Network Exchange.
You can simply save the network from matlab using exportONNXNetwork(net,filename) and load the network inside opencv using cv2.dnn.readNetFromONNX()

Related

How to import MATLAB trained CNN network to LabVIEW

I have a few matlab trained deep learning networks to classify images, and I want to use them in the LabVIEW. And I want to preload the networks at the very beginning, instead of loading the networks between codes. But the MATLAB node in LabView cannot output a network.
I have tried to use the Deep Learning Module in LabView, but the supported tensorflow version is too low for my network to work. I read that DataPlugin for MATLAB could work, but I didn't find any example of how it works.

How can I modify a kernel size image data as an input for CNN in MATLAB?

I'm trying to create a 1x1x198 input for my CNN from a 100x100x198 data(image).
I'm using Hyperspectral Imaging data (jasper), however, if I want to process and plot their endmembers through a Convolution Neural Network I have to modify the data in 1x1x198 kernel sizes.
I am trying to write the Matlab code for the following paper. I will appreciate any help regarding the paper's Matlab code. IEEE paper: Hyperspectral unmixing via deep convolutional neural networks
Thank you

How to design and train my own convolutional neural network in Matlab using Caffe package?

I have a structure for my CNN that will be used in image enhancement. and I want to know how to use Caffe package in Matlab to design and train the network. I don't need to import pretrained network from Caffe as I have a specific structure for the CNN. Does any one have a link or example that guide me on how to do that? Any help will be appreciated.
The Caffe official documentation has a simple example showcasing basic interfaces for Matlab including adding conv layers to the network:
http://caffe.berkeleyvision.org/tutorial/interfaces.html#matlab
Once you get the basics for matlab, the interfaces are mostly similar to python.
Hope that helps

In Matlab, How to use already trained neural network on real time values?

Using nntool(Neural Network Manager) in Matlab, we have created a neural network named network1, the network type is Feed Forward backprop. Training function is TRAINLM, learning function is LEARNGDM, performance function is MSE. No. of layers are 2 and transfer function is TRANSIG. No. of Inputs is 2.
We have trained it using known datasets.
Now, we want to use this trained Neural Network on real time values(dynamically one by one) to get the output.
We are unable to use the network on real time values.
So, please guide us through the steps to use trained neural network on real time values.
if you created a ann via
network1 = feedforwardnet;
or something of that kind and then trained it with your known data, you should be able to use said net via
outputs = network1(inputs);
You can create a function from the neural network that you have trained and use it as regular MATLAB functions.
You can either create it with genFun command or using the GUI in neural network toolbox.
genFunction(net,pathname)
If you want the function to accept only matrix elements you should use this command:
genFunction(net,pathname,'MatrixOnly','yes')

Load my MATLAB model as a Weka model

I have trained a Bayesian Regularized Neural Network model with MATLAB. This model is not available with Weka. So now I want to import my MATLAB model as Weka's .model file, so that I can directly use my model with Weka.
How do I go about it?
Weka can import models in the PMML format, so the easiest (and possibly the only avaliable) way to load the neural network trained with some "special" form of regularization.
You will have to save your network in the PMML format, some guidelines can be obtained here:
http://www.dmg.org/v3-2/NeuralNetwork.html