Skip to content

Commit

Permalink
C++ source for the Teradeep module
Browse files Browse the repository at this point in the history
  • Loading branch information
mrindoj committed Jan 17, 2016
1 parent 33608b7 commit 4fa3eac
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 0 deletions.
18 changes: 18 additions & 0 deletions teradeep_opencv/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright 2015 Teradeep Inc.
All rights reserved
Software license

Demonstration applications, neural network models, categories and trained network coefficients by Teradeep Inc. are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">demonstration applications</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.teradeep.com/" property="cc:attributionName" rel="cc:attributionURL">Teradeep Inc.</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 27 additions & 0 deletions teradeep_opencv/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
UNAME_P := $(shell uname -p)

OPENBLASPATH=/usr/local/lib

CFLAGS = -O3 -Wall -c -fopenmp -fPIC -I../thnets -I/usr/include/freetype2
LIBS = -L$(OPENBLASPATH) -lopenblas -lm -lpthread -lfreetype -lopencv_highgui -lopencv_core -lopencv_imgproc
CC = g++

ifneq ($(filter aarc% arm%,$(UNAME_P)),)
CFLAGS += -mfpu=neon -DUSEGLES2
LIBS += -lEGL -lGLESv2
else
LIBS += -lGL
endif

.PHONY : all
all : teradeep_opencv

.cpp.o:
$(CC) $(CFLAGS) $<

teradeep_opencv: $(LIBOBJS) teradeep_opencv.o
$(CC) -o $@ teradeep_opencv.o $(LIBS) -L/usr/local/lib -lthnets

.PHONY : clean
clean :
rm -f *.o teradeep_opencv
74 changes: 74 additions & 0 deletions teradeep_opencv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# demonstration application - Embedded

This is our May 2015 top neural network for large-scale object recognition. It has been trained to recognize most typical home indoor/outdoor objects in our daily life. It was trained with more that 10 M images on a private dataset. It can serve as good pair of eyes for your machines, robots, drones and all your wonderful creations!

<!--[![icon](icon.jpg|width=400px)]-->
<a href="icon"><img src="icon.jpg" align="center" height="400" width="400" ></a>

See it in action in this [video #1](https://www.youtube.com/watch?v=_wXHR-lad-Q), and also this other [video #2](https://www.youtube.com/watch?v=B0TreumQO-0).

This application is for tinkerers, hobbiest, researchers, evaluation purpose, non-commercial use only.

This library is exclusive for embedded linux and linux machines. For a full PC Torch7 implementation of this same demonstration, see `generic-pc` in this repository.

It has been tested on ODROID XU4 and Tegra TX1 boards. It can run at > 1 fps on the ODROID XU4, and a lot faster on the Tegra GPU.


## install:
Requirements: libfreetype6-dev, OpenCV.

Install our embedded library thnets: https://github.com/mvitez/thnets

### On ARM:

git clone https://github.com/mvitez/thnets.git
cd thnets
export LD_LIBRARY_PATH=/usr/local/lib
cd OpenBLAS-stripped
make
sudo make install
cd ..
make
sudo make install

### On PC:

Install OpenBLAS first:

git clone https://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
make NO_AFFINITY=1 USE_OPENMP=1
make install

OpenBLAS will be installed in /opt/OpenBLAS/lib. Install thnets:

git clone https://github.com/mvitez/thnets.git
cd thnets
export LD_LIBRARY_PATH=/usr/local/lib:/opt/OpenBLAS/lib
make OPENBLASPATH=/opt/OpenBLAS/lib
sudo make install

Please download files: `model.net`, `categories.txt` and `stat.t7` from https://www.dropbox.com/sh/qw2o1nwin5f1r1n/AADYWtqc18G035ZhuOwr4u5Ea?dl=0

## compile:

make

or on PC:

make OPENBLASPATH=/opt/OpenBLAS/lib

## run:

./thnetsopencvdemo -m <path do directory with model.net>

## usage:

Feel free to modify and use for all you non-commercial projects. Interested parties can license this and other Teradeep technologies by contacting us at `info@teradeep.com`

## most importantly:

Have fun! Life is short, we need to produce while we can!

## credits:
Marko Vitez, Aysegul Dundar, Jonghoon Jin, Alfredo Canziani, Eugenio Culurciello, Berin Martini all contributed to this work and demonstration. Thank you all!
Binary file added teradeep_opencv/icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4fa3eac

Please sign in to comment.