Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Soletta machine learning initial commit
Browse files Browse the repository at this point in the history
Soletta Machine Learning is an open source machine learning library
for development of IoT devices.
It provides APIs to handle with client side AI and an easy to use
flow-based Soletta module.

Initially supporting neural networks and fuzzy logic learning,
using well established open source libraries, it could be
easily extended to support others.

Signed-off-by: Bruno Dilly <[email protected]>
  • Loading branch information
bdilly committed Jul 23, 2015
0 parents commit 3be2b6b
Show file tree
Hide file tree
Showing 134 changed files with 34,312 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CMakeCache.txt
Makefile
cmake_install.cmake
CMakeFiles
*.so
*.out
sml/common/include/config.h
sml/sml.pc
install_manifest.txt
bin/
gen/
obj/
local.properties
gdb.setup
gdbserver
docs/Doxyfile
soletta_module/machine_learning.json
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bruno Dilly <[email protected]>
Guilherme Iscaro de Godoy <[email protected]>
Otavio Pontes <[email protected]>
111 changes: 111 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
cmake_minimum_required(VERSION 2.8)

project(machine-learning)

option(MAINLOOP "Build support to mainloop using glib" ON)
option(FUZZY_ENGINE "Build with fuzzy logic support" ON)
option(ANN_ENGINE "Build with neural network support" ON)
option(NAIVE_ENGINE "Build with naive engine support" ON)
option(BUILD_SOLETTA_MODULE "Build machine learning module for Soletta" ON)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_SIMULATOR "Build simulator" ON)
option(BUILD_DOCS "Build the documentation" ON)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)

CHECK_CXX_COMPILER_FLAG("-Wall" CXX_COMPILER_HAS_WALL)
CHECK_CXX_COMPILER_FLAG("-Wextra" CXX_COMPILER_WALL_HAS_WEXTRA)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_HAS_FVISIBILITY)

CHECK_C_COMPILER_FLAG("-std=gnu99" C_COMPILER_HAS_C99)
CHECK_C_COMPILER_FLAG("-Wall" C_COMPILER_HAS_WALL)
CHECK_C_COMPILER_FLAG("-Wextra" C_COMPILER_HAS_WEXTRA)
CHECK_C_COMPILER_FLAG("-Wno-unused-parameter" C_COMPILER_HAS_WNO_UNUSED_PARAMETER)
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers" C_COMPILER_HAS_WNO_MISSING_FIELD_INITIALIZERS)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" C_COMPILER_HAS_FVISIBILITY)

if (CXX_COMPILER_HAS_WALL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()

if (CXX_COMPILER_WALL_HAS_WEXTRA)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
endif()

if (CXX_COMPILER_HAS_FVISIBILITY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()

if (C_COMPILER_HAS_FVISIBILITY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()

if (C_COMPILER_HAS_WEXTRA)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
endif()

if (C_COMPILER_HAS_WALL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()

if (C_COMPILER_HAS_C99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
else()
message(FATAL_ERROR "No gnu99 support. Bye.")
endif()

if (C_COMPILER_HAS_WNO_UNUSED_PARAMETER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
endif()

if (C_COMPILER_HAS_WNO_MISSING_FIELD_INITIALIZERS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers")
endif()

if (NOT ANN_ENGINE AND NOT FUZZY_ENGINE AND NOT NAIVE_ENGINE)
message(FATAL_ERROR "At least on engine must be enabled in order to build SML.")
endif()

message("Fuzzy support:" ${FUZZY_ENGINE})
message("ANN support:" ${ANN_ENGINE})
message("Naive support: " ${NAIVE_ENGINE})
message("Soletta module:" ${BUILD_SOLETTA_MODULE})

set(SML_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sml/include)

find_package(PkgConfig REQUIRED)
pkg_check_modules(SOLETTA REQUIRED soletta)

if (ANN_ENGINE)
pkg_check_modules(FANN REQUIRED fann)
endif()

if (FUZZY_ENGINE)
pkg_check_modules(FUZZY_LITE REQUIRED fuzzylite)
endif()

if (MAINLOOP)
pkg_check_modules(GLIB REQUIRED glib-2.0)
endif()

add_subdirectory(sml)

if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if (BUILD_SIMULATOR)
add_subdirectory(simulator)
endif()

if (BUILD_SOLETTA_MODULE)
add_subdirectory(soletta_module)
endif()

if (BUILD_DOCS)
add_subdirectory(docs)
endif()
29 changes: 29 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
This file is part of the Soletta Project

Copyright (C) 2015 Intel Corporation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 changes: 88 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
= Soletta Machine Learning =

Soletta Machine Learning is an open source machine learning library
for development of IoT devices.
It provides APIs to handle with client side AI and an easy to use flow-based
Soletta module.

Initially supporting neural networks and fuzzy logic learning,
using well established open source libraries, it could be easily
extended to support others.

= Building =

== Dependencies ==

This project depends on:

fuzzylite:
Desc: A fuzzy logic control library written in C++.
Site: http://www.fuzzylite.com/
Source: https://github.com/fuzzylite/fuzzylite.git

FANN (Fast Artificial Neural Network Library):
Desc: An open source neural network library.
Site: http://leenissen.dk/fann/wp/
Source: https://github.com/libfann/fann

Soletta:
Desc: Soletta Project is a framework for making IoT devices.
Site: https://solettaproject.org/
Source: https://github.com/solettaproject/soletta

Some distros (like Fedora, Ubuntu), has packaged FANN and fuzzylite.

== Linux ==

* Build and install all dependencies
* At the moment, it's required to do a minor fix on fuzzylite/fuzzylite.pc.in:
Replace

Cflags: -I${includedir}/fl

by

Cflags: -I${includedir}

Alternativelly it's possible to provide a cmake with extra cflags:
$ cmake -DCMAKE_C_FLAGS="-I/path/to/proper/header/dir/"


* After dependencies setup and installation, build machine-learning running:
** Using both engines

$ cmake -DFUZZY_ENGINE=ON -DANN_ENGINE=ON .

or

$ cmake .
$ make

** Using only the neural networks engine
$ cmake -DFUZZY_ENGINE=OFF .
$ make


** Using only the Fuzzy engine
$ cmake -DANN_ENGINE=OFF .
$ make

== Docs ==
* To build docs run:
$ make doc

== Galileo ==
* Install proper toolchain to build for galileo board.
* Edit soletta_module/i586-poky-linux-uclibc.cmake and update
CMAKE_FIND_ROOT_PATH variable to point the toolchain's sysdir with any
necessary dependencies to build sml.
* Create temporary directory to install sml and its dependencies. It is
called in this instruction {TMP_DESTDIR_PATH}
* To use soletta_module/i586-poky-linux-uclibc.cmake to build fann and
fuzzylite and install them to the toolchain's ROOT_PATH. Run:
$ cmake .. -DCMAKE_TOOLCHAIN_FILE={PATH_TO_SML}soletta_module/i586-poky-linux-uclibc.cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr
$ make && make install DESTDIR={TMP_DESTDIR_PATH}
* Copy all files in {TMP_DESTDIR_PATH} to toolchain's sysdir.
* Use same command to build sml and to install it to {TMP_DESTDIR_PATH}
* Copy all files in {TMP_DESTDIR_PATH} to root of image to be used in galileo
board.
24 changes: 24 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 2.8)

project(docs)

find_package(Doxygen REQUIRED)

set(DOXY_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXY ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

set(HEAD_FILE ${CMAKE_CURRENT_SOURCE_DIR}/head.html)
set(FOOT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/foot.html)
set(STYLE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/style.css)
set(EXAMPLES_PATH ${CMAKE_SOURCE_DIR}/examples)
set(INPUT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/examples.dox ${CMAKE_SOURCE_DIR}/sml/include")

set(OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/html)

configure_file(${DOXY_IN} ${DOXY} @ONLY)

add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
Loading

0 comments on commit 3be2b6b

Please sign in to comment.