Search code examples
neural-networkcaffedarknetansi-c

Trained Neural Network model in C?


I am not an expert in machine learning and neural networks, at the computational intelligence field in general but I am looking to find a Neural Network model which is written in ANSI C language.

What I wish to do with the classifier is to train it and then use it as a benchmark for experimental reasons along with its weights. In general the file that I am looking is built like this:

#include <.....>

/* -- Global Variables -- */ 

double weight_layer_a_neuron_1 = ... ;
double weight_layer_a_neuron_2 = ... ;
..
..
..
double weight_layer_n_neuron_n = ... ;

/* ---------------------- */

/* 
 * Neural Network Model Code Here
 */

The reason that I am looking for this specific architecture is that I need to cross-compile it in another system and C is one of the few options.

I have looked online for DarkNet and caffee libraries if they support an option like that, to "export" the model in a C file but as I expected I didn't find anything. Are there any options available for my case? Thank you in advance!


Solution

  • [ANSWER]

    Although none of the frameworks mentioned above provides the network file in C you can use the codeplea's genann library which provides a delicate and beautiful way to create / train / store / load your neural network. It also provides various training methods.

    There is not an automatic way to generate and create a network as fast as Darknet and Caffe suggest but with a little effort and based on the examples provided by the author you can create your nn quite easily.