From 5624ffa6b799e3f87c6cd7ad7e89d4545a76b883 Mon Sep 17 00:00:00 2001 From: Chenchi Luo Date: Tue, 26 May 2015 11:14:59 -0500 Subject: [PATCH] Fix CIFAR 10 Testing example. --- build/build_version.txt | 2 +- build/build_version.txt~ | 1 - build/makefile~ | 97 ---------- debian/changelog | 11 +- debian/changelog~ | 47 ----- .../class/cifar10/appCNNClassCIFAR10Testing.c | 51 ++--- .../cifar10/appCNNClassCIFAR10Testing.c~ | 168 ---------------- src/app/makefile~ | 182 ------------------ src/common/cnn/timlCNNSetBatchSize.c | 3 + 9 files changed, 39 insertions(+), 523 deletions(-) delete mode 100644 build/build_version.txt~ delete mode 100755 build/makefile~ delete mode 100644 debian/changelog~ delete mode 100644 src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c~ delete mode 100755 src/app/makefile~ diff --git a/build/build_version.txt b/build/build_version.txt index 6efe8d2..4362726 100644 --- a/build/build_version.txt +++ b/build/build_version.txt @@ -1 +1 @@ -1.0.2.0 +01.00.02.03 diff --git a/build/build_version.txt~ b/build/build_version.txt~ deleted file mode 100644 index 0839c1f..0000000 --- a/build/build_version.txt~ +++ /dev/null @@ -1 +0,0 @@ -1.0.1.0 diff --git a/build/makefile~ b/build/makefile~ deleted file mode 100755 index 1318e8b..0000000 --- a/build/makefile~ +++ /dev/null @@ -1,97 +0,0 @@ -################################################################################ -# -# makefile -# -# Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ -# -# 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 Texas Instruments Incorporated 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. -# -################################################################################ - -#check os -UNAME_M :=$(shell uname -m) - -BIN_DIR := ../bin -BUILD_DIR := build -SRC_DIR := ../src - -ACCLERERATOR := NONE - -# COMMON -COMMON_LIB_SRC_DIR = $(SRC_DIR)/common -COMMON_LIB_DIR = $(BIN_DIR) -COMMON_LIB_NAME = timl -COMMON_LIB_FULL_NAME = $(COMMON_LIB_DIR)/lib$(COMMON_LIB_NAME).a -COMMON_LIB_CFILES = $(shell find $(COMMON_LIB_SRC_DIR) -name "*.c") -COMMON_LIB_HFILES = $(shell find $(COMMON_LIB_SRC_DIR) -name "*.h") -COMMON_LIB_OBJS = $(patsubst %.c, %.o, $(COMMON_LIB_CFILES)) - - - -ifneq (,$(findstring 86, $(UNAME_M))) -CC = arm-linux-gnueabihf-gcc -AR = arm-linux-gnueabihf-ar -else -CC = gcc -AR=ar -endif - - - -C_INCLUDE_PATH = $(SRC_DIR)/common/api $(SRC_DIR)/common/cnn $(SRC_DIR)/common/util $(SRC_DIR)/dsp\ -$(TARGET_ROOT)/usr/include -C_INCLUDE_FLAG = $(foreach d, $(C_INCLUDE_PATH), -I$d) -CFLAGS += -g -O3 -fopenmp -AR = @ar -ARFLAGS = -rcs -RM = @rm -RMFLAGS += -fr - -all: $(COMMON_LIB_FULL_NAME) - -# common lib -$(COMMON_LIB_FULL_NAME):$(COMMON_LIB_OBJS) - @echo Generate static library $(COMMON_LIB_NAME) from $^ - $(AR) $(ARFLAGS) $(COMMON_LIB_FULL_NAME) $^ - -# common lib objs -$(COMMON_LIB_OBJS):%.o: %.c $(COMMON_LIB_HFILES) - @echo Compile $< - $(CC) -c $(CFLAGS) -o $@ $< $(C_INCLUDE_FLAG) - -clean: - $(RM) $(RMFLAGS) \ - $(COMMON_LIB_OBJS) \ - $(COMMON_LIB_FULL_NAME) - -install: - cp $(CURDIR)/../src/common/api/timl.h $(DESTDIR)/usr/include/timl.h - cp $(CURDIR)/../src/common/cnn/timlCNN.h $(DESTDIR)/usr/include/timlCNN.h - cp $(CURDIR)/../src/common/util/timlUtil.h $(DESTDIR)/usr/include/timlUtil.h - cp $(CURDIR)/../bin/libtiml.a $(DESTDIR)/usr/lib/libtiml.a diff --git a/debian/changelog b/debian/changelog index eed3d9e..4090747 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,15 @@ -ti-ml (01.00.02.01-0ubuntu0~ppa1) trusty; urgency=medium +ti-ml (01.00.02.00-0ubuntu0~ppa3) trusty; urgency=medium + + * Update CIFAR10 Testing example + + -- TI Keystone PPA Thu, 26 May 2015 10:45:15 -0400 + + +ti-ml (01.00.02.00-0ubuntu0~ppa2) trusty; urgency=medium * Remove the deleted files from the repository - -- TI Keystone PPA Thu, 21 May 2015 15:43:15 -0400 + -- TI Keystone PPA Thu, 26 May 2015 10:43:15 -0400 ti-ml (01.00.02.00-0ubuntu0~ppa1) trusty; urgency=medium diff --git a/debian/changelog~ b/debian/changelog~ deleted file mode 100644 index eed3d9e..0000000 --- a/debian/changelog~ +++ /dev/null @@ -1,47 +0,0 @@ -ti-ml (01.00.02.01-0ubuntu0~ppa1) trusty; urgency=medium - - * Remove the deleted files from the repository - - -- TI Keystone PPA Thu, 21 May 2015 15:43:15 -0400 - -ti-ml (01.00.02.00-0ubuntu0~ppa1) trusty; urgency=medium - - * Fix for compilation of the 'caffe' example - * Enable CNN states write/read - * Enable minimum memory mode for CNN testing - * Enable batch mode for CNN testing/training - * Add new layer types, accuracy layer, softmaxCost layer - * Remove softmax layer from nonlinear layer to be a new layer type - - -- TI Keystone PPA Thu, 21 May 2015 15:43:15 -0400 - -ti-ml (01.00.01.00-0ubuntu0~ppa3) trusty; urgency=medium - - * Fixes for cross compilation - - -- TI Keystone PPA Wed, 20 May 2015 19:04:55 -0400 - -ti-ml (01.00.01.00-0ubuntu0~ppa2) trusty; urgency=medium - - * Adding .testcfg and .testignore files for HPC autotests - - -- TI Keystone PPA Sat, 02 May 2015 16:54:33 -0400 - -ti-ml (01.00.01.00-0ubuntu0~ppa1) trusty; urgency=medium - - * Added pre-downloaded images to one of the examples(appCNNClassCIFAR10) - - -- TI Keystone PPA Fri, 01 May 2015 04:04:49 +0000 - -ti-ml (01.00.00.00-0ubuntu0~ppa2) trusty; urgency=medium - - * Fixing debian/control - - -- TI Keystone PPA Thu, 02 Apr 2015 12:44:35 -0400 - -ti-ml (01.00.00.00-0ubuntu0~ppa1) trusty; urgency=medium - - * Initial release with TI Machine Learning (TIML) library. - - -- TI Keystone PPA Mon, 23 Feb 2015 23:26:20 +0000 - diff --git a/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c b/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c index e75be12..b3d5e38 100644 --- a/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c +++ b/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c @@ -91,13 +91,16 @@ int appCNNClassCIFAR10Testing() struct timespec endTime; long testingTime; int topN; - timlUtilImageSet training; timlUtilImageSet testing; size_t mem1; size_t mem2; size_t mem3; + FILE *fp; + timlUtilImage image; + char str[TIML_UTIL_MAX_STR]; // init + int i; err = 0; dim = IMAGE_ROW*IMAGE_COL*IMAGE_CHANNEL; classifyNum = 0; @@ -112,6 +115,7 @@ int appCNNClassCIFAR10Testing() timlCNNInitialize(cnn); timlCNNLoadParamsFromFile(cnn, cnn->paramsFileName); timlCNNSetMode(cnn, Util_Test); + timlCNNSetBatchSize(cnn, 1); timlCNNPrint(cnn); mem1 = cnn->forwardMemory + cnn->backwardMemory + cnn->fixedMemory + cnn->paramsMemory; @@ -124,28 +128,27 @@ int appCNNClassCIFAR10Testing() printf("CNN memory pool size = %10.4f MB.\n", (float)cnn->memPoolSize/1024.0/1024.0); printf("CNN params memory size = %10.4f MB.\n", (float)cnn->paramsMemory/1024.0/1024.0); - // read CIFAR10 database - // printf("2. Read CIFAR10 database\n"); - // timlUtilReadCIFAR10(DATABASE_PATH, &training, &testing); - - testing.data = malloc(sizeof(float)*IMAGE_ROW*IMAGE_COL*IMAGE_CHANNEL*IMAGE_NUM); - testing.label = malloc(sizeof(int)*IMAGE_NUM); - testing.num = IMAGE_NUM; - - // read labels - fp = fopen(LABEL_PATH, "rt"); - for (i = 0; i < IMAGE_NUM; i++) { - read = fscanf(fp, "%d", testing.label + i); - } - fclose(fp); - - // read images - for (i = 0; i < IMAGE_NUM; i++) { - sprintf(str, IMAGE_PATH, i); - image = timlUtilReadJPEG(str); - cblas_scopy(dim, image.data, 1, testing.data + i*dim, 1); - free(image.data); - } +// // read CIFAR10 database +// printf("2. Read CIFAR10 database\n"); +// timlUtilReadCIFAR10(DATABASE_PATH, &training, &testing); + testing.data = malloc(sizeof(float)*IMAGE_ROW*IMAGE_COL*IMAGE_CHANNEL*IMAGE_NUM); + testing.label = malloc(sizeof(int)*IMAGE_NUM); + testing.num = IMAGE_NUM; + + // read labels + fp = fopen(LABEL_PATH, "rt"); + for (i = 0; i < IMAGE_NUM; i++) { + fscanf(fp, "%d", testing.label + i); + } + fclose(fp); + + // read images + for (i = 0; i < IMAGE_NUM; i++) { + sprintf(str, IMAGE_PATH, i); + image = timlUtilReadJPEG(str); + cblas_scopy(dim, image.data, 1, testing.data + i*dim, 1); + free(image.data); + } // testing printf("3. Start testing\n"); @@ -159,8 +162,6 @@ int appCNNClassCIFAR10Testing() // cleaning printf("4. Clean up\n"); - free(training.data); - free(training.label); free(testing.data); free(testing.label); timlCNNDelete(cnn); diff --git a/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c~ b/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c~ deleted file mode 100644 index cf6f76c..0000000 --- a/src/app/cnn/class/cifar10/appCNNClassCIFAR10Testing.c~ +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************/ -/*! - * \file appCNNClassCIFAR10Testing.c - */ -/* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ - * - * 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 Texas Instruments Incorporated 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. - * - ******************************************************************************/ - - -/******************************************************************************* - * - * INCLUDES - * - ******************************************************************************/ - -#include "../appCNNClass.h" - - -/******************************************************************************* - * - * DEFINES - * - ******************************************************************************/ - -#define MODEL_PATH "../../../../database/model/cifar10/databaseModelCIFAR10.m" -#define DATABASE_PATH "../../../../database/cifar10" -#define IMAGE_PATH "../../../../database/cifar10/%1d.jpg" -#define LABEL_PATH "../../../../database/cifar10/label.txt" -#define IMAGE_NUM 3 -#define TOP_N 1 -#define IMAGE_ROW 32 -#define IMAGE_COL 32 -#define IMAGE_CHANNEL 3 - - -/******************************************************************************* - * - * main() - * - ******************************************************************************/ - -int main() -{ - return appCNNClassCIFAR10Testing(); -} - - -/******************************************************************************/ -/*! - * \ingroup appCNNClass - * \brief CIFAR10 testing example - */ -/******************************************************************************/ - -int appCNNClassCIFAR10Testing() -{ - int err; - int classifyNum; - float classifyPercent; - int dim; - long mem; - struct timespec startTime; - struct timespec endTime; - long testingTime; - int topN; - timlUtilImageSet training; - timlUtilImageSet testing; - size_t mem1; - size_t mem2; - size_t mem3; - - // init - err = 0; - dim = IMAGE_ROW*IMAGE_COL*IMAGE_CHANNEL; - classifyNum = 0; - topN = TOP_N; - - setbuf(stdout, NULL); // do not buffer the console output - - // read the CNN config file - printf("1. Read the CNN config\n"); - timlConvNeuralNetwork *cnn = timlCNNReadFromFile(MODEL_PATH); - timlCNNAddAccuracyLayer(cnn, TOP_N); - timlCNNInitialize(cnn); - timlCNNLoadParamsFromFile(cnn, cnn->paramsFileName); - timlCNNSetMode(cnn, Util_Test); - timlCNNPrint(cnn); - - mem1 = cnn->forwardMemory + cnn->backwardMemory + cnn->fixedMemory + cnn->paramsMemory; - mem2 = cnn->forwardMemory + cnn->fixedMemory + cnn->paramsMemory; - mem3 = cnn->memPoolSize + cnn->fixedMemory + cnn->paramsMemory; - printf("CNN level 1 memory size = %10.4f MB.\n", (float)mem1/1024.0/1024.0); - printf("CNN level 2 memory size = %10.4f MB.\n", (float)mem2/1024.0/1024.0); - printf("CNN level 3 memory size = %10.4f MB.\n", (float)mem3/1024.0/1024.0); - printf("CNN forward memory size = %10.4f MB.\n", (float)cnn->forwardMemory/1024.0/1024.0); - printf("CNN memory pool size = %10.4f MB.\n", (float)cnn->memPoolSize/1024.0/1024.0); - printf("CNN params memory size = %10.4f MB.\n", (float)cnn->paramsMemory/1024.0/1024.0); - - // read CIFAR10 database - // printf("2. Read CIFAR10 database\n"); - // timlUtilReadCIFAR10(DATABASE_PATH, &training, &testing); - - testing.data = malloc(sizeof(float)*IMAGE_ROW*IMAGE_COL*IMAGE_CHANNEL*IMAGE_NUM); - testing.label = malloc(sizeof(int)*IMAGE_NUM); - testing.num = IMAGE_NUM; - // read labels - fp = fopen(LABEL_PATH, "rt"); - for (i = 0; i < IMAGE_NUM; i++) { - read = fscanf(fp, "%d", testing.label + i); - } - fclose(fp); - - // read images - for (i = 0; i < IMAGE_NUM; i++) { - sprintf(str, IMAGE_PATH, i); - image = timlUtilReadJPEG(str); - cblas_scopy(dim, image.data, 1, testing.data + i*dim, 1); - free(image.data); - } - - // testing - printf("3. Start testing\n"); - clock_gettime(CLOCK_REALTIME, &startTime); - timlCNNClassifyAccuracy(cnn, testing.data, IMAGE_ROW, IMAGE_COL, IMAGE_CHANNEL, testing.label, 1, 1, testing.num, &classifyNum); - clock_gettime(CLOCK_REALTIME, &endTime); - testingTime = timlUtilDiffTime(startTime, endTime); - classifyPercent = (float)classifyNum/(float)testing.num; - printf("Testing time = %.3f s\n", testingTime/1000000.0); - printf("Classify accuracy = %.3f %%\n", classifyPercent*100.00); - - // cleaning - printf("4. Clean up\n"); - free(training.data); - free(training.label); - free(testing.data); - free(testing.label); - timlCNNDelete(cnn); - - return err; -} diff --git a/src/app/makefile~ b/src/app/makefile~ deleted file mode 100755 index a914ca9..0000000 --- a/src/app/makefile~ +++ /dev/null @@ -1,182 +0,0 @@ -################################################################################ -# -# makefile -# -# Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ -# -# 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 Texas Instruments Incorporated 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. -# -################################################################################ - -UNAME_M :=$(shell uname -m) -ifneq (,$(findstring 86, $(UNAME_M))) - # In a cross compile environment we are assuming that the EVM file system - # is located on the build host and necessary ARM libraries are installed - # on that file system. - ifneq ($(MAKECMDGOALS),clean) - ifeq ($(TARGET_ROOTDIR),) - $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system) - endif - endif - - # gcc ARM cross compiler will not, by default, search the host's - # /usr/include. Explicitly specify here to find dependent vendor headers -CC = arm-linux-gnueabihf-gcc -CPPC = arm-linux-gnueabihf-g++ -AR = arm-linux-gnueabihf-ar -else -CC = gcc -CPPC = g++ -AR = @ar -endif - - - -C_INCLUDE_PATH = ../common/api ../common/cnn ../common/util \ -$(TARGET_ROOTDIR)/usr/include -C_INCLUDE_PATH_FLAG = $(foreach d, $(C_INCLUDE_PATH), -I$d) -C_LIB = timl cblas_armplusdsp blis OpenCL stdc++ rt jpeg m -C_LIB_FLAG = $(foreach d, $(C_LIB), -l$d) -C_LIB_PATH = $(TARGET_ROOTDIR)/usr/lib ../../bin -C_LIB_PATH_FLAG = $(foreach d, $(C_LIB_PATH), -L$d) -CFLAGS += -g -O3 -fopenmp -LD_FLAGS=-L$(TARGET_ROOTDIR)/lib -L$(TARGET_ROOTDIR)/usr/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/usr/lib - -ARFLAGS = -rcs -RM = @rm -RMFLAGS += -fr - - -# APP CNN CLASS -APP_CNN_CLASS_BIN_CFILES = $(shell find ./cnn/class -name "*.c") -APP_CNN_CLASS_BIN_OBJS = $(patsubst %.c, %.o, $(APP_CNN_CLASS_BIN_CFILES)) -APP_CNN_CLASS_BINS = $(patsubst %.c, %.bin, $(APP_CNN_CLASS_BIN_CFILES)) -APP_CNN_CLASS_HFILES = $(shell find ./cnn/class -name "*.h") - -# APP CNN SL -APP_CNN_SL_BIN_HFILES = $(shell find ./cnn/scene -name "*.h") -APP_CNN_SL_BIN_CFILES = $(shell find ./cnn/scene/sbd -name "*.c") -APP_CNN_SL_BIN_OBJS = $(patsubst %.c, %.o, $(APP_CNN_SL_BIN_CFILES)) -APP_CNN_SL_BINS = $(patsubst %.c, %.bin, $(APP_CNN_SL_BIN_CFILES)) -APP_CNN_SL_CFILES = $(shell find ./cnn/scene -name "*.c") -APP_CNN_SL_OBJS = $(patsubst %.c, %.o, $(APP_CNN_SL_CFILES)) -APP_CNN_SL_AUX_OBJS = $(filter-out $(APP_CNN_SL_BIN_OBJS), $(APP_CNN_SL_OBJS)) - -# APP CNN INTEROP CAFFE -APP_CNN_INTEROP_CAFFE_BIN_CFILES = $(shell find ./cnn/interop/caffe -name "*.cpp") -APP_CNN_INTEROP_CAFFE_BIN_OBJS = $(patsubst %.cpp, %.o, $(APP_CNN_INTEROP_CAFFE_BIN_CFILES)) -APP_CNN_INTEROP_CAFFE_BINS = ./cnn/interop/caffe/appCNNInteropCaffe.bin -APP_CNN_INTEROP_CAFFE_HFILES = $(shell find ./cnn/interop/caffe -name "*.hpp") - -# APP CNN CONVERT IMAGENET -APP_CNN_CONVERT_IMAGENET_BIN_CFILES = $(shell find ./cnn/convert/imagenet -name "*.cpp") -APP_CNN_CONVERT_IMAGENET_BIN_OBJS = $(patsubst %.cpp, %.o, $(APP_CNN_CONVERT_IMAGENET_BIN_CFILES)) -APP_CNN_CONVERT_IMAGENET_BINS = ./cnn/convert/imagenet/appCNNConvertImageNet.bin -APP_CNN_CONVERT_IMAGENET_HFILES = $(shell find ./cnn/convert/imagenet -name "*.hpp") - -# APP CNN CONVERT SBD -APP_CNN_CONVERT_SBD_BIN_CFILES = $(shell find ./cnn/convert/sbd -name "*.cpp") -APP_CNN_CONVERT_SBD_BIN_OBJS = $(patsubst %.cpp, %.o, $(APP_CNN_CONVERT_SBD_BIN_CFILES)) -APP_CNN_CONVERT_SBD_BINS = ./cnn/convert/sbd/appCNNConvertSBD.bin -APP_CNN_CONVERT_SBD_HFILES = $(shell find ./cnn/convert/sbd -name "*.hpp") - - -APP_CNN_BINS = \ -$(APP_CNN_CLASS_BINS) \ -$(APP_CNN_SL_BINS) \ -$(APP_CNN_CONVERT_IMAGENET_BINS) \ -$(APP_CNN_CONVERT_SBD_BINS) \ -$(APP_CNN_INTEROP_CAFFE_BINS) - -APP_CNN_OBJS = \ -$(APP_CNN_CLASS_BIN_OBJS) \ -$(APP_CNN_SL_OBJS) \ -$(APP_CNN_INTEROP_CAFFE_BIN_OBJS) \ -$(APP_CNN_CONVERT_IMAGENET_BIN_OBJS) \ -$(APP_CNN_CONVERT_SBD_BIN_OBJS) - -all: $(APP_CNN_BINS) - -clean: - $(RM) $(RMFLAGS) \ - $(APP_CNN_OBJS) \ - $(APP_CNN_BINS) - -# appCNNClass bins -$(APP_CNN_CLASS_BINS): %.bin: %.o - $(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $^ \ - $(C_LIB_FLAG) $(C_LIB_PATH_FLAG) - -# appCNNClass objs -$(APP_CNN_CLASS_BIN_OBJS): %.o: %.c $(APP_CNN_CLASS_HFILES) - $(CC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \ - $(C_INCLUDE_PATH_FLAG) - -# appCNNScene bins -$(APP_CNN_SL_BINS): %.bin: %.o $(APP_CNN_SL_AUX_OBJS) - $(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $^ \ - $(C_LIB_FLAG) $(C_LIB_PATH_FLAG) - -# appCNNScene objs -$(APP_CNN_SL_OBJS): %.o: %.c $(APP_CNN_SL_HFILES) - $(CC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \ - $(C_INCLUDE_PATH_FLAG) - -# appCNNConvertImageNet bins -$(APP_CNN_CONVERT_IMAGENET_BINS): $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS) - $(CPPC) $(CFLAGS) $(LD_FLAGS) -o $(APP_CNN_CONVERT_IMAGENET_BINS) $^ \ - -lopencv_core -lopencv_highgui -lopencv_imgproc \ - $(C_LIB_PATH_FLAG) - -# appCNNConvertImageNet objs -$(APP_CNN_CONVERT_IMAGENET_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_IMAGENET_HFILES) - $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \ - $(C_INCLUDE_PATH_FLAG) - -# appCNNConvertSBD bins -$(APP_CNN_CONVERT_SBD_BINS): $(APP_CNN_CONVERT_SBD_BIN_OBJS) - $(CPPC) $(CPPFLAGS) $(LD_FLAGS) -o $(APP_CNN_CONVERT_SBD_BINS) $^ \ - -lopencv_core -lopencv_highgui -lopencv_imgproc \ - $(C_LIB_PATH_FLAG) - -# appCNNConvertSBD objs -$(APP_CNN_CONVERT_SBD_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_SBD_HFILES) - $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \ - $(C_INCLUDE_PATH_FLAG) - -# appCNNInteropCaffe bins -$(APP_CNN_INTEROP_CAFFE_BINS): $(APP_CNN_INTEROP_CAFFE_BIN_OBJS) - $(CPPC) $(CFLAGS) $(LD_FLAGS) -o $(APP_CNN_INTEROP_CAFFE_BINS) $^ \ - -lprotobuf \ - $(C_LIB_FLAG) $(C_LIB_PATH_FLAG) - -# appCNNInteropCaffe objs -$(APP_CNN_INTEROP_CAFFE_BIN_OBJS): %.o: %.cpp $(APP_CNN_INTEROP_CAFFE_HFILES) - $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $(LD_FLAGS) $@ $< \ - $(C_INCLUDE_PATH_FLAG) diff --git a/src/common/cnn/timlCNNSetBatchSize.c b/src/common/cnn/timlCNNSetBatchSize.c index 6298dad..451c203 100644 --- a/src/common/cnn/timlCNNSetBatchSize.c +++ b/src/common/cnn/timlCNNSetBatchSize.c @@ -55,6 +55,9 @@ int timlCNNSetBatchSize(timlConvNeuralNetwork *cnn, int batchSize) case CNN_SoftmaxCost: layer->batchSize = layer->prev->batchSize; break; + case CNN_Softmax: + layer->batchSize = layer->prev->batchSize; + break; default: break; } -- 2.39.2