Giter VIP home page Giter VIP logo

microann's Introduction

microANN

Micro Artificial Neural Network is a minimalist ANN library to implement AI in microcontrollers

This is work in progress.

Requirements

uANN requires dynamic memory, not all the microcontrollers have any heap implemented on its standard library, thats why this project assumes that is not available and uses uHeap (micro heap) as dependency.

Example of use

#include "uANN.h"
#include "uANN_config.h"

#include <stdio.h>
	
void example(){
	struct ann_net*		ann;
	struct ann_layer*	layer;
	const float	input[2] = {1.0, 1.0};
	float	output;

	///	Initialize and clear private pointers
	ann_init();

	ann = ann_net_create();
	layer = ann_layer_create();

	///	Setting layer properties
	layer->inputLen = 2;
	layer->neurons  = 1;
	layer->activation = ann_sigmoid;

	///	Pushing new layer over last layer
	if( ann_net_push( ann , layer ) < 0 ){
		fprintf( stderr , "This layer is not compatible with last layer" );
	}

	///	Allocating memory for each layer
	if( ann_alloc( ann ) < 0 ){
		fprintf( stdout , "This neural netowork requires memory not available" );
	}

	///	Setting weights and bias
	layer->_weightHolder[0] = 0.85;
	layer->_weightHolder[1] = 0.85;

	layer->_biasHolder[0] = 0.0;

	///	Setting input vector
	layer->_inputHolder[0] = input[0];
	layer->_inputHolder[1] = input[1];

	///	Propagate through neural network
	ann_compute( ann );

	///	The output of the neural network is now available
	output = layer->_outputHolder[0];
	fprintf( stdout, "AND Gate example: \n");
	fprintf( stdout, "Input: [%f] [%f]\n", input[0], input[1]);
	fprintf( stdout, "result: %f\n", output );
}

int main( int argc, char* argv[] ){
	example();	
	return 0;
}

microann's People

Contributors

josepablo134 avatar

Stargazers

Olaf Huerta avatar

Watchers

James Cloos avatar  avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.