├── LICENSE ├── README.md ├── docs └── wiki │ ├── caffe_comparison.png │ ├── caffe_network_mnist.png │ └── ex1_hellocaffe │ ├── main.png │ └── project.png ├── examples ├── .directory ├── ex0_cudatest │ ├── CMakeLists.txt │ ├── axpygpu.cu │ ├── axpygpu.h │ └── main.cpp ├── ex1_hellocaffe │ ├── CMakeLists.txt │ └── main.cpp ├── ex2_blob │ ├── CMakeLists.txt │ ├── ex_blob.cpp │ └── ex_math.cpp ├── ex3_mnist │ ├── .ipynb_checkpoints │ │ └── caffe_ex3_mnist-checkpoint.ipynb │ ├── caffe_ex3_mnist.md │ └── caffe_ex3_mnist_files │ │ ├── caffe_ex3_mnist_33_0.text │ │ ├── caffe_ex3_mnist_35_0.text │ │ ├── caffe_ex3_mnist_35_1.png │ │ ├── caffe_ex3_mnist_35_1.text │ │ └── caffe_ex3_mnist_37_0.text ├── ex4_layer │ ├── CMakeLists.txt │ └── main.cpp ├── ex5_logreg_mnist-build │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 2.8.12.2 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── cmake.check_cache │ │ ├── ex_logreg_mnist.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── ex_logreg_mnist.cpp.o │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── progress.make │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── ex_logreg.cbp │ └── ex_logreg_mnist ├── ex5_logreg_mnist │ ├── CMakeLists.txt │ └── ex_logreg_mnist.cpp ├── ex6_lenet_mnist │ ├── CMakeLists.txt │ ├── CMakeLists.txt.user │ └── ex_lenet_mnist.cpp └── ex7_net │ ├── CMakeLists.txt │ ├── bindb.cpp │ ├── logreg_test.cpp │ └── logreg_train.cpp └── notebook ├── .ipynb_checkpoints ├── ex4_layer-checkpoint.ipynb └── ex5_logreg_mnist-checkpoint.ipynb ├── ex3_mnist.ipynb ├── ex4_layer.ipynb ├── ex4_layer.md ├── ex5_logreg_mnist.ipynb ├── ex5_logreg_mnist.md └── logreg.jpg /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, koosyong 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 목적 2 | 1. [caffe 오픈소스](http://caffe.berkeleyvision.org/) 분석을 통해 [deep learning](http://deeplearning.net/) 이해. 3 | 2. caffe 에서 사용하는 GPU programming (NVIDIA CUDA), BLAST, Google protocol buffers, lmdb 등 유용한 dependent 라이브러리들의 이해 및 활용 4 | 3. caffe test source code 분석을 통한 caffe architecture 및 usage 이해 5 | 4. 다른 머신러닝, 컴퓨터비젼, 로보틱스 소프트웨어 개발을 위한 source level 에서의 caffe 라이브러리 활용 6 | 5. 스터디 자료들을 모아서 튜토리얼 제작 및 공동 프로젝트 ?? 7 | 8 | ### 대상 9 | 원하는 사람 아무나. 10 | 적극적으로 컨텐츠를 만들어 주실 분들부터 wiki page를 보고 공부를 하실 분들, 눈팅만 하실 분들까지 참여에는 제한이 없습니다. 저희도 모두 처음에는 눈팅부터 시작하니깐요. 언젠가는 모두 협력하여 의미있는 오픈 커뮤니티가 될 것을 기대합니다. 11 | wiki page는 아무나 편집하셔도 됩니다. (이 readme 파일도 마음에 안드시면 바꾸셔도 됩니다. ㅎㅎ) 12 | 13 | ### 운영에 관하여 14 | * [Issue](https://github.com/koosyong/caffestudy/issues) 페이지에서 의견을 나눠 주시기 바랍니다. 15 | * [Wiki page](https://github.com/koosyong/caffestudy/wiki) 에 하나씩 하나씩 컨텐츠를 채워가려고 합니다. 스터디 그룹인 만큼 많은 분들이 같이 참여하여 주시길 바랍니다. 16 | * [Source code](https://github.com/koosyong/caffestudy) GIT 를 이용하셔서 스터디에 필요한 소스코드를 올려주시기 바랍니다. GIT가 처음인 분들은 [관련 이슈](https://github.com/koosyong/caffestudy/issues/4) 에 질문을 남겨주세요. 17 | * 새로운 업데이트를 받아보시기 원하시는 분들은 위에 눈모양으로 생긴 Notifications 버튼을 'Watching'으로 바꿔주세요. 또는 일부 Issue에 관한 내용만 받아보시길 원하면 각 Issue 별로 'subscribe' 버튼이 있습니다. 18 | * 아래 베너를 누르시면 그룹 채팅할 수 있습니다. [@jihoonl](https://github.com/jihoonl) 님께서 추천해 주셨습니다. 19 | 20 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/koosyong/caffestudy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) 21 | -------------------------------------------------------------------------------- /docs/wiki/caffe_comparison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/docs/wiki/caffe_comparison.png -------------------------------------------------------------------------------- /docs/wiki/caffe_network_mnist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/docs/wiki/caffe_network_mnist.png -------------------------------------------------------------------------------- /docs/wiki/ex1_hellocaffe/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/docs/wiki/ex1_hellocaffe/main.png -------------------------------------------------------------------------------- /docs/wiki/ex1_hellocaffe/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/docs/wiki/ex1_hellocaffe/project.png -------------------------------------------------------------------------------- /examples/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2015,8,4,16,23,37 3 | Version=3 4 | -------------------------------------------------------------------------------- /examples/ex0_cudatest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | 3 | project (cudatest) 4 | 5 | ## CUDA 6 | FIND_PACKAGE(CUDA REQUIRED) 7 | INCLUDE(FindCUDA) 8 | 9 | set (SOURCES 10 | main.cpp 11 | axpygpu.cu 12 | ) 13 | 14 | set (HEADERS 15 | axpygpu.h 16 | ) 17 | 18 | CUDA_ADD_LIBRARY (axpygpulib 19 | axpygpu.cu 20 | axpygpu.h 21 | ) 22 | 23 | CUDA_ADD_EXECUTABLE(cudatest axpygpu.cu) 24 | ADD_EXECUTABLE (cudatest ${SOURCES} ${HEADERS}) 25 | TARGET_LINK_LIBRARIES (cudatest) 26 | -------------------------------------------------------------------------------- /examples/ex0_cudatest/axpygpu.cu: -------------------------------------------------------------------------------- 1 | #include "axpygpu.h" 2 | 3 | __global__ void axpy(float a, float *x, float *y) 4 | { 5 | int i = blockIdx.x*blockDim.x + threadIdx.x; 6 | y[i] = a*x[i] + y[i]; 7 | } 8 | 9 | AXPYGPU::AXPYGPU(int n_block_, int n_thread_, float a_) 10 | :n_block(n_block_), n_thread(n_thread_), a(a_) 11 | { 12 | n = n_block * n_thread; 13 | cudaMalloc((void **) &x, n*sizeof(float)); 14 | cudaMalloc((void **) &y, n*sizeof(float)); 15 | } 16 | 17 | void AXPYGPU::compute(float* x_, float* y_, float* z_) 18 | { 19 | cudaMemcpy(x, x_, n*sizeof(float), cudaMemcpyHostToDevice); 20 | cudaMemcpy(y, y_, n*sizeof(float), cudaMemcpyHostToDevice); 21 | 22 | axpy<<>>(a,x,y); 23 | 24 | cudaMemcpy(z_, y, n*sizeof(float), cudaMemcpyDeviceToHost); 25 | 26 | cudaFree(x); 27 | cudaFree(y); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/ex0_cudatest/axpygpu.h: -------------------------------------------------------------------------------- 1 | #ifndef AXPYGPU_H 2 | #define AXPYGPU_H 3 | 4 | #include 5 | #include 6 | 7 | class AXPYGPU 8 | { 9 | public: 10 | AXPYGPU() {} 11 | AXPYGPU(int n_block_, int n_thread_, float a_); 12 | ~AXPYGPU() {} 13 | 14 | int n_block, n_thread, n; 15 | float a; 16 | float *x; 17 | float *y; 18 | 19 | void compute(float* x_, float* y_, float* z_); 20 | }; 21 | 22 | #endif // AXPYGPU_H 23 | -------------------------------------------------------------------------------- /examples/ex0_cudatest/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "axpygpu.h" 3 | 4 | using namespace std; 5 | 6 | int main (int argc, char** argv) 7 | { 8 | int n_block = 10; 9 | int n_thread = 5; 10 | int a = 2.0; 11 | AXPYGPU axpy_gpu(n_block, n_thread, a); 12 | 13 | int n = n_block*n_thread; 14 | float *x, *y, *z; 15 | x = new float[n]; 16 | y = new float[n]; 17 | z = new float[n]; 18 | 19 | for(int i=0;i 2 | 3 | #include "caffe/caffe.hpp" 4 | #include "caffe/util/io.hpp" 5 | #include "caffe/blob.hpp" 6 | #include "caffe/common.hpp" 7 | #include "caffe/filler.hpp" 8 | 9 | using namespace caffe; 10 | using namespace std; 11 | typedef double Dtype; 12 | 13 | int main(int argc, char** argv) { 14 | Blob* const blob = new Blob(20, 30, 40, 50); 15 | if(blob){ 16 | cout<<"Size of blob:"; 17 | cout<<" N="<num(); 18 | cout<<" K="<channels(); 19 | cout<<" H="<height(); 20 | cout<<" W="<width(); 21 | cout<<" C="<count(); 22 | cout< filler(filler_param); 30 | filler.Fill(blob); 31 | 32 | // absolute sum of blob 33 | Dtype expected_asum = 0; 34 | const Dtype* data = blob->cpu_data(); 35 | for (int i = 0; i < blob->count(); ++i) { 36 | expected_asum += fabs(data[i]); 37 | } 38 | cout<<"expected asum of blob: "<asum_data()<* const blob = new Blob(20, 30, 40, 50); 20 | if(blob){ 21 | cout<<"Size of blob:"; 22 | cout<<" N="<num(); 23 | cout<<" K="<channels(); 24 | cout<<" H="<height(); 25 | cout<<" W="<width(); 26 | cout<<" C="<count(); 27 | cout<Reshape(50, 40, 30, 20); 32 | if(blob){ 33 | cout<<"Size of reshaped blob:"; 34 | cout<<" N="<num(); 35 | cout<<" K="<channels(); 36 | cout<<" H="<height(); 37 | cout<<" W="<width(); 38 | cout<<" C="<count(); 39 | cout< filler(filler_param); 47 | filler.Fill(blob); 48 | 49 | //// sum of squares 50 | // access data on the host 51 | Dtype expected_sumsq = 0; 52 | const Dtype* data = blob->cpu_data(); 53 | for (int i = 0; i < blob->count(); ++i) { 54 | expected_sumsq += data[i] * data[i]; 55 | } 56 | cout<sumsq_data()<gpu_data(); // memcopy host to device (to_gpu() in syncedmem.cpp) 67 | tEnd = clock(); 68 | COMPTIME("cpu->gpu time"); 69 | 70 | tStart = clock(); 71 | cout<<"sumsq of blob on gpu: "<sumsq_data()<gpu_data(); // no data copy since both have up-to-date contents. 79 | tEnd = clock(); 80 | COMPTIME("cpu->gpu time"); 81 | 82 | // gpu data manipulation 83 | const Dtype kDataScaleFactor = 2; 84 | blob->scale_data(kDataScaleFactor); // change data on gpu 85 | 86 | tStart = clock(); 87 | blob->cpu_data(); // memcopy device to host (to_cpu() in syncedmem.cpp) 88 | tEnd = clock(); 89 | COMPTIME("gpu->cpu time"); 90 | 91 | tStart = clock(); 92 | cout<<"sumsq of blob on gpu: "<sumsq_data()<* blob_in = new Blob(20, 30, 40, 50); 15 | Blob* blob_out = new Blob(20, 30, 40, 50); 16 | int n = blob_in->count(); 17 | 18 | // random number generation 19 | caffe_gpu_rng_uniform(n, -3, 3, blob_in->mutable_gpu_data()); 20 | 21 | // asum 22 | Dtype asum; 23 | caffe_gpu_asum(n, blob_in->gpu_data(), &asum); 24 | cout<<"asum: "<(n, blob_in->gpu_data(), blob_out->mutable_gpu_data()); 28 | caffe_gpu_sgnbit(n, blob_in->gpu_data(), blob_out->mutable_gpu_data()); 29 | caffe_gpu_abs(n, blob_in->gpu_data(), blob_out->mutable_gpu_data()); 30 | caffe_gpu_scale(n, 10, blob_in->gpu_data(), blob_out->mutable_gpu_data()); 31 | 32 | // 33 | // caffe_gpu_gemm 34 | // caffe_gpu_gemv 35 | // caffe_gpu_axpy 36 | // caffe_gpu_axpby 37 | // caffe_gpu_add_scalar 38 | // caffe_gpu_add 39 | // caffe_gpu_sub 40 | // caffe_gpu_mul 41 | // caffe_gpu_div 42 | // caffe_gpu_exp 43 | // caffe_gpu_powx 44 | // caffe_copy 45 | 46 | const Dtype* x = blob_out->cpu_data(); 47 | for (int i = 0; i < n; ++i) cout< 00\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" 114 | label: 5 115 | 116 | 보시다시피 하나의 Datum은 channels, height, width, data, label 으로 이루어져 있습니다. 즉 앞의 예제에서 117 | 살펴본 blob의 구조 중에서 첫번째 차원인 numbers 를 제외한 3차원 구조 + label 데이터를 담을 수 있는데요, 실제 데이터는 118 | 1차원 스트링으로 되어있고, 차원 정보만 있음을 알 수 있습니다. 119 | 120 | 이번에는 Datum에 명시된데로(1 x 28 x 28) 데이터를 다차원 배열로 복구해 보겠습니다. numpy를 이용하여 unsigned int 121 | 타입으로 변환하고, `reshape()` 명령을 사용해서 차원 변환을 합니다. 122 | 123 | 124 | flat_x = np.fromstring(datum_train_start.data, dtype=np.uint8) 125 | x = flat_x.reshape(datum_train_start.height, datum_train_start.width) 126 | 127 | `x`가 2차원 배열로 잘 변환이 되었나 확인해 봅시다. 128 | 129 | 130 | x.shape 131 | 132 | 133 | 134 | 135 | (28, 28) 136 | 137 | 138 | 139 | 이번에는 matplotlib.pyplot의 `imshow` 명령을 사용해서 이차원 이미지 데이터를 시각화해 봅시다. 트레이닝 데이터셋의 첫 번째 140 | 이미지는 아래 보는것과 같이 숫자 5이군요. 141 | 142 | 143 | plt.rcParams['image.interpolation'] = 'none' 144 | plt.rcParams['image.cmap'] = 'gray' 145 | plt.imshow(x) 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | ![png](caffe_ex3_mnist_files/caffe_ex3_mnist_35_1.png) 156 | 157 | 158 | `datum_train_start`에 저장된 라벨값도 같은지 확인해 봅시다. 159 | 160 | 161 | datum_train_start.label 162 | 163 | 164 | 165 | 166 | 5 167 | 168 | 169 | 170 | ## 맺음말 171 | 172 | 이번 강좌에서는 LMDB로 변환한 MNIST 데이터셋을 파이썬으로 읽어오고, 카페 파이썬 라이브러리를 이용하여 각 데이터와 라벨을 읽고 시각화 173 | 해서 확인해 보았습니다. Datum 이라는 카페에서 사용하는 데이터구조가 데이터를 데이터베이스에 저장하거나 읽어오는 인터페이스 역할을 하는것도 174 | 알아보았습니다. 다음번에는 C++ 코드에서 각 Datum을 어떻게 Blob으로 만드는지, 그리고 이렇게 읽은 MNIST 데이터를 실제로 활용하여 175 | 머신러닝 알고리즘들을 구현해 보도록 하겠습니다. 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_33_0.text: -------------------------------------------------------------------------------- 1 | (28, 28) -------------------------------------------------------------------------------- /examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_35_0.text: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_35_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_35_1.png -------------------------------------------------------------------------------- /examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_35_1.text: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/ex3_mnist/caffe_ex3_mnist_files/caffe_ex3_mnist_37_0.text: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /examples/ex4_layer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(argmax_test) 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | find_package(Caffe) 5 | include_directories(${Caffe_INCLUDE_DIRS}) 6 | add_definitions(${Caffe_DEFINITIONS}) 7 | 8 | add_executable(argmax_test main.cpp) 9 | target_link_libraries(argmax_test ${Caffe_LIBRARIES}) 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ex4_layer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "caffe/caffe.hpp" 4 | #include "caffe/blob.hpp" 5 | #include "caffe/common.hpp" 6 | #include "caffe/filler.hpp" 7 | #include "caffe/layers/argmax_layer.hpp" 8 | 9 | using namespace caffe; 10 | using namespace std; 11 | 12 | typedef double Dtype; 13 | 14 | int main(int argc, char** argv) { 15 | Caffe::set_mode(Caffe::CPU); 16 | Caffe::set_random_seed(1701); 17 | 18 | // bottom/top blobs 19 | Blob* blob_top = new Blob(); 20 | Blob* blob_bottom = new Blob(10, 20, 1, 1); 21 | FillerParameter filler_param; 22 | GaussianFiller filler(filler_param); 23 | filler.Fill(blob_bottom); 24 | 25 | // blob vector 26 | vector*> blob_bottom_vec; 27 | vector*> blob_top_vec; 28 | blob_bottom_vec.push_back(blob_bottom); 29 | blob_top_vec.push_back(blob_top); 30 | 31 | // argmax layer 32 | LayerParameter layer_param; 33 | ArgMaxParameter* argmax_param = layer_param.mutable_argmax_param(); 34 | argmax_param->set_out_max_val(true); // two channel: 0 arg, 1 max_val 35 | ArgMaxLayer layer(layer_param); 36 | layer.SetUp(blob_bottom_vec, blob_top_vec); 37 | 38 | cout<<"blob_top_num:"<num()<num()<channels()<cpu_data(); 47 | const Dtype* top_data = blob_top->cpu_data(); 48 | 49 | int max_ind; 50 | Dtype max_val; 51 | int num = blob_bottom->num(); 52 | int dim = blob_bottom->count() / num; 53 | for (int i = 0; i < num; ++i) { 54 | max_ind = top_data[blob_top->offset(i,0,0,0)]; 55 | max_val = top_data[blob_top->offset(i,1,0,0)]; 56 | cout<<"max_ind:"<>24 & 0x00FF) 40 | # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) 41 | # define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) 42 | 43 | #elif defined(__BORLANDC__) 44 | # define COMPILER_ID "Borland" 45 | /* __BORLANDC__ = 0xVRR */ 46 | # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 47 | # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 48 | 49 | #elif defined(__WATCOMC__) 50 | # define COMPILER_ID "Watcom" 51 | /* __WATCOMC__ = VVRR */ 52 | # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) 53 | # define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) 54 | 55 | #elif defined(__SUNPRO_C) 56 | # define COMPILER_ID "SunPro" 57 | # if __SUNPRO_C >= 0x5100 58 | /* __SUNPRO_C = 0xVRRP */ 59 | # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) 60 | # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) 61 | # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 62 | # else 63 | /* __SUNPRO_C = 0xVRP */ 64 | # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) 65 | # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) 66 | # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 67 | # endif 68 | 69 | #elif defined(__HP_cc) 70 | # define COMPILER_ID "HP" 71 | /* __HP_cc = VVRRPP */ 72 | # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) 73 | # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) 74 | # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) 75 | 76 | #elif defined(__DECC) 77 | # define COMPILER_ID "Compaq" 78 | /* __DECC_VER = VVRRTPPPP */ 79 | # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) 80 | # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) 81 | # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) 82 | 83 | #elif defined(__IBMC__) 84 | # if defined(__COMPILER_VER__) 85 | # define COMPILER_ID "zOS" 86 | # else 87 | # if __IBMC__ >= 800 88 | # define COMPILER_ID "XL" 89 | # else 90 | # define COMPILER_ID "VisualAge" 91 | # endif 92 | /* __IBMC__ = VRP */ 93 | # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 94 | # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 95 | # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 96 | # endif 97 | 98 | #elif defined(__PGI) 99 | # define COMPILER_ID "PGI" 100 | # define COMPILER_VERSION_MAJOR DEC(__PGIC__) 101 | # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) 102 | # if defined(__PGIC_PATCHLEVEL__) 103 | # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) 104 | # endif 105 | 106 | #elif defined(_CRAYC) 107 | # define COMPILER_ID "Cray" 108 | # define COMPILER_VERSION_MAJOR DEC(_RELEASE) 109 | # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) 110 | 111 | #elif defined(__TI_COMPILER_VERSION__) 112 | # define COMPILER_ID "TI" 113 | /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ 114 | # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) 115 | # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) 116 | # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) 117 | 118 | #elif defined(__TINYC__) 119 | # define COMPILER_ID "TinyCC" 120 | 121 | #elif defined(__SCO_VERSION__) 122 | # define COMPILER_ID "SCO" 123 | 124 | #elif defined(__GNUC__) 125 | # define COMPILER_ID "GNU" 126 | # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 127 | # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 128 | # if defined(__GNUC_PATCHLEVEL__) 129 | # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 130 | # endif 131 | 132 | #elif defined(_MSC_VER) 133 | # define COMPILER_ID "MSVC" 134 | /* _MSC_VER = VVRR */ 135 | # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) 136 | # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) 137 | # if defined(_MSC_FULL_VER) 138 | # if _MSC_VER >= 1400 139 | /* _MSC_FULL_VER = VVRRPPPPP */ 140 | # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 141 | # else 142 | /* _MSC_FULL_VER = VVRRPPPP */ 143 | # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 144 | # endif 145 | # endif 146 | # if defined(_MSC_BUILD) 147 | # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 148 | # endif 149 | 150 | /* Analog VisualDSP++ >= 4.5.6 */ 151 | #elif defined(__VISUALDSPVERSION__) 152 | # define COMPILER_ID "ADSP" 153 | /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ 154 | # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) 155 | # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) 156 | # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) 157 | 158 | /* Analog VisualDSP++ < 4.5.6 */ 159 | #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 160 | # define COMPILER_ID "ADSP" 161 | 162 | /* IAR Systems compiler for embedded systems. 163 | http://www.iar.com */ 164 | #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) 165 | # define COMPILER_ID "IAR" 166 | 167 | /* sdcc, the small devices C compiler for embedded systems, 168 | http://sdcc.sourceforge.net */ 169 | #elif defined(SDCC) 170 | # define COMPILER_ID "SDCC" 171 | /* SDCC = VRP */ 172 | # define COMPILER_VERSION_MAJOR DEC(SDCC/100) 173 | # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) 174 | # define COMPILER_VERSION_PATCH DEC(SDCC % 10) 175 | 176 | #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 177 | # define COMPILER_ID "MIPSpro" 178 | # if defined(_SGI_COMPILER_VERSION) 179 | /* _SGI_COMPILER_VERSION = VRP */ 180 | # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) 181 | # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) 182 | # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) 183 | # else 184 | /* _COMPILER_VERSION = VRP */ 185 | # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) 186 | # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) 187 | # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) 188 | # endif 189 | 190 | /* This compiler is either not known or is too old to define an 191 | identification macro. Try to identify the platform and guess that 192 | it is the native compiler. */ 193 | #elif defined(__sgi) 194 | # define COMPILER_ID "MIPSpro" 195 | 196 | #elif defined(__hpux) || defined(__hpua) 197 | # define COMPILER_ID "HP" 198 | 199 | #else /* unknown compiler */ 200 | # define COMPILER_ID "" 201 | 202 | #endif 203 | 204 | /* Construct the string literal in pieces to prevent the source from 205 | getting matched. Store it in a pointer rather than an array 206 | because some compilers will just produce instructions to fill the 207 | array rather than assigning a pointer to a static array. */ 208 | char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; 209 | 210 | /* Identify known platforms by name. */ 211 | #if defined(__linux) || defined(__linux__) || defined(linux) 212 | # define PLATFORM_ID "Linux" 213 | 214 | #elif defined(__CYGWIN__) 215 | # define PLATFORM_ID "Cygwin" 216 | 217 | #elif defined(__MINGW32__) 218 | # define PLATFORM_ID "MinGW" 219 | 220 | #elif defined(__APPLE__) 221 | # define PLATFORM_ID "Darwin" 222 | 223 | #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 224 | # define PLATFORM_ID "Windows" 225 | 226 | #elif defined(__FreeBSD__) || defined(__FreeBSD) 227 | # define PLATFORM_ID "FreeBSD" 228 | 229 | #elif defined(__NetBSD__) || defined(__NetBSD) 230 | # define PLATFORM_ID "NetBSD" 231 | 232 | #elif defined(__OpenBSD__) || defined(__OPENBSD) 233 | # define PLATFORM_ID "OpenBSD" 234 | 235 | #elif defined(__sun) || defined(sun) 236 | # define PLATFORM_ID "SunOS" 237 | 238 | #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 239 | # define PLATFORM_ID "AIX" 240 | 241 | #elif defined(__sgi) || defined(__sgi__) || defined(_SGI) 242 | # define PLATFORM_ID "IRIX" 243 | 244 | #elif defined(__hpux) || defined(__hpux__) 245 | # define PLATFORM_ID "HP-UX" 246 | 247 | #elif defined(__HAIKU__) 248 | # define PLATFORM_ID "Haiku" 249 | 250 | #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 251 | # define PLATFORM_ID "BeOS" 252 | 253 | #elif defined(__QNX__) || defined(__QNXNTO__) 254 | # define PLATFORM_ID "QNX" 255 | 256 | #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 257 | # define PLATFORM_ID "Tru64" 258 | 259 | #elif defined(__riscos) || defined(__riscos__) 260 | # define PLATFORM_ID "RISCos" 261 | 262 | #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 263 | # define PLATFORM_ID "SINIX" 264 | 265 | #elif defined(__UNIX_SV__) 266 | # define PLATFORM_ID "UNIX_SV" 267 | 268 | #elif defined(__bsdos__) 269 | # define PLATFORM_ID "BSDOS" 270 | 271 | #elif defined(_MPRAS) || defined(MPRAS) 272 | # define PLATFORM_ID "MP-RAS" 273 | 274 | #elif defined(__osf) || defined(__osf__) 275 | # define PLATFORM_ID "OSF1" 276 | 277 | #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 278 | # define PLATFORM_ID "SCO_SV" 279 | 280 | #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 281 | # define PLATFORM_ID "ULTRIX" 282 | 283 | #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 284 | # define PLATFORM_ID "Xenix" 285 | 286 | #else /* unknown platform */ 287 | # define PLATFORM_ID "" 288 | 289 | #endif 290 | 291 | /* For windows compilers MSVC and Intel we can determine 292 | the architecture of the compiler being used. This is because 293 | the compilers do not have flags that can change the architecture, 294 | but rather depend on which compiler is being used 295 | */ 296 | #if defined(_WIN32) && defined(_MSC_VER) 297 | # if defined(_M_IA64) 298 | # define ARCHITECTURE_ID "IA64" 299 | 300 | # elif defined(_M_X64) || defined(_M_AMD64) 301 | # define ARCHITECTURE_ID "x64" 302 | 303 | # elif defined(_M_IX86) 304 | # define ARCHITECTURE_ID "X86" 305 | 306 | # elif defined(_M_ARM) 307 | # define ARCHITECTURE_ID "ARM" 308 | 309 | # elif defined(_M_MIPS) 310 | # define ARCHITECTURE_ID "MIPS" 311 | 312 | # elif defined(_M_SH) 313 | # define ARCHITECTURE_ID "SHx" 314 | 315 | # else /* unknown architecture */ 316 | # define ARCHITECTURE_ID "" 317 | # endif 318 | 319 | #else 320 | # define ARCHITECTURE_ID "" 321 | #endif 322 | 323 | /* Convert integer to decimal digit literals. */ 324 | #define DEC(n) \ 325 | ('0' + (((n) / 10000000)%10)), \ 326 | ('0' + (((n) / 1000000)%10)), \ 327 | ('0' + (((n) / 100000)%10)), \ 328 | ('0' + (((n) / 10000)%10)), \ 329 | ('0' + (((n) / 1000)%10)), \ 330 | ('0' + (((n) / 100)%10)), \ 331 | ('0' + (((n) / 10)%10)), \ 332 | ('0' + ((n) % 10)) 333 | 334 | /* Convert integer to hex digit literals. */ 335 | #define HEX(n) \ 336 | ('0' + ((n)>>28 & 0xF)), \ 337 | ('0' + ((n)>>24 & 0xF)), \ 338 | ('0' + ((n)>>20 & 0xF)), \ 339 | ('0' + ((n)>>16 & 0xF)), \ 340 | ('0' + ((n)>>12 & 0xF)), \ 341 | ('0' + ((n)>>8 & 0xF)), \ 342 | ('0' + ((n)>>4 & 0xF)), \ 343 | ('0' + ((n) & 0xF)) 344 | 345 | /* Construct a string literal encoding the version number components. */ 346 | #ifdef COMPILER_VERSION_MAJOR 347 | char const info_version[] = { 348 | 'I', 'N', 'F', 'O', ':', 349 | 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', 350 | COMPILER_VERSION_MAJOR, 351 | # ifdef COMPILER_VERSION_MINOR 352 | '.', COMPILER_VERSION_MINOR, 353 | # ifdef COMPILER_VERSION_PATCH 354 | '.', COMPILER_VERSION_PATCH, 355 | # ifdef COMPILER_VERSION_TWEAK 356 | '.', COMPILER_VERSION_TWEAK, 357 | # endif 358 | # endif 359 | # endif 360 | ']','\0'}; 361 | #endif 362 | 363 | /* Construct the string literal in pieces to prevent the source from 364 | getting matched. Store it in a pointer rather than an array 365 | because some compilers will just produce instructions to fill the 366 | array rather than assigning a pointer to a static array. */ 367 | char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; 368 | char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; 369 | 370 | 371 | 372 | /*--------------------------------------------------------------------------*/ 373 | 374 | #ifdef ID_VOID_MAIN 375 | void main() {} 376 | #else 377 | int main(int argc, char* argv[]) 378 | { 379 | int require = 0; 380 | require += info_compiler[argc]; 381 | require += info_platform[argc]; 382 | require += info_arch[argc]; 383 | #ifdef COMPILER_VERSION_MAJOR 384 | require += info_version[argc]; 385 | #endif 386 | (void)argv; 387 | return require; 388 | } 389 | #endif 390 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/2.8.12.2/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/examples/ex5_logreg_mnist-build/CMakeFiles/2.8.12.2/CompilerIdC/a.out -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp: -------------------------------------------------------------------------------- 1 | /* This source file must have a .cpp extension so that all C++ compilers 2 | recognize the extension without flags. Borland does not know .cxx for 3 | example. */ 4 | #ifndef __cplusplus 5 | # error "A C compiler has been selected for C++." 6 | #endif 7 | 8 | /* Version number components: V=Version, R=Revision, P=Patch 9 | Version date components: YYYY=Year, MM=Month, DD=Day */ 10 | 11 | #if defined(__COMO__) 12 | # define COMPILER_ID "Comeau" 13 | /* __COMO_VERSION__ = VRR */ 14 | # define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) 15 | # define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) 16 | 17 | #elif defined(__INTEL_COMPILER) || defined(__ICC) 18 | # define COMPILER_ID "Intel" 19 | /* __INTEL_COMPILER = VRP */ 20 | # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) 21 | # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) 22 | # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 23 | # if defined(__INTEL_COMPILER_BUILD_DATE) 24 | /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ 25 | # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 26 | # endif 27 | 28 | #elif defined(__PATHCC__) 29 | # define COMPILER_ID "PathScale" 30 | # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) 31 | # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) 32 | # if defined(__PATHCC_PATCHLEVEL__) 33 | # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) 34 | # endif 35 | 36 | #elif defined(__clang__) 37 | # define COMPILER_ID "Clang" 38 | # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 39 | # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 40 | # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 41 | 42 | #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) 43 | # define COMPILER_ID "Embarcadero" 44 | # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) 45 | # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) 46 | # define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) 47 | 48 | #elif defined(__BORLANDC__) 49 | # define COMPILER_ID "Borland" 50 | /* __BORLANDC__ = 0xVRR */ 51 | # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 52 | # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 53 | 54 | #elif defined(__WATCOMC__) 55 | # define COMPILER_ID "Watcom" 56 | /* __WATCOMC__ = VVRR */ 57 | # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) 58 | # define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) 59 | 60 | #elif defined(__SUNPRO_CC) 61 | # define COMPILER_ID "SunPro" 62 | # if __SUNPRO_CC >= 0x5100 63 | /* __SUNPRO_CC = 0xVRRP */ 64 | # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) 65 | # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) 66 | # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) 67 | # else 68 | /* __SUNPRO_CC = 0xVRP */ 69 | # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) 70 | # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) 71 | # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) 72 | # endif 73 | 74 | #elif defined(__HP_aCC) 75 | # define COMPILER_ID "HP" 76 | /* __HP_aCC = VVRRPP */ 77 | # define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) 78 | # define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) 79 | # define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) 80 | 81 | #elif defined(__DECCXX) 82 | # define COMPILER_ID "Compaq" 83 | /* __DECCXX_VER = VVRRTPPPP */ 84 | # define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) 85 | # define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) 86 | # define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) 87 | 88 | #elif defined(__IBMCPP__) 89 | # if defined(__COMPILER_VER__) 90 | # define COMPILER_ID "zOS" 91 | # else 92 | # if __IBMCPP__ >= 800 93 | # define COMPILER_ID "XL" 94 | # else 95 | # define COMPILER_ID "VisualAge" 96 | # endif 97 | /* __IBMCPP__ = VRP */ 98 | # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) 99 | # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) 100 | # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) 101 | # endif 102 | 103 | #elif defined(__PGI) 104 | # define COMPILER_ID "PGI" 105 | # define COMPILER_VERSION_MAJOR DEC(__PGIC__) 106 | # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) 107 | # if defined(__PGIC_PATCHLEVEL__) 108 | # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) 109 | # endif 110 | 111 | #elif defined(_CRAYC) 112 | # define COMPILER_ID "Cray" 113 | # define COMPILER_VERSION_MAJOR DEC(_RELEASE) 114 | # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) 115 | 116 | #elif defined(__TI_COMPILER_VERSION__) 117 | # define COMPILER_ID "TI" 118 | /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ 119 | # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) 120 | # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) 121 | # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) 122 | 123 | #elif defined(__SCO_VERSION__) 124 | # define COMPILER_ID "SCO" 125 | 126 | #elif defined(__GNUC__) 127 | # define COMPILER_ID "GNU" 128 | # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 129 | # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 130 | # if defined(__GNUC_PATCHLEVEL__) 131 | # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 132 | # endif 133 | 134 | #elif defined(_MSC_VER) 135 | # define COMPILER_ID "MSVC" 136 | /* _MSC_VER = VVRR */ 137 | # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) 138 | # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) 139 | # if defined(_MSC_FULL_VER) 140 | # if _MSC_VER >= 1400 141 | /* _MSC_FULL_VER = VVRRPPPPP */ 142 | # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 143 | # else 144 | /* _MSC_FULL_VER = VVRRPPPP */ 145 | # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 146 | # endif 147 | # endif 148 | # if defined(_MSC_BUILD) 149 | # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 150 | # endif 151 | 152 | /* Analog VisualDSP++ >= 4.5.6 */ 153 | #elif defined(__VISUALDSPVERSION__) 154 | # define COMPILER_ID "ADSP" 155 | /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ 156 | # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) 157 | # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) 158 | # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) 159 | 160 | /* Analog VisualDSP++ < 4.5.6 */ 161 | #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 162 | # define COMPILER_ID "ADSP" 163 | 164 | /* IAR Systems compiler for embedded systems. 165 | http://www.iar.com */ 166 | #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) 167 | # define COMPILER_ID "IAR" 168 | 169 | #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 170 | # define COMPILER_ID "MIPSpro" 171 | # if defined(_SGI_COMPILER_VERSION) 172 | /* _SGI_COMPILER_VERSION = VRP */ 173 | # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) 174 | # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) 175 | # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) 176 | # else 177 | /* _COMPILER_VERSION = VRP */ 178 | # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) 179 | # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) 180 | # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) 181 | # endif 182 | 183 | /* This compiler is either not known or is too old to define an 184 | identification macro. Try to identify the platform and guess that 185 | it is the native compiler. */ 186 | #elif defined(__sgi) 187 | # define COMPILER_ID "MIPSpro" 188 | 189 | #elif defined(__hpux) || defined(__hpua) 190 | # define COMPILER_ID "HP" 191 | 192 | #else /* unknown compiler */ 193 | # define COMPILER_ID "" 194 | 195 | #endif 196 | 197 | /* Construct the string literal in pieces to prevent the source from 198 | getting matched. Store it in a pointer rather than an array 199 | because some compilers will just produce instructions to fill the 200 | array rather than assigning a pointer to a static array. */ 201 | char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; 202 | 203 | /* Identify known platforms by name. */ 204 | #if defined(__linux) || defined(__linux__) || defined(linux) 205 | # define PLATFORM_ID "Linux" 206 | 207 | #elif defined(__CYGWIN__) 208 | # define PLATFORM_ID "Cygwin" 209 | 210 | #elif defined(__MINGW32__) 211 | # define PLATFORM_ID "MinGW" 212 | 213 | #elif defined(__APPLE__) 214 | # define PLATFORM_ID "Darwin" 215 | 216 | #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 217 | # define PLATFORM_ID "Windows" 218 | 219 | #elif defined(__FreeBSD__) || defined(__FreeBSD) 220 | # define PLATFORM_ID "FreeBSD" 221 | 222 | #elif defined(__NetBSD__) || defined(__NetBSD) 223 | # define PLATFORM_ID "NetBSD" 224 | 225 | #elif defined(__OpenBSD__) || defined(__OPENBSD) 226 | # define PLATFORM_ID "OpenBSD" 227 | 228 | #elif defined(__sun) || defined(sun) 229 | # define PLATFORM_ID "SunOS" 230 | 231 | #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 232 | # define PLATFORM_ID "AIX" 233 | 234 | #elif defined(__sgi) || defined(__sgi__) || defined(_SGI) 235 | # define PLATFORM_ID "IRIX" 236 | 237 | #elif defined(__hpux) || defined(__hpux__) 238 | # define PLATFORM_ID "HP-UX" 239 | 240 | #elif defined(__HAIKU__) 241 | # define PLATFORM_ID "Haiku" 242 | 243 | #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 244 | # define PLATFORM_ID "BeOS" 245 | 246 | #elif defined(__QNX__) || defined(__QNXNTO__) 247 | # define PLATFORM_ID "QNX" 248 | 249 | #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 250 | # define PLATFORM_ID "Tru64" 251 | 252 | #elif defined(__riscos) || defined(__riscos__) 253 | # define PLATFORM_ID "RISCos" 254 | 255 | #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 256 | # define PLATFORM_ID "SINIX" 257 | 258 | #elif defined(__UNIX_SV__) 259 | # define PLATFORM_ID "UNIX_SV" 260 | 261 | #elif defined(__bsdos__) 262 | # define PLATFORM_ID "BSDOS" 263 | 264 | #elif defined(_MPRAS) || defined(MPRAS) 265 | # define PLATFORM_ID "MP-RAS" 266 | 267 | #elif defined(__osf) || defined(__osf__) 268 | # define PLATFORM_ID "OSF1" 269 | 270 | #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 271 | # define PLATFORM_ID "SCO_SV" 272 | 273 | #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 274 | # define PLATFORM_ID "ULTRIX" 275 | 276 | #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 277 | # define PLATFORM_ID "Xenix" 278 | 279 | #else /* unknown platform */ 280 | # define PLATFORM_ID "" 281 | 282 | #endif 283 | 284 | /* For windows compilers MSVC and Intel we can determine 285 | the architecture of the compiler being used. This is because 286 | the compilers do not have flags that can change the architecture, 287 | but rather depend on which compiler is being used 288 | */ 289 | #if defined(_WIN32) && defined(_MSC_VER) 290 | # if defined(_M_IA64) 291 | # define ARCHITECTURE_ID "IA64" 292 | 293 | # elif defined(_M_X64) || defined(_M_AMD64) 294 | # define ARCHITECTURE_ID "x64" 295 | 296 | # elif defined(_M_IX86) 297 | # define ARCHITECTURE_ID "X86" 298 | 299 | # elif defined(_M_ARM) 300 | # define ARCHITECTURE_ID "ARM" 301 | 302 | # elif defined(_M_MIPS) 303 | # define ARCHITECTURE_ID "MIPS" 304 | 305 | # elif defined(_M_SH) 306 | # define ARCHITECTURE_ID "SHx" 307 | 308 | # else /* unknown architecture */ 309 | # define ARCHITECTURE_ID "" 310 | # endif 311 | 312 | #else 313 | # define ARCHITECTURE_ID "" 314 | #endif 315 | 316 | /* Convert integer to decimal digit literals. */ 317 | #define DEC(n) \ 318 | ('0' + (((n) / 10000000)%10)), \ 319 | ('0' + (((n) / 1000000)%10)), \ 320 | ('0' + (((n) / 100000)%10)), \ 321 | ('0' + (((n) / 10000)%10)), \ 322 | ('0' + (((n) / 1000)%10)), \ 323 | ('0' + (((n) / 100)%10)), \ 324 | ('0' + (((n) / 10)%10)), \ 325 | ('0' + ((n) % 10)) 326 | 327 | /* Convert integer to hex digit literals. */ 328 | #define HEX(n) \ 329 | ('0' + ((n)>>28 & 0xF)), \ 330 | ('0' + ((n)>>24 & 0xF)), \ 331 | ('0' + ((n)>>20 & 0xF)), \ 332 | ('0' + ((n)>>16 & 0xF)), \ 333 | ('0' + ((n)>>12 & 0xF)), \ 334 | ('0' + ((n)>>8 & 0xF)), \ 335 | ('0' + ((n)>>4 & 0xF)), \ 336 | ('0' + ((n) & 0xF)) 337 | 338 | /* Construct a string literal encoding the version number components. */ 339 | #ifdef COMPILER_VERSION_MAJOR 340 | char const info_version[] = { 341 | 'I', 'N', 'F', 'O', ':', 342 | 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', 343 | COMPILER_VERSION_MAJOR, 344 | # ifdef COMPILER_VERSION_MINOR 345 | '.', COMPILER_VERSION_MINOR, 346 | # ifdef COMPILER_VERSION_PATCH 347 | '.', COMPILER_VERSION_PATCH, 348 | # ifdef COMPILER_VERSION_TWEAK 349 | '.', COMPILER_VERSION_TWEAK, 350 | # endif 351 | # endif 352 | # endif 353 | ']','\0'}; 354 | #endif 355 | 356 | /* Construct the string literal in pieces to prevent the source from 357 | getting matched. Store it in a pointer rather than an array 358 | because some compilers will just produce instructions to fill the 359 | array rather than assigning a pointer to a static array. */ 360 | char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; 361 | char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; 362 | 363 | 364 | 365 | /*--------------------------------------------------------------------------*/ 366 | 367 | int main(int argc, char* argv[]) 368 | { 369 | int require = 0; 370 | require += info_compiler[argc]; 371 | require += info_platform[argc]; 372 | #ifdef COMPILER_VERSION_MAJOR 373 | require += info_version[argc]; 374 | #endif 375 | (void)argv; 376 | return require; 377 | } 378 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/2.8.12.2/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/examples/ex5_logreg_mnist-build/CMakeFiles/2.8.12.2/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | # Relative path conversion top directories. 5 | SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist") 6 | SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build") 7 | 8 | # Force unix paths in dependencies. 9 | SET(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | SET(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/Makefile.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | # The generator used is: 5 | SET(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") 6 | 7 | # The top level Makefile was generated from the following files: 8 | SET(CMAKE_MAKEFILE_DEPENDS 9 | "CMakeCache.txt" 10 | "/home/koosy/caffe/caffe/build/CaffeConfig.cmake" 11 | "/home/koosy/caffe/caffe/build/CaffeTargets.cmake" 12 | "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" 13 | "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" 14 | "CMakeFiles/2.8.12.2/CMakeSystem.cmake" 15 | "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/CMakeLists.txt" 16 | "/usr/share/OpenCV/OpenCVModules-release.cmake" 17 | "/usr/share/OpenCV/OpenCVModules.cmake" 18 | "/usr/share/cmake-2.8/Modules/CMakeCCompiler.cmake.in" 19 | "/usr/share/cmake-2.8/Modules/CMakeCCompilerABI.c" 20 | "/usr/share/cmake-2.8/Modules/CMakeCInformation.cmake" 21 | "/usr/share/cmake-2.8/Modules/CMakeCXXCompiler.cmake.in" 22 | "/usr/share/cmake-2.8/Modules/CMakeCXXCompilerABI.cpp" 23 | "/usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake" 24 | "/usr/share/cmake-2.8/Modules/CMakeClDeps.cmake" 25 | "/usr/share/cmake-2.8/Modules/CMakeCommonLanguageInclude.cmake" 26 | "/usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake" 27 | "/usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake" 28 | "/usr/share/cmake-2.8/Modules/CMakeDetermineCompiler.cmake" 29 | "/usr/share/cmake-2.8/Modules/CMakeDetermineCompilerABI.cmake" 30 | "/usr/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake" 31 | "/usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake" 32 | "/usr/share/cmake-2.8/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake" 33 | "/usr/share/cmake-2.8/Modules/CMakeFindBinUtils.cmake" 34 | "/usr/share/cmake-2.8/Modules/CMakeFindCodeBlocks.cmake" 35 | "/usr/share/cmake-2.8/Modules/CMakeGenericSystem.cmake" 36 | "/usr/share/cmake-2.8/Modules/CMakeParseImplicitLinkInfo.cmake" 37 | "/usr/share/cmake-2.8/Modules/CMakeSystem.cmake.in" 38 | "/usr/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake" 39 | "/usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake" 40 | "/usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake" 41 | "/usr/share/cmake-2.8/Modules/CMakeTestCompilerCommon.cmake" 42 | "/usr/share/cmake-2.8/Modules/CMakeUnixFindMake.cmake" 43 | "/usr/share/cmake-2.8/Modules/Compiler/GNU-C.cmake" 44 | "/usr/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake" 45 | "/usr/share/cmake-2.8/Modules/Compiler/GNU.cmake" 46 | "/usr/share/cmake-2.8/Modules/MultiArchCross.cmake" 47 | "/usr/share/cmake-2.8/Modules/Platform/Linux-CXX.cmake" 48 | "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-C.cmake" 49 | "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU-CXX.cmake" 50 | "/usr/share/cmake-2.8/Modules/Platform/Linux-GNU.cmake" 51 | "/usr/share/cmake-2.8/Modules/Platform/Linux.cmake" 52 | "/usr/share/cmake-2.8/Modules/Platform/UnixPaths.cmake" 53 | ) 54 | 55 | # The corresponding makefile is: 56 | SET(CMAKE_MAKEFILE_OUTPUTS 57 | "Makefile" 58 | "CMakeFiles/cmake.check_cache" 59 | ) 60 | 61 | # Byproducts of CMake generate step: 62 | SET(CMAKE_MAKEFILE_PRODUCTS 63 | "CMakeFiles/2.8.12.2/CMakeSystem.cmake" 64 | "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" 65 | "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" 66 | "CMakeFiles/2.8.12.2/CMakeCCompiler.cmake" 67 | "CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake" 68 | "CMakeFiles/CMakeDirectoryInformation.cmake" 69 | ) 70 | 71 | # Dependency information for all targets: 72 | SET(CMAKE_DEPEND_INFO_FILES 73 | "CMakeFiles/ex_logreg_mnist.dir/DependInfo.cmake" 74 | ) 75 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/Makefile2: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | .PHONY : default_target 7 | 8 | # The main recursive all target 9 | all: 10 | .PHONY : all 11 | 12 | # The main recursive preinstall target 13 | preinstall: 14 | .PHONY : preinstall 15 | 16 | #============================================================================= 17 | # Special targets provided by cmake. 18 | 19 | # Disable implicit rules so canonical targets will work. 20 | .SUFFIXES: 21 | 22 | # Remove some rules from gmake that .SUFFIXES does not remove. 23 | SUFFIXES = 24 | 25 | .SUFFIXES: .hpux_make_needs_suffix_list 26 | 27 | # Suppress display of executed commands. 28 | $(VERBOSE).SILENT: 29 | 30 | # A target that is always out of date. 31 | cmake_force: 32 | .PHONY : cmake_force 33 | 34 | #============================================================================= 35 | # Set environment variables for the build. 36 | 37 | # The shell in which to execute make rules. 38 | SHELL = /bin/sh 39 | 40 | # The CMake executable. 41 | CMAKE_COMMAND = /usr/bin/cmake 42 | 43 | # The command to remove a file. 44 | RM = /usr/bin/cmake -E remove -f 45 | 46 | # Escaping for special characters. 47 | EQUALS = = 48 | 49 | # The program to use to edit the cache. 50 | CMAKE_EDIT_COMMAND = /usr/bin/ccmake 51 | 52 | # The top-level source directory on which CMake was run. 53 | CMAKE_SOURCE_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist 54 | 55 | # The top-level build directory on which CMake was run. 56 | CMAKE_BINARY_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build 57 | 58 | #============================================================================= 59 | # Target rules for target CMakeFiles/ex_logreg_mnist.dir 60 | 61 | # All Build rule for target. 62 | CMakeFiles/ex_logreg_mnist.dir/all: 63 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/depend 64 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/build 65 | $(CMAKE_COMMAND) -E cmake_progress_report /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles 1 66 | @echo "Built target ex_logreg_mnist" 67 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/all 68 | 69 | # Include target in all. 70 | all: CMakeFiles/ex_logreg_mnist.dir/all 71 | .PHONY : all 72 | 73 | # Build rule for subdir invocation for target. 74 | CMakeFiles/ex_logreg_mnist.dir/rule: cmake_check_build_system 75 | $(CMAKE_COMMAND) -E cmake_progress_start /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles 1 76 | $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/ex_logreg_mnist.dir/all 77 | $(CMAKE_COMMAND) -E cmake_progress_start /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles 0 78 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/rule 79 | 80 | # Convenience name for target. 81 | ex_logreg_mnist: CMakeFiles/ex_logreg_mnist.dir/rule 82 | .PHONY : ex_logreg_mnist 83 | 84 | # clean rule for target. 85 | CMakeFiles/ex_logreg_mnist.dir/clean: 86 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/clean 87 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/clean 88 | 89 | # clean rule for target. 90 | clean: CMakeFiles/ex_logreg_mnist.dir/clean 91 | .PHONY : clean 92 | 93 | #============================================================================= 94 | # Special targets to cleanup operation of make. 95 | 96 | # Special rule to run CMake to check the build system integrity. 97 | # No rule that depends on this can have commands that come from listfiles 98 | # because they might be regenerated. 99 | cmake_check_build_system: 100 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 101 | .PHONY : cmake_check_build_system 102 | 103 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir 2 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | SET(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | SET(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp" "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o" 8 | ) 9 | SET(CMAKE_CXX_COMPILER_ID "GNU") 10 | 11 | # Preprocessor definitions for this target. 12 | SET(CMAKE_TARGET_DEFINITIONS 13 | "USE_LEVELDB" 14 | "USE_LMDB" 15 | "USE_OPENCV" 16 | ) 17 | 18 | # Targets to which this target links. 19 | SET(CMAKE_TARGET_LINKED_INFO_FILES 20 | ) 21 | 22 | # The include file search paths: 23 | SET(CMAKE_C_TARGET_INCLUDE_PATH 24 | "/home/koosy/caffe/caffe/src" 25 | "/home/koosy/caffe/caffe/build/include" 26 | "/usr/local/cuda/include" 27 | "/usr/include/opencv" 28 | "/usr/include/atlas" 29 | "/home/koosy/caffe/caffe/include" 30 | ) 31 | SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) 32 | SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) 33 | SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH}) 34 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | #============================================================================= 5 | # Special targets provided by cmake. 6 | 7 | # Disable implicit rules so canonical targets will work. 8 | .SUFFIXES: 9 | 10 | # Remove some rules from gmake that .SUFFIXES does not remove. 11 | SUFFIXES = 12 | 13 | .SUFFIXES: .hpux_make_needs_suffix_list 14 | 15 | # Suppress display of executed commands. 16 | $(VERBOSE).SILENT: 17 | 18 | # A target that is always out of date. 19 | cmake_force: 20 | .PHONY : cmake_force 21 | 22 | #============================================================================= 23 | # Set environment variables for the build. 24 | 25 | # The shell in which to execute make rules. 26 | SHELL = /bin/sh 27 | 28 | # The CMake executable. 29 | CMAKE_COMMAND = /usr/bin/cmake 30 | 31 | # The command to remove a file. 32 | RM = /usr/bin/cmake -E remove -f 33 | 34 | # Escaping for special characters. 35 | EQUALS = = 36 | 37 | # The program to use to edit the cache. 38 | CMAKE_EDIT_COMMAND = /usr/bin/ccmake 39 | 40 | # The top-level source directory on which CMake was run. 41 | CMAKE_SOURCE_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist 42 | 43 | # The top-level build directory on which CMake was run. 44 | CMAKE_BINARY_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build 45 | 46 | # Include any dependencies generated for this target. 47 | include CMakeFiles/ex_logreg_mnist.dir/depend.make 48 | 49 | # Include the progress variables for this target. 50 | include CMakeFiles/ex_logreg_mnist.dir/progress.make 51 | 52 | # Include the compile flags for this target's objects. 53 | include CMakeFiles/ex_logreg_mnist.dir/flags.make 54 | 55 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: CMakeFiles/ex_logreg_mnist.dir/flags.make 56 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp 57 | $(CMAKE_COMMAND) -E cmake_progress_report /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles $(CMAKE_PROGRESS_1) 58 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o" 59 | /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o -c /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp 60 | 61 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.i: cmake_force 62 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.i" 63 | /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp > CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.i 64 | 65 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.s: cmake_force 66 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.s" 67 | /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp -o CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.s 68 | 69 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.requires: 70 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.requires 71 | 72 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.provides: CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.requires 73 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.provides.build 74 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.provides 75 | 76 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.provides.build: CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o 77 | 78 | # Object files for target ex_logreg_mnist 79 | ex_logreg_mnist_OBJECTS = \ 80 | "CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o" 81 | 82 | # External object files for target ex_logreg_mnist 83 | ex_logreg_mnist_EXTERNAL_OBJECTS = 84 | 85 | ex_logreg_mnist: CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o 86 | ex_logreg_mnist: CMakeFiles/ex_logreg_mnist.dir/build.make 87 | ex_logreg_mnist: /home/koosy/caffe/caffe/build/lib/libcaffe.so 88 | ex_logreg_mnist: /home/koosy/caffe/caffe/build/lib/libproto.a 89 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libboost_system.so 90 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libboost_thread.so 91 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libboost_filesystem.so 92 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libpthread.so 93 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libglog.so 94 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libgflags.so 95 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libprotobuf.so 96 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libglog.so 97 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libgflags.so 98 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libprotobuf.so 99 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libhdf5_hl.so 100 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libhdf5.so 101 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/liblmdb.so 102 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libleveldb.so 103 | ex_logreg_mnist: /usr/lib/libsnappy.so 104 | ex_logreg_mnist: /usr/local/cuda/lib64/libcudart.so 105 | ex_logreg_mnist: /usr/local/cuda/lib64/libcurand.so 106 | ex_logreg_mnist: /usr/local/cuda/lib64/libcublas.so 107 | ex_logreg_mnist: /usr/local/cuda/lib64/libcudnn.so 108 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8 109 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.8 110 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.8 111 | ex_logreg_mnist: /usr/lib/liblapack_atlas.so 112 | ex_logreg_mnist: /usr/lib/libcblas.so 113 | ex_logreg_mnist: /usr/lib/libatlas.so 114 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libpython2.7.so 115 | ex_logreg_mnist: /usr/lib/x86_64-linux-gnu/libboost_python.so 116 | ex_logreg_mnist: CMakeFiles/ex_logreg_mnist.dir/link.txt 117 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ex_logreg_mnist" 118 | $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/ex_logreg_mnist.dir/link.txt --verbose=$(VERBOSE) 119 | 120 | # Rule to build all files generated by this target. 121 | CMakeFiles/ex_logreg_mnist.dir/build: ex_logreg_mnist 122 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/build 123 | 124 | CMakeFiles/ex_logreg_mnist.dir/requires: CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o.requires 125 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/requires 126 | 127 | CMakeFiles/ex_logreg_mnist.dir/clean: 128 | $(CMAKE_COMMAND) -P CMakeFiles/ex_logreg_mnist.dir/cmake_clean.cmake 129 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/clean 130 | 131 | CMakeFiles/ex_logreg_mnist.dir/depend: 132 | cd /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/DependInfo.cmake --color=$(COLOR) 133 | .PHONY : CMakeFiles/ex_logreg_mnist.dir/depend 134 | 135 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | FILE(REMOVE_RECURSE 2 | "CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o" 3 | "ex_logreg_mnist.pdb" 4 | "ex_logreg_mnist" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | FOREACH(lang CXX) 9 | INCLUDE(CMakeFiles/ex_logreg_mnist.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | ENDFOREACH(lang) 11 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o 5 | /home/koosy/caffe/caffe/build/include/caffe/proto/caffe.pb.h 6 | /home/koosy/caffe/caffe/include/caffe/blob.hpp 7 | /home/koosy/caffe/caffe/include/caffe/caffe.hpp 8 | /home/koosy/caffe/caffe/include/caffe/common.hpp 9 | /home/koosy/caffe/caffe/include/caffe/common_layers.hpp 10 | /home/koosy/caffe/caffe/include/caffe/data_layers.hpp 11 | /home/koosy/caffe/caffe/include/caffe/data_reader.hpp 12 | /home/koosy/caffe/caffe/include/caffe/data_transformer.hpp 13 | /home/koosy/caffe/caffe/include/caffe/filler.hpp 14 | /home/koosy/caffe/caffe/include/caffe/internal_thread.hpp 15 | /home/koosy/caffe/caffe/include/caffe/layer.hpp 16 | /home/koosy/caffe/caffe/include/caffe/layer_factory.hpp 17 | /home/koosy/caffe/caffe/include/caffe/loss_layers.hpp 18 | /home/koosy/caffe/caffe/include/caffe/net.hpp 19 | /home/koosy/caffe/caffe/include/caffe/neuron_layers.hpp 20 | /home/koosy/caffe/caffe/include/caffe/parallel.hpp 21 | /home/koosy/caffe/caffe/include/caffe/solver.hpp 22 | /home/koosy/caffe/caffe/include/caffe/solver_factory.hpp 23 | /home/koosy/caffe/caffe/include/caffe/syncedmem.hpp 24 | /home/koosy/caffe/caffe/include/caffe/util/benchmark.hpp 25 | /home/koosy/caffe/caffe/include/caffe/util/blocking_queue.hpp 26 | /home/koosy/caffe/caffe/include/caffe/util/cudnn.hpp 27 | /home/koosy/caffe/caffe/include/caffe/util/db.hpp 28 | /home/koosy/caffe/caffe/include/caffe/util/device_alternate.hpp 29 | /home/koosy/caffe/caffe/include/caffe/util/format.hpp 30 | /home/koosy/caffe/caffe/include/caffe/util/io.hpp 31 | /home/koosy/caffe/caffe/include/caffe/util/math_functions.hpp 32 | /home/koosy/caffe/caffe/include/caffe/util/mkl_alternate.hpp 33 | /home/koosy/caffe/caffe/include/caffe/util/upgrade_proto.hpp 34 | /home/koosy/caffe/caffe/include/caffe/vision_layers.hpp 35 | /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp 36 | /usr/include/atlas/cblas.h 37 | /usr/local/cuda/include/builtin_types.h 38 | /usr/local/cuda/include/channel_descriptor.h 39 | /usr/local/cuda/include/common_functions.h 40 | /usr/local/cuda/include/crt/func_macro.h 41 | /usr/local/cuda/include/cuComplex.h 42 | /usr/local/cuda/include/cublas_api.h 43 | /usr/local/cuda/include/cublas_v2.h 44 | /usr/local/cuda/include/cuda.h 45 | /usr/local/cuda/include/cuda_device_runtime_api.h 46 | /usr/local/cuda/include/cuda_runtime.h 47 | /usr/local/cuda/include/cuda_runtime_api.h 48 | /usr/local/cuda/include/cuda_surface_types.h 49 | /usr/local/cuda/include/cuda_texture_types.h 50 | /usr/local/cuda/include/cudnn.h 51 | /usr/local/cuda/include/curand.h 52 | /usr/local/cuda/include/device_atomic_functions.h 53 | /usr/local/cuda/include/device_atomic_functions.hpp 54 | /usr/local/cuda/include/device_double_functions.h 55 | /usr/local/cuda/include/device_double_functions.hpp 56 | /usr/local/cuda/include/device_functions.h 57 | /usr/local/cuda/include/device_functions.hpp 58 | /usr/local/cuda/include/device_functions_decls.h 59 | /usr/local/cuda/include/device_launch_parameters.h 60 | /usr/local/cuda/include/device_types.h 61 | /usr/local/cuda/include/driver_functions.h 62 | /usr/local/cuda/include/driver_types.h 63 | /usr/local/cuda/include/host_config.h 64 | /usr/local/cuda/include/host_defines.h 65 | /usr/local/cuda/include/math_constants.h 66 | /usr/local/cuda/include/math_functions.h 67 | /usr/local/cuda/include/math_functions.hpp 68 | /usr/local/cuda/include/math_functions_dbl_ptx3.h 69 | /usr/local/cuda/include/math_functions_dbl_ptx3.hpp 70 | /usr/local/cuda/include/sm_20_atomic_functions.h 71 | /usr/local/cuda/include/sm_20_atomic_functions.hpp 72 | /usr/local/cuda/include/sm_20_intrinsics.h 73 | /usr/local/cuda/include/sm_20_intrinsics.hpp 74 | /usr/local/cuda/include/sm_30_intrinsics.h 75 | /usr/local/cuda/include/sm_30_intrinsics.hpp 76 | /usr/local/cuda/include/sm_32_atomic_functions.h 77 | /usr/local/cuda/include/sm_32_atomic_functions.hpp 78 | /usr/local/cuda/include/sm_32_intrinsics.h 79 | /usr/local/cuda/include/sm_32_intrinsics.hpp 80 | /usr/local/cuda/include/sm_35_atomic_functions.h 81 | /usr/local/cuda/include/sm_35_intrinsics.h 82 | /usr/local/cuda/include/surface_functions.h 83 | /usr/local/cuda/include/surface_functions.hpp 84 | /usr/local/cuda/include/surface_indirect_functions.h 85 | /usr/local/cuda/include/surface_indirect_functions.hpp 86 | /usr/local/cuda/include/surface_types.h 87 | /usr/local/cuda/include/texture_fetch_functions.h 88 | /usr/local/cuda/include/texture_fetch_functions.hpp 89 | /usr/local/cuda/include/texture_indirect_functions.h 90 | /usr/local/cuda/include/texture_indirect_functions.hpp 91 | /usr/local/cuda/include/texture_types.h 92 | /usr/local/cuda/include/vector_functions.h 93 | /usr/local/cuda/include/vector_functions.hpp 94 | /usr/local/cuda/include/vector_types.h 95 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/build/include/caffe/proto/caffe.pb.h 5 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/blob.hpp 6 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/caffe.hpp 7 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/common.hpp 8 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/common_layers.hpp 9 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/data_layers.hpp 10 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/data_reader.hpp 11 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/data_transformer.hpp 12 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/filler.hpp 13 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/internal_thread.hpp 14 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/layer.hpp 15 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/layer_factory.hpp 16 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/loss_layers.hpp 17 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/net.hpp 18 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/neuron_layers.hpp 19 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/parallel.hpp 20 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/solver.hpp 21 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/solver_factory.hpp 22 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/syncedmem.hpp 23 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/benchmark.hpp 24 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/blocking_queue.hpp 25 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/cudnn.hpp 26 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/db.hpp 27 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/device_alternate.hpp 28 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/format.hpp 29 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/io.hpp 30 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/math_functions.hpp 31 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/mkl_alternate.hpp 32 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/util/upgrade_proto.hpp 33 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/caffe/caffe/include/caffe/vision_layers.hpp 34 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist/ex_logreg_mnist.cpp 35 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/include/atlas/cblas.h 36 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/builtin_types.h 37 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/channel_descriptor.h 38 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/common_functions.h 39 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/crt/func_macro.h 40 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuComplex.h 41 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cublas_api.h 42 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cublas_v2.h 43 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda.h 44 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda_device_runtime_api.h 45 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda_runtime.h 46 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda_runtime_api.h 47 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda_surface_types.h 48 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cuda_texture_types.h 49 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/cudnn.h 50 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/curand.h 51 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_atomic_functions.h 52 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_atomic_functions.hpp 53 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_double_functions.h 54 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_double_functions.hpp 55 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_functions.h 56 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_functions.hpp 57 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_functions_decls.h 58 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_launch_parameters.h 59 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/device_types.h 60 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/driver_functions.h 61 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/driver_types.h 62 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/host_config.h 63 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/host_defines.h 64 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/math_constants.h 65 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/math_functions.h 66 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/math_functions.hpp 67 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/math_functions_dbl_ptx3.h 68 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/math_functions_dbl_ptx3.hpp 69 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_20_atomic_functions.h 70 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_20_atomic_functions.hpp 71 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_20_intrinsics.h 72 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_20_intrinsics.hpp 73 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_30_intrinsics.h 74 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_30_intrinsics.hpp 75 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_32_atomic_functions.h 76 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_32_atomic_functions.hpp 77 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_32_intrinsics.h 78 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_32_intrinsics.hpp 79 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_35_atomic_functions.h 80 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/sm_35_intrinsics.h 81 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/surface_functions.h 82 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/surface_functions.hpp 83 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/surface_indirect_functions.h 84 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/surface_indirect_functions.hpp 85 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/surface_types.h 86 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/texture_fetch_functions.h 87 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/texture_fetch_functions.hpp 88 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/texture_indirect_functions.h 89 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/texture_indirect_functions.hpp 90 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/texture_types.h 91 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/vector_functions.h 92 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/vector_functions.hpp 93 | CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: /usr/local/cuda/include/vector_types.h 94 | 95 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = -I/home/koosy/caffe/caffe/src -I/home/koosy/caffe/caffe/build/include -I/usr/local/cuda/include -I/usr/include/opencv -I/usr/include/atlas -I/home/koosy/caffe/caffe/include 6 | 7 | CXX_DEFINES = -DUSE_LEVELDB -DUSE_LMDB -DUSE_OPENCV 8 | 9 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/link.txt: -------------------------------------------------------------------------------- 1 | /usr/bin/c++ CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o -o ex_logreg_mnist -rdynamic /home/koosy/caffe/caffe/build/lib/libcaffe.so /home/koosy/caffe/caffe/build/lib/libproto.a -lboost_system -lboost_thread -lboost_filesystem -lpthread -lpthread -lglog -lgflags -lprotobuf -lpthread -lglog -lgflags -lprotobuf -lhdf5_hl -lhdf5 -llmdb -lleveldb -lsnappy /usr/local/cuda/lib64/libcudart.so /usr/local/cuda/lib64/libcurand.so /usr/local/cuda/lib64/libcublas.so /usr/local/cuda/lib64/libcudnn.so /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8 /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.8 /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.8 -llapack_atlas -lcblas -latlas -lpython2.7 -lboost_python -Wl,-rpath,/home/koosy/caffe/caffe/build/lib:/usr/local/cuda/lib64 2 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/ex_logreg_mnist.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | 3 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/Makefile: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 2.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | .PHONY : default_target 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | # Remove some rules from gmake that .SUFFIXES does not remove. 15 | SUFFIXES = 16 | 17 | .SUFFIXES: .hpux_make_needs_suffix_list 18 | 19 | # Suppress display of executed commands. 20 | $(VERBOSE).SILENT: 21 | 22 | # A target that is always out of date. 23 | cmake_force: 24 | .PHONY : cmake_force 25 | 26 | #============================================================================= 27 | # Set environment variables for the build. 28 | 29 | # The shell in which to execute make rules. 30 | SHELL = /bin/sh 31 | 32 | # The CMake executable. 33 | CMAKE_COMMAND = /usr/bin/cmake 34 | 35 | # The command to remove a file. 36 | RM = /usr/bin/cmake -E remove -f 37 | 38 | # Escaping for special characters. 39 | EQUALS = = 40 | 41 | # The program to use to edit the cache. 42 | CMAKE_EDIT_COMMAND = /usr/bin/ccmake 43 | 44 | # The top-level source directory on which CMake was run. 45 | CMAKE_SOURCE_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist 46 | 47 | # The top-level build directory on which CMake was run. 48 | CMAKE_BINARY_DIR = /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build 49 | 50 | #============================================================================= 51 | # Targets provided globally by CMake. 52 | 53 | # Special rule for the target edit_cache 54 | edit_cache: 55 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 56 | /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 57 | .PHONY : edit_cache 58 | 59 | # Special rule for the target edit_cache 60 | edit_cache/fast: edit_cache 61 | .PHONY : edit_cache/fast 62 | 63 | # Special rule for the target rebuild_cache 64 | rebuild_cache: 65 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 66 | /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 67 | .PHONY : rebuild_cache 68 | 69 | # Special rule for the target rebuild_cache 70 | rebuild_cache/fast: rebuild_cache 71 | .PHONY : rebuild_cache/fast 72 | 73 | # The main all target 74 | all: cmake_check_build_system 75 | $(CMAKE_COMMAND) -E cmake_progress_start /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles/progress.marks 76 | $(MAKE) -f CMakeFiles/Makefile2 all 77 | $(CMAKE_COMMAND) -E cmake_progress_start /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/CMakeFiles 0 78 | .PHONY : all 79 | 80 | # The main clean target 81 | clean: 82 | $(MAKE) -f CMakeFiles/Makefile2 clean 83 | .PHONY : clean 84 | 85 | # The main clean target 86 | clean/fast: clean 87 | .PHONY : clean/fast 88 | 89 | # Prepare targets for installation. 90 | preinstall: all 91 | $(MAKE) -f CMakeFiles/Makefile2 preinstall 92 | .PHONY : preinstall 93 | 94 | # Prepare targets for installation. 95 | preinstall/fast: 96 | $(MAKE) -f CMakeFiles/Makefile2 preinstall 97 | .PHONY : preinstall/fast 98 | 99 | # clear depends 100 | depend: 101 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 102 | .PHONY : depend 103 | 104 | #============================================================================= 105 | # Target rules for targets named ex_logreg_mnist 106 | 107 | # Build rule for target. 108 | ex_logreg_mnist: cmake_check_build_system 109 | $(MAKE) -f CMakeFiles/Makefile2 ex_logreg_mnist 110 | .PHONY : ex_logreg_mnist 111 | 112 | # fast build rule for target. 113 | ex_logreg_mnist/fast: 114 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/build 115 | .PHONY : ex_logreg_mnist/fast 116 | 117 | ex_logreg_mnist.o: ex_logreg_mnist.cpp.o 118 | .PHONY : ex_logreg_mnist.o 119 | 120 | # target to build an object file 121 | ex_logreg_mnist.cpp.o: 122 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.o 123 | .PHONY : ex_logreg_mnist.cpp.o 124 | 125 | ex_logreg_mnist.i: ex_logreg_mnist.cpp.i 126 | .PHONY : ex_logreg_mnist.i 127 | 128 | # target to preprocess a source file 129 | ex_logreg_mnist.cpp.i: 130 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.i 131 | .PHONY : ex_logreg_mnist.cpp.i 132 | 133 | ex_logreg_mnist.s: ex_logreg_mnist.cpp.s 134 | .PHONY : ex_logreg_mnist.s 135 | 136 | # target to generate assembly for a file 137 | ex_logreg_mnist.cpp.s: 138 | $(MAKE) -f CMakeFiles/ex_logreg_mnist.dir/build.make CMakeFiles/ex_logreg_mnist.dir/ex_logreg_mnist.cpp.s 139 | .PHONY : ex_logreg_mnist.cpp.s 140 | 141 | # Help Target 142 | help: 143 | @echo "The following are some of the valid targets for this Makefile:" 144 | @echo "... all (the default if no target is provided)" 145 | @echo "... clean" 146 | @echo "... depend" 147 | @echo "... edit_cache" 148 | @echo "... ex_logreg_mnist" 149 | @echo "... rebuild_cache" 150 | @echo "... ex_logreg_mnist.o" 151 | @echo "... ex_logreg_mnist.i" 152 | @echo "... ex_logreg_mnist.s" 153 | .PHONY : help 154 | 155 | 156 | 157 | #============================================================================= 158 | # Special targets to cleanup operation of make. 159 | 160 | # Special rule to run CMake to check the build system integrity. 161 | # No rule that depends on this can have commands that come from listfiles 162 | # because they might be regenerated. 163 | cmake_check_build_system: 164 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 165 | .PHONY : cmake_check_build_system 166 | 167 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist 2 | 3 | # Set the install prefix 4 | IF(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | SET(CMAKE_INSTALL_PREFIX "/usr/local") 6 | ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) 7 | STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | IF(BUILD_TYPE) 12 | STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | ELSE(BUILD_TYPE) 15 | SET(CMAKE_INSTALL_CONFIG_NAME "") 16 | ENDIF(BUILD_TYPE) 17 | MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 19 | 20 | # Set the component getting installed. 21 | IF(NOT CMAKE_INSTALL_COMPONENT) 22 | IF(COMPONENT) 23 | MESSAGE(STATUS "Install component: \"${COMPONENT}\"") 24 | SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | ELSE(COMPONENT) 26 | SET(CMAKE_INSTALL_COMPONENT) 27 | ENDIF(COMPONENT) 28 | ENDIF(NOT CMAKE_INSTALL_COMPONENT) 29 | 30 | # Install shared libraries without execute permission? 31 | IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 32 | SET(CMAKE_INSTALL_SO_NO_EXE "1") 33 | ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 34 | 35 | IF(CMAKE_INSTALL_COMPONENT) 36 | SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 37 | ELSE(CMAKE_INSTALL_COMPONENT) 38 | SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 39 | ENDIF(CMAKE_INSTALL_COMPONENT) 40 | 41 | FILE(WRITE "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/${CMAKE_INSTALL_MANIFEST}" "") 42 | FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES}) 43 | FILE(APPEND "/home/koosy/git/deeplearningstudy/caffe/examples/ex5_logreg_mnist-build/${CMAKE_INSTALL_MANIFEST}" "${file}\n") 44 | ENDFOREACH(file) 45 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/ex_logreg.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 113 | 114 | -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist-build/ex_logreg_mnist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeepLearningStudy/caffe/f4f183aa0dd70608c10bd4522e99efe387a3d867/examples/ex5_logreg_mnist-build/ex_logreg_mnist -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.8) 2 | 3 | project (ex_logreg) 4 | 5 | find_package(Caffe) 6 | include_directories(${Caffe_INCLUDE_DIRS}) 7 | add_definitions(${Caffe_DEFINITIONS}) 8 | 9 | add_executable(ex_logreg_mnist ex_logreg_mnist.cpp) 10 | target_link_libraries(ex_logreg_mnist ${Caffe_LIBRARIES}) -------------------------------------------------------------------------------- /examples/ex5_logreg_mnist/ex_logreg_mnist.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "caffe/caffe.hpp" 7 | #include "caffe/blob.hpp" 8 | #include "caffe/common.hpp" 9 | 10 | typedef double Dtype; 11 | using namespace caffe; 12 | using namespace std; 13 | 14 | int nIter = 30000; 15 | int nClass = 10; //The number of classes in MNIST dataset 16 | 17 | 18 | int main() 19 | { 20 | Caffe::set_mode(Caffe::GPU); 21 | 22 | // data layer 23 | vector*> blob_bottom_data_vec; 24 | vector*> blob_top_data_vec; 25 | Blob* const blob_data = new Blob(); 26 | Blob* const blob_label = new Blob(); 27 | 28 | blob_top_data_vec.push_back(blob_data); 29 | blob_top_data_vec.push_back(blob_label); 30 | 31 | LayerParameter layer_data_param; 32 | DataParameter* data_param = layer_data_param.mutable_data_param(); 33 | data_param->set_batch_size(64); 34 | data_param->set_source("/home/koosy/caffe/caffe/examples/mnist/mnist_train_lmdb"); 35 | data_param->set_backend(caffe::DataParameter_DB_LMDB); 36 | 37 | TransformationParameter* transform_param = layer_data_param.mutable_transform_param(); 38 | transform_param->set_scale(1./255.); 39 | 40 | DataLayer layer_data(layer_data_param); 41 | layer_data.SetUp(blob_bottom_data_vec, blob_top_data_vec); 42 | 43 | //set inner product layer 44 | vector*> blob_bottom_ip_vec; 45 | vector*> blob_top_ip_vec; 46 | Blob* const blob_top_ip = new Blob(); 47 | 48 | blob_bottom_ip_vec.push_back(blob_data); 49 | blob_top_ip_vec.push_back(blob_top_ip); 50 | 51 | LayerParameter layer_ip_param; 52 | layer_ip_param.mutable_inner_product_param()->set_num_output(nClass); 53 | layer_ip_param.mutable_inner_product_param()->mutable_weight_filler()->set_type("xavier"); 54 | layer_ip_param.mutable_inner_product_param()->mutable_bias_filler()->set_type("constant"); 55 | 56 | InnerProductLayer layer_ip(layer_ip_param); 57 | layer_ip.SetUp(blob_bottom_ip_vec, blob_top_ip_vec); 58 | 59 | // set softmax loss layer 60 | vector*> blob_bottom_loss_vec; 61 | vector*> blob_top_loss_vec; 62 | Blob* const blob_top_loss = new Blob(); 63 | 64 | blob_bottom_loss_vec.push_back(blob_top_ip); 65 | blob_bottom_loss_vec.push_back(blob_label); 66 | blob_top_loss_vec.push_back(blob_top_loss); 67 | 68 | LayerParameter layer_loss_param; 69 | SoftmaxWithLossLayer layer_loss(layer_loss_param); 70 | layer_loss.SetUp(blob_bottom_loss_vec, blob_top_loss_vec); 71 | 72 | 73 | // forward and backward iteration 74 | for(int n=0;n backpro_vec; 83 | backpro_vec.push_back(1); 84 | backpro_vec.push_back(0); 85 | layer_loss.Backward(blob_top_loss_vec, backpro_vec, blob_bottom_loss_vec); 86 | layer_ip.Backward(blob_top_ip_vec, backpro_vec, blob_bottom_ip_vec); 87 | 88 | // update weights of layer_ip 89 | Dtype rate = 0.1; 90 | vector > > param = layer_ip.blobs(); 91 | caffe_scal(param[0]->count(), rate, param[0]->mutable_cpu_diff()); 92 | param[0]->Update(); 93 | } 94 | 95 | 96 | //prediction 97 | // data layer 98 | vector*> blob_bottom_testdata_vec; 99 | vector*> blob_top_testdata_vec; 100 | Blob* const blob_testdata = new Blob(); 101 | Blob* const blob_testlabel = new Blob(); 102 | 103 | blob_top_testdata_vec.push_back(blob_testdata); 104 | blob_top_testdata_vec.push_back(blob_testlabel); 105 | 106 | LayerParameter layer_testdata_param; 107 | DataParameter* testdata_param = layer_testdata_param.mutable_data_param(); 108 | testdata_param->set_batch_size(10000); 109 | testdata_param->set_source("/home/koosy/caffe/caffe/examples/mnist/mnist_test_lmdb"); 110 | testdata_param->set_backend(caffe::DataParameter_DB_LMDB); 111 | 112 | TransformationParameter* transform_test_param = layer_testdata_param.mutable_transform_param(); 113 | transform_test_param->set_scale(1./255.); 114 | 115 | DataLayer layer_testdata(layer_testdata_param); 116 | layer_testdata.SetUp(blob_bottom_testdata_vec, blob_top_testdata_vec); 117 | 118 | vector*> blob_bottom_ip_test_vec; 119 | blob_bottom_ip_test_vec.push_back(blob_testdata); 120 | 121 | layer_ip.Reshape(blob_bottom_ip_test_vec, blob_top_ip_vec); 122 | 123 | vector*> blob_bottom_loss_test_vec; 124 | blob_bottom_loss_test_vec.push_back(blob_top_ip); 125 | blob_bottom_loss_test_vec.push_back(blob_testlabel); 126 | 127 | layer_loss.Reshape(blob_bottom_loss_test_vec, blob_top_loss_vec); 128 | 129 | // armax layer 130 | vector*> blob_bottom_argmax_vec; 131 | vector*> blob_top_argmax_vec; 132 | Blob* blob_top_argmax = new Blob(); 133 | blob_bottom_argmax_vec.push_back(blob_top_ip); 134 | blob_top_argmax_vec.push_back(blob_top_argmax); 135 | 136 | LayerParameter layer_argmax_param; 137 | ArgMaxParameter* argmax_param = layer_argmax_param.mutable_argmax_param(); 138 | argmax_param->set_out_max_val(false); 139 | ArgMaxLayer layer_argmax(layer_argmax_param); 140 | layer_argmax.SetUp(blob_bottom_argmax_vec, blob_top_argmax_vec); 141 | 142 | //evaluation 143 | int correct = 0; 144 | int cnt = 0; 145 | // forward 146 | layer_testdata.Forward(blob_bottom_testdata_vec, blob_top_testdata_vec); 147 | layer_ip.Forward(blob_bottom_ip_test_vec, blob_top_ip_vec); 148 | layer_argmax.Forward(blob_bottom_argmax_vec, blob_top_argmax_vec); 149 | 150 | Dtype loss = layer_loss.Forward(blob_bottom_loss_test_vec, blob_top_loss_vec); 151 | cout<<"nIter: "<count();n++){ 155 | cnt ++; 156 | Dtype* label_data = blob_testlabel->mutable_cpu_data(); 157 | int truelabel = label_data[n]; 158 | 159 | Dtype* prediction_data = blob_top_argmax-> mutable_cpu_data(); 160 | int predictedlabel = prediction_data[n]; 161 | 162 | if(truelabel == predictedlabel){ 163 | correct++; 164 | } 165 | } 166 | cout << "Accuracy: " << correct <<"/" << cnt < 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {607d8399-f005-40d1-8611-2cd827cb020d} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | 0 45 | 8 46 | true 47 | 1 48 | true 49 | true 50 | true 51 | false 52 | 53 | 54 | 55 | ProjectExplorer.Project.PluginSettings 56 | 57 | 58 | 59 | ProjectExplorer.Project.Target.0 60 | 61 | Desktop 62 | Desktop 63 | {7970b4cd-3125-4ac6-9b1e-40f4d7856525} 64 | 0 65 | 0 66 | 1 67 | 68 | false 69 | /home/koosy/git/deeplearningstudy/caffe/examples/ex6_lenet_mnist-build 70 | 71 | 72 | 73 | 74 | false 75 | 76 | true 77 | Make 78 | 79 | CMakeProjectManager.MakeStep 80 | 81 | 1 82 | Build 83 | 84 | ProjectExplorer.BuildSteps.Build 85 | 86 | 87 | 88 | clean 89 | 90 | true 91 | 92 | true 93 | Make 94 | 95 | CMakeProjectManager.MakeStep 96 | 97 | 1 98 | Clean 99 | 100 | ProjectExplorer.BuildSteps.Clean 101 | 102 | 2 103 | false 104 | 105 | all 106 | 107 | CMakeProjectManager.CMakeBuildConfiguration 108 | 109 | 1 110 | 111 | 112 | 0 113 | Deploy 114 | 115 | ProjectExplorer.BuildSteps.Deploy 116 | 117 | 1 118 | Deploy locally 119 | 120 | ProjectExplorer.DefaultDeployConfiguration 121 | 122 | 1 123 | 124 | 125 | 126 | false 127 | false 128 | false 129 | false 130 | true 131 | 0.01 132 | 10 133 | true 134 | 1 135 | 25 136 | 137 | 1 138 | true 139 | false 140 | true 141 | valgrind 142 | 143 | 0 144 | 1 145 | 2 146 | 3 147 | 4 148 | 5 149 | 6 150 | 7 151 | 8 152 | 9 153 | 10 154 | 11 155 | 12 156 | 13 157 | 14 158 | 159 | ex_logreg_mnist 160 | 161 | false 162 | 163 | 2 164 | 165 | ex_logreg_mnist (disabled) 166 | 167 | CMakeProjectManager.CMakeRunConfiguration.ex_logreg_mnist 168 | 3768 169 | false 170 | true 171 | false 172 | false 173 | true 174 | 175 | 176 | 177 | false 178 | false 179 | false 180 | false 181 | true 182 | 0.01 183 | 10 184 | true 185 | 1 186 | 25 187 | 188 | 1 189 | true 190 | false 191 | true 192 | valgrind 193 | 194 | 0 195 | 1 196 | 2 197 | 3 198 | 4 199 | 5 200 | 6 201 | 7 202 | 8 203 | 9 204 | 10 205 | 11 206 | 12 207 | 13 208 | 14 209 | 210 | ex_lenet_mnist 211 | 212 | false 213 | 214 | 2 215 | 216 | ex_lenet_mnist 217 | 218 | CMakeProjectManager.CMakeRunConfiguration.ex_lenet_mnist 219 | 3768 220 | false 221 | true 222 | false 223 | false 224 | true 225 | 226 | 2 227 | 228 | 229 | 230 | ProjectExplorer.Project.TargetCount 231 | 1 232 | 233 | 234 | ProjectExplorer.Project.Updater.FileVersion 235 | 18 236 | 237 | 238 | Version 239 | 18 240 | 241 | 242 | -------------------------------------------------------------------------------- /examples/ex6_lenet_mnist/ex_lenet_mnist.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "caffe/caffe.hpp" 7 | #include "caffe/blob.hpp" 8 | #include "caffe/common.hpp" 9 | #include "caffe/filler.hpp" 10 | #include "mnist.h" 11 | 12 | using namespace caffe; 13 | using namespace std; 14 | using namespace cv; 15 | 16 | int nIter = 1000; 17 | int clas = 10; //The number of classes in MNIST dataset 18 | 19 | 20 | int main() 21 | { 22 | Caffe::set_mode(Caffe::GPU); 23 | 24 | /// LeNet from lenet_auto_train.prototxt 25 | // data layer 26 | vector*> blob_bottom_data_vec_; 27 | vector*> blob_top_data_vec_; 28 | Blob* const blob_data = new Blob(); 29 | Blob* const blob_label = new Blob(); 30 | 31 | blob_top_data_vec_.push_back(blob_data); 32 | blob_top_data_vec_.push_back(blob_label); 33 | 34 | LayerParameter layer_data_param; 35 | DataParameter* data_param = layer_data_param.mutable_data_param(); 36 | data_param->set_batch_size(64); 37 | data_param->set_source("/home/koosy/caffe/caffe/examples/mnist/mnist_train_lmdb"); 38 | data_param->set_backend(caffe::DataParameter_DB_LMDB); 39 | 40 | TransformationParameter* transform_param = layer_data_param.mutable_transform_param(); 41 | transform_param->set_scale(1./255.); 42 | 43 | DataLayer layer_data(layer_data_param); 44 | layer_data.SetUp(blob_bottom_data_vec_, blob_top_data_vec_); 45 | 46 | // conv1 47 | vector*> blob_bottom_conv1_vec_; 48 | vector*> blob_top_conv1_vec_; 49 | Blob* const blob_top_conv1_ = new Blob(); 50 | 51 | blob_bottom_conv1_vec_.push_back(blob_data); 52 | blob_top_conv1_vec_.push_back(blob_top_conv1_); 53 | 54 | LayerParameter layer_conv1_param; 55 | ConvolutionParameter* conv1_param = layer_conv1_param.mutable_convolution_param(); 56 | conv1_param->set_num_output(20); 57 | conv1_param->add_kernel_size(5); 58 | conv1_param->mutable_weight_filler()->set_type("xavier"); 59 | 60 | ConvolutionLayer layer_conv1(layer_conv1_param); 61 | layer_conv1.SetUp(blob_bottom_conv1_vec_, blob_top_conv1_vec_); 62 | 63 | // pool1 64 | vector*> blob_bottom_pool1_vec_; 65 | vector*> blob_top_pool1_vec_; 66 | Blob* const blob_top_pool1_ = new Blob(); 67 | 68 | blob_bottom_pool1_vec_.push_back(blob_top_conv1_); 69 | blob_top_pool1_vec_.push_back(blob_top_pool1_); 70 | 71 | LayerParameter layer_pool1_param; 72 | PoolingParameter* pool1_param = layer_pool1_param.mutable_pooling_param(); 73 | pool1_param->set_pool(caffe::PoolingParameter::MAX); 74 | pool1_param->set_kernel_size(2); 75 | pool1_param->set_stride(2); 76 | 77 | PoolingLayer layer_pool1(layer_pool1_param); 78 | layer_pool1.SetUp(blob_bottom_pool1_vec_, blob_top_pool1_vec_); 79 | 80 | // conv2 81 | vector*> blob_bottom_conv2_vec_; 82 | vector*> blob_top_conv2_vec_; 83 | Blob* const blob_top_conv2_ = new Blob(); 84 | 85 | blob_bottom_conv2_vec_.push_back(blob_top_pool1_); 86 | blob_top_conv2_vec_.push_back(blob_top_conv2_); 87 | 88 | LayerParameter layer_conv2_param; 89 | ConvolutionParameter* conv2_param = layer_conv2_param.mutable_convolution_param(); 90 | conv2_param->set_num_output(50); 91 | conv2_param->add_kernel_size(5); 92 | conv2_param->mutable_weight_filler()->set_type("xavier"); 93 | 94 | ConvolutionLayer layer_conv2(layer_conv2_param); 95 | layer_conv2.SetUp(blob_bottom_conv2_vec_, blob_top_conv2_vec_); 96 | 97 | // pool2 98 | vector*> blob_bottom_pool2_vec_; 99 | vector*> blob_top_pool2_vec_; 100 | Blob* const blob_top_pool2_ = new Blob(); 101 | 102 | blob_bottom_pool2_vec_.push_back(blob_top_conv2_); 103 | blob_top_pool2_vec_.push_back(blob_top_pool2_); 104 | 105 | LayerParameter layer_pool2_param; 106 | PoolingParameter* pool2_param = layer_pool2_param.mutable_pooling_param(); 107 | pool2_param->set_pool(caffe::PoolingParameter::MAX); 108 | pool2_param->set_kernel_size(2); 109 | pool2_param->set_stride(2); 110 | 111 | PoolingLayer layer_pool2(layer_pool2_param); 112 | layer_pool2.SetUp(blob_bottom_pool2_vec_, blob_top_pool2_vec_); 113 | 114 | // ip1 115 | vector*> blob_bottom_ip1_vec_; 116 | vector*> blob_top_ip1_vec_; 117 | Blob* const blob_top_ip1_ = new Blob(); 118 | 119 | blob_bottom_ip1_vec_.push_back(blob_top_pool2_); 120 | blob_top_ip1_vec_.push_back(blob_top_ip1_); 121 | 122 | LayerParameter layer_ip1_param; 123 | InnerProductParameter* ip1_param = layer_ip1_param.mutable_inner_product_param(); 124 | ip1_param->set_num_output(500); 125 | ip1_param->mutable_weight_filler()->set_type("xavier"); 126 | 127 | InnerProductLayer layer_ip1(layer_ip1_param); 128 | layer_ip1.SetUp(blob_bottom_ip1_vec_, blob_top_ip1_vec_); 129 | 130 | // relu1 131 | LayerParameter layer_relu1_param; 132 | ReLUParameter* relu1_param = layer_relu1_param.mutable_relu_param(); 133 | 134 | ReLULayer layer_relu1(layer_relu1_param); 135 | layer_relu1.SetUp(blob_top_ip1_vec_, blob_top_ip1_vec_); 136 | 137 | // ip2 138 | vector*> blob_bottom_ip2_vec_; 139 | vector*> blob_top_ip2_vec_; 140 | Blob* const blob_top_ip2_ = new Blob(); 141 | 142 | blob_bottom_ip2_vec_.push_back(blob_top_ip1_); 143 | blob_top_ip2_vec_.push_back(blob_top_ip2_); 144 | 145 | LayerParameter layer_ip2_param; 146 | InnerProductParameter* ip2_param = layer_ip2_param.mutable_inner_product_param(); 147 | ip2_param->set_num_output(10); 148 | ip2_param->mutable_weight_filler()->set_type("xavier"); 149 | 150 | InnerProductLayer layer_ip2(layer_ip2_param); 151 | layer_ip2.SetUp(blob_bottom_ip2_vec_, blob_top_ip2_vec_); 152 | 153 | //loss 154 | vector*> blob_bottom_loss_vec_; 155 | vector*> blob_top_loss_vec_; 156 | Blob* const blob_top_loss_ = new Blob(); 157 | 158 | blob_bottom_loss_vec_.push_back(blob_top_ip2_); 159 | blob_bottom_loss_vec_.push_back(blob_label); 160 | blob_top_loss_vec_.push_back(blob_top_loss_); 161 | 162 | LayerParameter layer_loss_param; 163 | SoftmaxWithLossLayer layer_loss(layer_loss_param); 164 | layer_loss.SetUp(blob_bottom_loss_vec_, blob_top_loss_vec_); 165 | 166 | // Forward 167 | for(int n=0;nmutable_cpu_data()[blob_label->offset(i,0,0,0)]<<" "; 173 | // } 174 | // int truelabel = blob_testlabel->mutable_cpu_data()[blob_testlabel->offset(n,0,0,0)]; 175 | 176 | layer_conv1.Forward(blob_bottom_conv1_vec_, blob_top_conv1_vec_); 177 | layer_pool1.Forward(blob_bottom_pool1_vec_, blob_top_pool1_vec_); 178 | layer_conv2.Forward(blob_bottom_conv2_vec_, blob_top_conv2_vec_); 179 | layer_pool2.Forward(blob_bottom_pool2_vec_, blob_top_pool2_vec_); 180 | layer_ip1.Forward(blob_bottom_ip1_vec_, blob_top_ip1_vec_); 181 | layer_relu1.Forward(blob_top_ip1_vec_, blob_top_ip1_vec_); 182 | layer_ip2.Forward(blob_bottom_ip2_vec_, blob_top_ip2_vec_); 183 | Dtype loss = layer_loss.Forward(blob_bottom_loss_vec_, blob_top_loss_vec_); 184 | 185 | cout<<" loss "< backpro_vec1, backpro_vec2; 189 | backpro_vec1.push_back(1); 190 | backpro_vec1.push_back(0); 191 | 192 | backpro_vec2.push_back(1); 193 | layer_loss.Backward(blob_top_loss_vec_, backpro_vec1, blob_bottom_loss_vec_); 194 | layer_ip2.Backward(blob_top_ip2_vec_, backpro_vec2, blob_bottom_ip2_vec_); 195 | layer_relu1.Backward(blob_top_ip1_vec_, backpro_vec2, blob_top_ip1_vec_); 196 | layer_ip1.Backward(blob_top_ip1_vec_, backpro_vec2, blob_bottom_ip1_vec_); 197 | layer_pool2.Backward(blob_top_pool2_vec_, backpro_vec2, blob_bottom_pool2_vec_ ); 198 | layer_conv2.Backward(blob_top_conv2_vec_, backpro_vec2, blob_bottom_conv2_vec_ ); 199 | layer_pool1.Backward(blob_top_pool1_vec_, backpro_vec2, blob_bottom_pool1_vec_ ); 200 | layer_conv1.Backward(blob_top_conv1_vec_, backpro_vec2, blob_bottom_conv1_vec_ ); 201 | 202 | 203 | // update weights of layer_ip 204 | Dtype rate = 0.1; 205 | vector > > param_conv1 = layer_conv1.blobs(); 206 | caffe_gpu_scal(param_conv1[0]->count(), rate, param_conv1[0]->mutable_gpu_diff()); 207 | param_conv1[0]->Update(); 208 | 209 | vector > > param_conv2 = layer_conv2.blobs(); 210 | param_conv2[0]->gpu_data(); 211 | caffe_gpu_scal(param_conv2[0]->count(), rate, param_conv2[0]->mutable_gpu_diff()); 212 | param_conv2[0]->Update(); 213 | 214 | vector > > param_ip1 = layer_ip1.blobs(); 215 | param_ip1[0]->gpu_data(); 216 | caffe_gpu_scal(param_ip1[0]->count(), rate, param_ip1[0]->mutable_gpu_diff()); 217 | param_ip1[0]->Update(); 218 | 219 | vector > > param_ip2 = layer_ip2.blobs(); 220 | param_ip2[0]->gpu_data(); 221 | caffe_gpu_scal(param_ip2[0]->count(), rate, param_ip2[0]->mutable_gpu_diff()); 222 | param_ip2[0]->Update(); 223 | } 224 | 225 | 226 | //prediction 227 | // data layer 228 | vector*> blob_bottom_testdata_vec_; 229 | vector*> blob_top_testdata_vec_; 230 | Blob* const blob_testdata = new Blob(); 231 | Blob* const blob_testlabel = new Blob(); 232 | 233 | blob_top_testdata_vec_.push_back(blob_testdata); 234 | blob_top_testdata_vec_.push_back(blob_testlabel); 235 | 236 | LayerParameter layer_testdata_param; 237 | DataParameter* testdata_param = layer_testdata_param.mutable_data_param(); 238 | testdata_param->set_batch_size(10000); 239 | testdata_param->set_source("/home/koosy/caffe/caffe/examples/mnist/mnist_test_lmdb"); 240 | testdata_param->set_backend(caffe::DataParameter_DB_LMDB); 241 | 242 | TransformationParameter* transform_test_param = layer_testdata_param.mutable_transform_param(); 243 | transform_test_param->set_scale(1./255.); 244 | 245 | DataLayer layer_testdata(layer_testdata_param); 246 | layer_testdata.SetUp(blob_bottom_testdata_vec_, blob_top_testdata_vec_); 247 | 248 | // reshape 249 | vector*> blob_bottom_conv1_test_vec_; 250 | blob_bottom_conv1_test_vec_.push_back(blob_testdata); 251 | layer_conv1.Reshape(blob_bottom_conv1_test_vec_, blob_top_conv1_vec_); 252 | layer_pool1.Reshape(blob_bottom_pool1_vec_, blob_top_pool1_vec_); 253 | layer_conv2.Reshape(blob_bottom_conv2_vec_, blob_top_conv2_vec_); 254 | layer_pool2.Reshape(blob_bottom_pool2_vec_, blob_top_pool2_vec_); 255 | layer_ip1.Reshape(blob_bottom_ip1_vec_, blob_top_ip1_vec_); 256 | layer_relu1.Reshape(blob_top_ip1_vec_, blob_top_ip1_vec_); 257 | layer_ip2.Reshape(blob_bottom_ip2_vec_, blob_top_ip2_vec_); 258 | 259 | vector*> blob_bottom_loss_test_vec_; 260 | blob_bottom_loss_test_vec_.push_back(blob_top_ip2_); 261 | blob_bottom_loss_test_vec_.push_back(blob_testlabel); 262 | 263 | layer_loss.Reshape(blob_bottom_loss_test_vec_, blob_top_loss_vec_); 264 | 265 | // evaluation on 100 iteration 266 | int correct = 0; 267 | int cnt = 0; 268 | for(int k = 0;k<1;k++){ 269 | // forward 270 | layer_testdata.Forward(blob_bottom_testdata_vec_, blob_top_testdata_vec_); 271 | layer_conv1.Forward(blob_bottom_conv1_test_vec_, blob_top_conv1_vec_); 272 | layer_pool1.Forward(blob_bottom_pool1_vec_, blob_top_pool1_vec_); 273 | layer_conv2.Forward(blob_bottom_conv2_vec_, blob_top_conv2_vec_); 274 | layer_pool2.Forward(blob_bottom_pool2_vec_, blob_top_pool2_vec_); 275 | layer_ip1.Forward(blob_bottom_ip1_vec_, blob_top_ip1_vec_); 276 | layer_relu1.Forward(blob_top_ip1_vec_, blob_top_ip1_vec_); 277 | layer_ip2.Forward(blob_bottom_ip2_vec_, blob_top_ip2_vec_); 278 | Dtype loss = layer_loss.Forward(blob_bottom_loss_test_vec_, blob_top_loss_vec_); 279 | cout<<" loss "<count();n++){ // 10 <<-- num_test 284 | cnt ++; 285 | Dtype* label_data = blob_testlabel->mutable_cpu_data(); 286 | int truelabel = label_data[n]; 287 | 288 | Dtype* score_data = blob_top_ip2_-> mutable_cpu_data(); 289 | double* score = new double[10]; 290 | for(int i = 0 ; i<10;i++){ 291 | score[i]=score_data[blob_top_ip2_->offset(n,i,0,0)]; 292 | } 293 | 294 | int predictedlabel =0; 295 | 296 | for(int i = 1;i<10;i++){ 297 | if(score[i]>score[predictedlabel]){ 298 | predictedlabel = i; 299 | } 300 | } 301 | 302 | if(truelabel == predictedlabel){ 303 | correct++; 304 | } 305 | 306 | cout << "True label: " << truelabel << " Predicted label:" << predictedlabel << " Accuracy: " << correct <<"/" << cnt < 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "caffe/caffe.hpp" 10 | #include "caffe/blob.hpp" 11 | #include "caffe/common.hpp" 12 | #include "caffe/filler.hpp" 13 | #include "caffe/net.hpp" 14 | #include 15 | #include 16 | 17 | using namespace caffe; 18 | using namespace std; 19 | typedef double Dtype; 20 | 21 | int main(int argc, char** argv) { 22 | if (argc != 7){ 23 | cout<<"option: name nData mean0 str0 mean1 str1"<* const blob_data = new Blob(nData, dim, 1, 1); 36 | caffe_rng_gaussian(nData/2*dim, mean_0, str_0, blob_data->mutable_cpu_data()); 37 | caffe_rng_gaussian(nData/2*dim, mean_1, str_1, blob_data->mutable_cpu_data()+blob_data->offset(nData/2,0,0,0)); 38 | 39 | // open leveldb 40 | leveldb::DB* db; 41 | leveldb::Options options; 42 | options.error_if_exists = true; 43 | options.create_if_missing = true; 44 | options.write_buffer_size = 268435456; 45 | leveldb::WriteBatch* batch = NULL; 46 | leveldb::Status status = leveldb::DB::Open(options, path, &db); 47 | CHECK(status.ok()) << "Failed to open leveldb " << path 48 | << ". Is it already existing?"; 49 | batch = new leveldb::WriteBatch(); 50 | 51 | // save to db 52 | const int kMaxKeyLength = 10; 53 | char key_cstr[kMaxKeyLength]; 54 | 55 | for (int item_id = 0; item_id < nData; ++item_id) { 56 | Datum datum; 57 | datum.set_channels(dim); 58 | datum.set_height(1); 59 | datum.set_width(1); 60 | 61 | datum.mutable_float_data()->Reserve(dim); 62 | for(int k=0;k<2;k++){ 63 | datum.add_float_data(blob_data->cpu_data()[blob_data->offset(item_id,k,0,0)]); 64 | } 65 | 66 | if(item_id < nData/2) datum.set_label(0); 67 | else datum.set_label(1); 68 | 69 | snprintf(key_cstr, kMaxKeyLength, "%08d", item_id); 70 | string keystr(key_cstr); 71 | batch->Put(keystr, datum.SerializeAsString()); 72 | } 73 | 74 | db->Write(leveldb::WriteOptions(), batch); 75 | delete batch; 76 | delete db; 77 | 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /examples/ex7_net/logreg_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "caffe/caffe.hpp" 10 | #include "caffe/blob.hpp" 11 | #include "caffe/common.hpp" 12 | #include "caffe/filler.hpp" 13 | #include "caffe/net.hpp" 14 | #include "google/protobuf/text_format.h" 15 | 16 | using namespace caffe; 17 | using namespace std; 18 | typedef double Dtype; 19 | 20 | int main(int argc, char** argv) { 21 | 22 | string proto_test = 23 | "name: 'LogReg_test' " 24 | "layer { " 25 | " name: 'data' " 26 | " type: 'Data' " 27 | " top: 'data' " 28 | " top: 'label' " 29 | " data_param { " 30 | " source: 'test_leveldb' " 31 | " batch_size: 200 " 32 | " } " 33 | "} " 34 | "layer { " 35 | " name: 'ip' " 36 | " type: 'InnerProduct' " 37 | " bottom: 'data' " 38 | " top: 'ip' " 39 | " inner_product_param { " 40 | " num_output: 2 " 41 | " } " 42 | "} " 43 | "layer { " 44 | " name: 'loss' " 45 | " type: 'SoftmaxWithLoss' " 46 | " bottom: 'ip' " 47 | " bottom: 'label' " 48 | " top: 'loss' " 49 | "} "; 50 | NetParameter param_test; 51 | google::protobuf::TextFormat::ParseFromString(proto_test, ¶m_test); 52 | 53 | Net net_test(param_test); 54 | net_test.CopyTrainedLayersFrom(argv[1]); 55 | 56 | double loss = 0; 57 | const vector*>& result = net_test.ForwardPrefilled(); 58 | loss = result[0]->cpu_data()[0]; 59 | LOG(ERROR) << "Loss: " << loss; 60 | 61 | // blobs from the forwarded net 62 | shared_ptr > blob_label = net_test.blob_by_name("label"); 63 | shared_ptr > blob_ip = net_test.blob_by_name("ip"); 64 | 65 | // evaluation 66 | int score = 0; 67 | for (int n=0;n<200;n++){ 68 | int label = blob_label->mutable_cpu_data()[blob_label->offset(n,0,0.0)]; 69 | // argmax evaluate 70 | Dtype score_0 = blob_ip->mutable_cpu_data()[blob_ip->offset(n,0,0,0)]; 71 | Dtype score_1 = blob_ip->mutable_cpu_data()[blob_ip->offset(n,1,0,0)]; 72 | 73 | if((score_0 > score_1) && (label == 0)) score ++; 74 | if((score_0 < score_1) && (label == 1)) score ++; 75 | 76 | cout<<"label "< score_1) cout<<"predict: 0"< 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "caffe/caffe.hpp" 10 | #include "caffe/blob.hpp" 11 | #include "caffe/common.hpp" 12 | #include "caffe/filler.hpp" 13 | #include "caffe/net.hpp" 14 | #include "google/protobuf/text_format.h" 15 | 16 | using namespace caffe; 17 | using namespace std; 18 | typedef double Dtype; 19 | 20 | int main(int argc, char** argv) { 21 | // set net 22 | string proto = 23 | "name: 'LogReg_train' " 24 | "layer { " 25 | " name: 'data' " 26 | " type: 'Data' " 27 | " top: 'data' " 28 | " top: 'label' " 29 | " data_param { " 30 | " source: 'train_leveldb' " 31 | " batch_size: 200 " 32 | " } " 33 | "} " 34 | "layer { " 35 | " name: 'ip' " 36 | " type: 'InnerProduct' " 37 | " bottom: 'data' " 38 | " top: 'ip' " 39 | " inner_product_param { " 40 | " num_output: 2 " 41 | " } " 42 | "} " 43 | "layer { " 44 | " name: 'loss' " 45 | " type: 'SoftmaxWithLoss' " 46 | " bottom: 'ip' " 47 | " bottom: 'label' " 48 | " top: 'loss' " 49 | "} "; 50 | 51 | NetParameter param_net; 52 | google::protobuf::TextFormat::ParseFromString(proto, ¶m_net); 53 | 54 | SolverParameter param_solver; 55 | param_solver.set_allocated_net_param(¶m_net); 56 | param_solver.set_base_lr(0.01); 57 | param_solver.set_max_iter(1000); 58 | param_solver.set_lr_policy("inv"); 59 | param_solver.set_momentum(0.9); 60 | param_solver.set_gamma(0.0001); 61 | param_solver.set_snapshot(1000); 62 | param_solver.set_display(10); 63 | param_solver.set_solver_mode(SolverParameter_SolverMode_GPU); 64 | 65 | // training 66 | SGDSolver solver(param_solver); 67 | solver.Solve(); 68 | } 69 | -------------------------------------------------------------------------------- /notebook/.ipynb_checkpoints/ex4_layer-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "" 4 | }, 5 | "nbformat": 3, 6 | "nbformat_minor": 0, 7 | "worksheets": [ 8 | { 9 | "cells": [ 10 | { 11 | "cell_type": "heading", 12 | "level": 2, 13 | "metadata": {}, 14 | "source": [ 15 | "'layer' in Caffe" 16 | ] 17 | }, 18 | { 19 | "cell_type": "raw", 20 | "metadata": {}, 21 | "source": [ 22 | "\uc9c0\ub09c \uac15\uc88c\uc5d0\uc11c\ub294 Caffe\uc758 \uae30\ubcf8 \ub370\uc774\ud130 \uad6c\uc870\uc778 blob\uc5d0 \ub300\ud574\uc11c, \uadf8\ub9ac\uace0 MNIST \ub370\uc774\ud130\uc14b\uc5d0 \ub300\ud574\uc11c \uc54c\uc544\ubcf4\uc558\uc2b5\ub2c8\ub2e4. \uc774\uc81c\ub294 \ubcf8\uaca9\uc801\uc778 \ub274\ub7f4\ub137 \ubaa8\ub378\uc744 \ub9cc\ub4e4\uae30 \uc704\ud55c \ud575\uc2ec \ube4c\ub529\ube14\ub85d\uc778 layer\uc5d0 \ub300\ud574 \uc54c\uc544\ubcfc\ud150\ub370\uc694. \uc774\ubc88 \uc2dc\uac04\uc5d0\ub294 argmax layer \uac04\ub2e8\ud55c \uc608\ub97c \ud1b5\ud574 layer\uc640 blob\uc758 \uad00\uacc4\ub97c \uc54c\uc544\ubcf4\uace0, \ub2e4\uc74c \uc2dc\uac04\uc5d0\ub294 layer \uad6c\uc870\ub97c \uc774\uc6a9\ud558\uc5ec MNIST \ub370\uc774\ud130\uc14b\uc744 \ud55c\ubc88 \ud559\uc2b5\ud574 \ubcf4\ub3c4\ub85d \ud558\uaca0\uc2b5\ub2c8\ub2e4. " 23 | ] 24 | }, 25 | { 26 | "cell_type": "heading", 27 | "level": 2, 28 | "metadata": {}, 29 | "source": [ 30 | "Layer\ub780?" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "caffe \ubaa8\ub378\uc5d0\uc11c blob\uc774 \ub370\uc774\ud130 \uad6c\uc870\ub77c\uba74 layer\ub294 \uc5f0\uc0b0\uc790\uc5d0 \ud574\ub2f9\ud569\ub2c8\ub2e4. \uc544\ub798 \ubcf4\uc2dc\ub294 \uadf8\ub9bc\ucc98\ub7fc blob\uc744 \uc785\ub825\uc73c\ub85c \ubc1b\uc544\uc11c \ub2e4\uc591\ud55c \uc5f0\uc0b0\uc744 \uc218\ud589\ud558\uace0 \uadf8 \uacb0\uacfc\ub97c blob\uc73c\ub85c \uc800\uc7a5\ud574\uc11c \ub0b4\ubcf4\ub0c5\ub2c8\ub2e4. \uc27d\uac8c \uc0dd\uac01\ud574\uc11c \ud544\ud130 \uc5ed\ud560\uc744 \ud55c\ub2e4\uace0 \ubcf4\uc2dc\uba74 \ub429\ub2c8\ub2e4. \n", 38 | "\n", 39 | "\"Drawing\"" 40 | ] 41 | }, 42 | { 43 | "cell_type": "markdown", 44 | "metadata": {}, 45 | "source": [ 46 | "caffe\ub294 \ub2e4\uc591\ud55c \uc885\ub958\uc758 layer\ub97c \uc9c0\uc6d0\ud558\ub294\ub370\uc694, \uc608\ub97c \ub4e4\uc5b4 convolution filter, pooling layer, inner product layer, rectified-linear layer, sigmoid layer, transformations, normalize, loss functions \ub4f1\ub4f1 \uc544\uc8fc \ub9ce\uc774 \uc788\uad6c\uc694. caffe \ucee4\ubba4\ub2c8\ud2f0\uac00 \ubc1c\uc804\ud568\uc5d0 \ub530\ub77c layer\uc758 \uc885\ub958\ub3c4 \ub298\uc5b4\ub098\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c \uc624\ud508\uc18c\uc2a4\uc774\uae30 \ub54c\ubb38\uc5d0 \uc790\uc2e0\uc5d0\uac8c \ud544\uc694\ud55c layer\ub97c \uc124\uacc4\ud558\uace0 \uad6c\ud604\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4. " 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "metadata": {}, 52 | "source": [ 53 | "layer\uc5d0 \ub300\ud55c \uc124\uba85\uc740 caffe \uacf5\uc2dd \ud29c\ud1a0\ub9ac\uc5bc \ud398\uc774\uc9c0 \uc911\uc5d0 [layer](http://caffe.berkeleyvision.org/tutorial/layers.html)\uc5d0\uc11c \ucc3e\uc544\ubcf4\uc2e4 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \ub354 \uc88b\uc740 \ubc29\ubc95\uc740 \uc9c1\uc811 \uc18c\uc2a4\ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\ub294\uac83\uc774\uaca0\uc8e0? \ubc14\ub85c \uc624\ud508\uc18c\uc2a4 \ucf54\ub4dc \uc911\uc5d0 \uac01 layer\uc758 \uae30\ub2a5\uc774 \uc815\uc758\ub41c [\ud5e4\ub354\ud30c\uc77c\ub4e4](https://github.com/BVLC/caffe/tree/master/include/caffe/layers)\uacfc [\uc18c\uc2a4\ud30c\uc77c\ub4e4](https://github.com/BVLC/caffe/tree/master/src/caffe/layers)\ub97c \ubcf4\uba74 caffe\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ub2e4\uc591\ud55c layer\ub4e4\uc758 \uad6c\ud604 \ucf54\ub4dc\ub97c \ub2e4 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub300\ubd80\ubd84\uc758 layer\ub4e4\uc774 CPU\uc5d0\uc11c \uad6c\ud604\ub41c .cpp \ud30c\uc77c\uacfc GPU\uc5d0\uc11c \uad6c\ud604\ub41c .cu \ud30c\uc77c\uc744 \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4. " 54 | ] 55 | }, 56 | { 57 | "cell_type": "heading", 58 | "level": 3, 59 | "metadata": {}, 60 | "source": [ 61 | "layer.hpp" 62 | ] 63 | }, 64 | { 65 | "cell_type": "markdown", 66 | "metadata": {}, 67 | "source": [ 68 | "layer\ub97c \uc5b4\ub5bb\uac8c \uc0dd\uc131\ud558\uace0 \uc0ac\uc6a9\ud558\ub294\uc9c0\ub294 \uc544\ub798\uc5d0 \uc788\ub294 `argmax layer` \uc608\uc81c\ub97c \ud1b5\ud574 \uc790\uc138\ud788 \uc0b4\ud3b4\ubcfc\ud150\ub370\uc694. \uadf8 \uc804\uc5d0 \uac04\ub2e8\ud788 \ubaa8\ub4e0 layer\ub4e4\uc758 \ubd80\ubaa8\ud074\ub798\uc2a4\uc778 [layer.hpp](https://github.com/BVLC/caffe/blob/master/include/caffe/layer.hpp)\ub97c \ud55c\ubc88 \uac19\uc774 \ubcf4\uba74\uc11c layer\uc758 \uae30\ubcf8 \uad6c\uc870 \ubc0f \uc0ac\uc6a9\ubc95\uc5d0 \ub300\ud574 \uac10\uc744 \uc7a1\uc544\ubcf4\ub3c4\ub85d \ud558\uc8e0. \ucc38\uace0\ub85c caffe\ub294 \uc18c\uc2a4\ucf54\ub4dc\uac00 \uc544\uc8fc \uccb4\uacc4\uc801\uc73c\ub85c \uc791\uc131\ub418\uc5b4 \uc788\uc5b4\uc11c \ub530\ub85c \ubb38\uc11c\ud654\uc758 \ud544\uc694\uc131\uc744 \ubabb\ub290\ub084 \uc815\ub3c4\uc785\ub2c8\ub2e4. \uc18c\uc2a4\ucf54\ub4dc\ub97c \ubcf4\uba74\uc11c \ubc30\uc6b0\uace0 \uc775\ud788\ub294 \uc7ac\ubbf8\ub3c4 \uc788\uad6c\uc694. " 69 | ] 70 | }, 71 | { 72 | "cell_type": "markdown", 73 | "metadata": {}, 74 | "source": [ 75 | "\uba3c\uc800 Layer class\uc758 \uc0dd\uc131\uc790\ub97c \uba3c\uc800 \ubcf4\uba74\uc694. `LayerParameter` \ud0c0\uc785\uc758 \ud30c\ub77c\ubbf8\ud130 \uac12\uc744 \uc778\uc790\ub85c \ubc1b\uc2b5\ub2c8\ub2e4." 76 | ] 77 | }, 78 | { 79 | "cell_type": "markdown", 80 | "metadata": {}, 81 | "source": [ 82 | "```\n", 83 | "explicit Layer(const LayerParameter& param)\n", 84 | "```" 85 | ] 86 | }, 87 | { 88 | "cell_type": "markdown", 89 | "metadata": {}, 90 | "source": [ 91 | "\uc774 `param`\uac12\uc740 \uac01 layer\ub9c8\ub2e4 \ud2b9\uc218\ud558\uac8c \uc694\uad6c\ud558\ub294 \ud30c\ub77c\ubbf8\ud130\ub4e4\uc785\ub2c8\ub2e4. \uae30\uc874 layer\ub97c \uc0ac\uc6a9\ud558\uae30 \uc704\ud574\uc11c\ub294 \uadf8 layer\uac00 \uc9c0\uc6d0\ud558\ub294 \uadf8\ub9ac\uace0 \ud544\uc694\ud55c \ud30c\ub77c\ubbf8\ud130\ub4e4\uc774 \ubb34\uc5c7\uc774 \uc788\ub294\uc9c0 \uc54c\uc544\uc57c \ud560\ud150\ub370\uc694. \uadf8\uac83\uc740 [proto \ud30c\uc77c](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto)\ub85c \uc2a4\ud06c\ub9bd\ud2b8 \ud615\ud0dc\ub85c \uc815\uc758\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. \ub9cc\uc57d\uc5d0 \uc0c8\ub85c\uc6b4 layer\ub97c \ub9cc\ub4e4\uace0 \uc2f6\ub2e4\uace0 \ud558\uba74, \uc5ec\uae30 proto \ud30c\uc77c\uc5d0\ub2e4\uac00 \ud544\uc694\ud55c \ud30c\ub77c\ubbf8\ud130\ub4e4\uacfc \ucd08\uae30\uac12\uc744 \uc815\uc758\ud558\uba74 \ub429\ub2c8\ub2e4. \uadf8\ub7ec\uba74 caffe\ub97c \ucef4\ud30c\uc77c\ud560 \ub54c \uc0c8\ub85c \ucd94\uac00\ub41c layer\uc758 \ud30c\ub77c\ubbf8\ud130\ub97c \uc815\uc758\ud55c \ud5e4\ub354\ud30c\uc77c\uc774 \uc790\ub3d9\uc73c\ub85c \uc0dd\uc131\ub429\ub2c8\ub2e4. \uc790\uc138\ud55c\uac74 \uc544\ub798 `argmax` \uc608\uc81c\uc5d0\uc11c \ub354 \uc54c\uc544\ubcf4\ub3c4\ub85d \ud558\uc8e0." 92 | ] 93 | }, 94 | { 95 | "cell_type": "markdown", 96 | "metadata": {}, 97 | "source": [ 98 | "layer\ub97c \uc0dd\uc131\ud55c \ub2e4\uc74c\uc5d0\ub294 \uadf8 layer\ub97c \ud1b5\ud574 \uacc4\uc0b0\ub418\ub294 \uc785\ucd9c\ub825 blob\uc744 \uc54c\ub824\uc8fc\uc5b4\uc57c \ud569\ub2c8\ub2e4. \ubbf8\ub9ac \uc0dd\uc131\ub41c bottom blob, top blob\ub4e4\uc744 `SetUp` \ud568\uc218\ub97c \ud1b5\ud574 \ub118\uaca8\uc8fc\uba74 \ub429\ub2c8\ub2e4." 99 | ] 100 | }, 101 | { 102 | "cell_type": "markdown", 103 | "metadata": {}, 104 | "source": [ 105 | "```\n", 106 | "void SetUp(const vector*>& bottom,\n", 107 | " const vector*>& top)\n", 108 | "```" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "metadata": {}, 114 | "source": [ 115 | "\uc5ec\uae30\uc11c bottom/top blob\ub4e4\uc774 \uac01\uac01 vector\ud615\ud0dc\ub85c \uc815\uc758\ub41c\uac83\uc744 \ubcfc \uc218 \uc788\ub294\ub370\uc694. \uc989, \uc785\ucd9c\ub825\uc73c\ub85c \ud55c \uac1c \uc774\uc0c1\uc758 blob\ub4e4\uc774 layer\ub85c \ub4e4\uc5b4\uac00\uace0 \ub098\uc62c\uc218 \uc788\ub2e4\ub294 \ub9d0\uc785\ub2c8\ub2e4. \uc774\ub7ec\ud55cMIMO\ud615\ud0dc\uc758 layer\ub97c \uc774\uc6a9\ud558\uc5ec \ubcf5\uc7a1\ud55c \ub124\ud2b8\uc6cc\ud06c \ubaa8\ub378\uc744 \uad6c\uc131\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4." 116 | ] 117 | }, 118 | { 119 | "cell_type": "markdown", 120 | "metadata": {}, 121 | "source": [ 122 | "\uc774 `SetUp` \ud568\uc218\ub97c \ubcf4\uc2dc\uba74 \uba87 \uac00\uc9c0 \uba85\ub839\uc774 \uc2e4\ud589\ub418\ub294\ub370\uc694, \uadf8 \uc911\uc5d0 \uc544\ub798 `LayerSetUp`\uacfc `Reshape`\uc740 \uac01 layer\ub4e4\uc774 \ud2b9\uc218\ud558\uac8c \uc218\ud589\ud558\ub294 layer \ucd08\uae30\ud654 \uacfc\uc815\uc73c\ub85c, virtual\ub85c \uc120\uc5b8\ub418\uc5b4 \uc788\uc5b4\uc11c \uac01 \uc790\uc2dd class\uc5d0\uc11c \uc7ac\uc815\uc758\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4." 123 | ] 124 | }, 125 | { 126 | "cell_type": "markdown", 127 | "metadata": {}, 128 | "source": [ 129 | "```\n", 130 | "virtual void LayerSetUp(const vector*>& bottom,\n", 131 | " const vector*>& top) {}\n", 132 | "```" 133 | ] 134 | }, 135 | { 136 | "cell_type": "markdown", 137 | "metadata": {}, 138 | "source": [ 139 | "```\n", 140 | "virtual void Reshape(const vector*>& bottom,\n", 141 | " const vector*>& top) = 0;\n", 142 | "```" 143 | ] 144 | }, 145 | { 146 | "cell_type": "markdown", 147 | "metadata": {}, 148 | "source": [ 149 | "\uc774\ubc88\uc5d0 \ubcf4\uc2e4 \ub450 \uac00\uc9c0 \ud568\uc218\ub294 \uac00\uc7a5 \uc911\uc694\ud55c layer\uc758 \uacc4\uc0b0 \uae30\ub2a5\uc744 \ub2f4\ub2f9\ud558\ub294\ub370\uc694. \ubc14\ub85c `Forward`\uc640 `Backward`\uc785\ub2c8\ub2e4. " 150 | ] 151 | }, 152 | { 153 | "cell_type": "markdown", 154 | "metadata": {}, 155 | "source": [ 156 | "```\n", 157 | "inline Dtype Forward(const vector*>& bottom,\n", 158 | " const vector*>& top);\n", 159 | "```" 160 | ] 161 | }, 162 | { 163 | "cell_type": "markdown", 164 | "metadata": {}, 165 | "source": [ 166 | "`Forward`\ub294 bottom blob\uc5d0\uc11c top blob\uc73c\ub85c layer\uc5d0\uc11c \uc815\uc758\ub41c \uc5f0\uc0b0\uc744 \uc218\ud589\ud569\ub2c8\ub2e4. \uc5ec\uae30\uc11c \uc785\ub825\uc73c\ub85c \ub610\ub2e4\uc2dc bottom/top blob\uc744 \uc815\uc758\ud574\uc57c \ud558\ub294\ub370\uc694. \uc774\uc804\uc5d0 SetUp\uc5d0\uc11c \uc815\uc758\ud588\ub294\ub370 \uc65c \ub610 \ud558\ub294\uac00 \ud558\uba74, layer\ub97c \ub2e4\ub978 \ub370\uc774\ud130\uc5d0 \uc774\uc2dd\ud560 \uc218 \uc788\uac8c \ud558\uae30 \uc704\ud574\uc11c\uc785\ub2c8\ub2e4. \uac01 layer\ub294 \uc815\uc758\uc5d0 \ud544\uc694\ud55c \ud30c\ub77c\ubbf8\ud130 \uac12 \uc678\uc5d0\ub3c4 \uc5f0\uc0b0\uc5d0 \ud544\uc694\ud55c \ubcc0\uc218\ub4e4(\uc608\ub97c \ub4e4\uc5b4 inner product layer\uc758 weight\uac12)\uc744 \uac00\uc9c0\uace0 \uc788\ub294\ub370\uc694. \uc774\ub807\uac8c \ubbf8\ub9ac \uad6c\uc131\ub41c \ub610\ub294 \ud559\uc2b5\ub41c layer\ub97c \ub2e4\ub978 \ub370\uc774\ud130\uc5d0 \uc801\uc6a9\ud560 \uc218 \uc788\uae30 \ub54c\ubb38\uc5d0 \ubaa8\ub378\uc744 \ud6c8\ub828 \ud6c4 \uc0c8\ub85c\uc6b4 \ub370\uc774\ud130\ub97c \uc608\uce21\ud558\ub294\ub370 \uc0ac\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. " 167 | ] 168 | }, 169 | { 170 | "cell_type": "markdown", 171 | "metadata": {}, 172 | "source": [ 173 | "`Backward`\ub294 `Forward`\uc640\ub294 \ubc18\ub300\ub85c top blob\uc5d0\uc11c bottom blob\uc73c\ub85c \uc5f0\uc0b0\uc774 \uc9c4\ud589\ub429\ub2c8\ub2e4. \uc989 \ub124\ud2b8\uc6cc\ud06c \ubaa8\ub378\uc744 \ud6c8\ub828\ud558\ub294 \uae30\ubcf8 \uba54\ucee4\ub2c8\uc998\uc778 \uc5ed\uc804\ud30c(backpropagation) \uc54c\uace0\ub9ac\uc998\uc774 \ub3d9\uc791\ud558\ub294 \uac83\uc774\uc8e0. " 174 | ] 175 | }, 176 | { 177 | "cell_type": "markdown", 178 | "metadata": {}, 179 | "source": [ 180 | "```\n", 181 | "inline void Backward(const vector*>& top,\n", 182 | " const vector& propagate_down,\n", 183 | " const vector*>& bottom);\n", 184 | "```" 185 | ] 186 | }, 187 | { 188 | "cell_type": "markdown", 189 | "metadata": {}, 190 | "source": [ 191 | "\uc544\uc2dc\ub2e4\uc2dc\ud53c \uac01 \ud559\uc2b5\ubcc0\uc218\ub4e4\uc758 \ubcc0\ud654\ub7c9\uc774 \ucd5c\uc885 \ucd9c\ub825\ub2e8\uc758 loss\uc5d0 \ubbf8\uce58\ub294 \uc601\ud5a5\uc740 chain rule\uc5d0 \uc758\ud574 \uac01 \ubcc0\uc218\ubcc4\ub85c \ubd84\ub9ac\ub418\uc5b4\uc11c \uacc4\uc0b0\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uadf8\ub9ac\uace0 gradient decent \uc54c\uace0\ub9ac\uc998\uc5d0 \uc758\ud574\uc11c loss\uac00 \uc791\uc544\uc9c0\ub294 \ubc29\ud5a5\uacfc \uc77c\uce58\ud558\ub3c4\ub85d \uac01 \ud559\uc2b5\ubcc0\uc218\ub97c \uc99d\uac10\ud558\ub294 \uacfc\uc815\uc744 \ubc18\ubcf5\ud558\uba70 \ucd5c\uc801\uc758 \ubcc0\uc218\uac12\ub4e4\uc774 \ud559\uc2b5\ub418\ub294 \uac83\uc774\uc8e0. \uc774 \uacfc\uc815\uc5d0\uc11c `Backward` \ud568\uc218\ub294 top blob\uc758 \ubcc0\ud654\ub7c9\uc5d0 \ub300\ud55c bottom blob\uc758 \ubcc0\ud654\ub7c9\uc744 \uacc4\uc0b0\ud558\uace0, bottom blob\uc5d0 \uc800\uc7a5\ud569\ub2c8\ub2e4. \uc774\uc804\uc5d0 \uc5b8\uae09\ud588\ub294\uc9c0 \ubaa8\ub974\uaca0\uc9c0\ub9cc, \uac01 blob\uc5d0\ub294 \ub370\uc774\ud130(`blob->cpu_data()`)\uc758 \ubcc0\ud654\ub7c9\uc744 \ud56d\uc0c1 \uc800\uc7a5\ud558\ub294 \ubcc0\uc218(`blob.cpu_diff()`)\uac00 \ub530\ub85c \uc788\uc2b5\ub2c8\ub2e4. \uacb0\uacfc\uc801\uc73c\ub85c `Backward`\uacfc\uc815\uc744 \ud1b5\ud574\uc11c \uc774 `diff()` \ubcc0\uc218\uac12\uc774 \uc5c5\ub370\uc774\ud2b8 \ub418\ub294 \uac83\uc785\ub2c8\ub2e4. " 192 | ] 193 | }, 194 | { 195 | "cell_type": "heading", 196 | "level": 2, 197 | "metadata": {}, 198 | "source": [ 199 | "argmax layer" 200 | ] 201 | }, 202 | { 203 | "cell_type": "markdown", 204 | "metadata": {}, 205 | "source": [ 206 | "\uc790, \uadf8\ub7fc \uc774\uc81c \uc2e4\uc81c \uc608\uc81c\ucf54\ub4dc\ub97c \ubcf4\uba74\uc11c layer\ub97c \uc0ac\uc6a9\ud574\ubcf4\ub3c4\ub85d \ud560\uac8c\uc694. \uc5ec\uae30\uc11c\ub294 layer\uc758 \uae30\ubcf8 \uc0ac\uc6a9\ubc95\uc744 \uc775\ud788\uae30 \uc704\ud574 \ud55c \uce35\uc758 `argmax layer`\ub97c \uc815\uc758\ud558\uace0 `SetUp()`\uacfc `Forward()` \uae30\ub2a5\ub9cc \ub2e4\ub8e8\ub3c4\ub85d \ud558\uaca0\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 \ub2e4\uc74c\ubc88 \uc608\uc81c\uc5d0\uc11c\ub294 \ub450 \uce35\uc758 layer\ub97c \ub9cc\ub4e4\uace0, `Backward()`\uae30\ub2a5\uae4c\uc9c0 \ud569\ud558\uc5ec Logistic Regression Classification\uc744 \uad6c\ud604\ud574 \ubcf4\ub294\uac78 \ud558\uaca0\uc2b5\ub2c8\ub2e4." 207 | ] 208 | }, 209 | { 210 | "cell_type": "heading", 211 | "level": 3, 212 | "metadata": {}, 213 | "source": [ 214 | "Source code" 215 | ] 216 | }, 217 | { 218 | "cell_type": "markdown", 219 | "metadata": {}, 220 | "source": [ 221 | "\uba3c\uc800 \uae43\ud5d9\uc5d0\uc11c [ex4_layer \ud30c\uc77c\ub4e4](https://github.com/DeepLearningStudy/caffe/tree/master/examples/ex4_layer)\uc744 \uc900\ube44\ud558\uc2dc\uace0, [main.cpp \ud30c\uc77c](https://github.com/DeepLearningStudy/caffe/blob/master/examples/ex4_layer/main.cpp)\uc744 \uc5f4\uc5b4\ubd05\ub2c8\ub2e4. \uc774 \uc608\uc81c\uc5d0\uc11c\ub294 \uc784\uc758\ub85c 20\ucc28\uc6d0\uc758 \uac12\uc744 \uac00\uc9c0\ub294 10\uac1c\uc758 \ub370\uc774\ud130(10x20x1x1)\ub97c bottom blob\uc5d0 \uc0dd\uc131\ud558\uace0, \uac01 \ub370\uc774\ud130 \ubcc4\ub85c \uac00\uc7a5 \ud070 \uac12\uc744 \uac00\uc9c0\ub294 \ucc28\uc6d0\uc758 \uc218\ub97c \ucc3e\ub294 argmax \ubb38\uc81c\uc785\ub2c8\ub2e4. " 222 | ] 223 | }, 224 | { 225 | "cell_type": "markdown", 226 | "metadata": {}, 227 | "source": [ 228 | "$$label_i = \\underset{j} {\\mathrm{argmax}} ~{x_{ij}}$$" 229 | ] 230 | }, 231 | { 232 | "cell_type": "markdown", 233 | "metadata": {}, 234 | "source": [ 235 | "\uccab \ubc88\uc9f8\ub85c, \ube44\uc5b4\uc788\ub294 top blob\uacfc `GaussianFiller`\ub97c \uc774\uc6a9\ud558\uc5ec bottom blob\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4." 236 | ] 237 | }, 238 | { 239 | "cell_type": "markdown", 240 | "metadata": {}, 241 | "source": [ 242 | "```\n", 243 | "Blob* blob_top = new Blob();\n", 244 | "Blob* blob_bottom = new Blob(10, 20, 1, 1);\n", 245 | "FillerParameter filler_param;\n", 246 | "GaussianFiller filler(filler_param);\n", 247 | "filler.Fill(blob_bottom);\n", 248 | "``` " 249 | ] 250 | }, 251 | { 252 | "cell_type": "markdown", 253 | "metadata": {}, 254 | "source": [ 255 | "`GaussianFiller` \uc5ed\uc2dc `FillerParameter`\ub85c \uc815\uc758\ub41c \uac12\uc744 \uac00\uc9c0\ub294\ub370\uc694, \uc5ec\uae30\uc11c\ub294 \uc544\ubb34 \uac12\ub3c4 \uc815\uc758\ud558\uc9c0 \uc54a\uc740 \uae30\ubcf8\uac12\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \uadf8\ub7fc \uae30\ubcf8\uac12\uc740 \uc5b4\ub5bb\uac8c \uc815\uc758\uac00 \ub418\uc5b4 \uc788\ub294\uc9c0 \uc54c \uc218 \uc788\uc744\uae4c\uc694? caffe\uc5d0\uc11c\ub294 \ubaa8\ub4e0 \ud30c\ub77c\ubbf8\ud130 \uc815\uc758\ub294 \uc704\uc5d0\uc11c \ubcf8 proto\ud30c\uc77c\uc5d0 \uc815\uc758\uac00 \ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. \uadf8 \uc911\uc5d0\uc11c [FillerParameter \ubd80\ubd84](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L43-L62) \uc744 \ubcf4\uba74, GaissianFiller\uc5d0 \ub300\ud55c \ucd08\uae30\uac12\uc740 \uc544\ub798\ucc98\ub7fc \uc124\uc815\ub418\uc5b4 \uc788\ub294 \uac83\uc744 \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4." 256 | ] 257 | }, 258 | { 259 | "cell_type": "markdown", 260 | "metadata": {}, 261 | "source": [ 262 | "```\n", 263 | "optional float mean = 5 [default = 0]; // the mean value in Gaussian filler\n", 264 | "optional float std = 6 [default = 1]; // the std value in Gaussian filler\n", 265 | "```" 266 | ] 267 | }, 268 | { 269 | "cell_type": "markdown", 270 | "metadata": {}, 271 | "source": [ 272 | "\uc989, \ud3c9\uade0 0 \ud45c\uc900\ud3b8\ucc28 1\uc778 \uc815\uaddc\ubd84\ud3ec\uc5d0\uc11c \uc784\uc758\ub85c \uac12\uc744 \uc148\ud50c\ub9c1\ud574\uc11c bottom blob\uc5d0 \ucc44\uc6cc \ub123\uc2b5\ub2c8\ub2e4." 273 | ] 274 | }, 275 | { 276 | "cell_type": "markdown", 277 | "metadata": {}, 278 | "source": [ 279 | "\uadf8 \ub2e4\uc74c\uc5d0\ub294 layer\uc5d0 bottom/top blob\ub4e4\uc744 \uc815\uc758\ud558\uae30 \uc704\ud574\uc11c blob \ubca1\ud130\ub97c \ub9cc\ub4ed\ub2c8\ub2e4. \uc5ec\uae30\uc11c\ub294 bottom/top blob\uc774 \ud558\ub098\uc529 \ubc16\uc5d0 \uc5c6\ub124\uc694." 280 | ] 281 | }, 282 | { 283 | "cell_type": "markdown", 284 | "metadata": {}, 285 | "source": [ 286 | "```\n", 287 | "vector*> blob_bottom_vec;\n", 288 | "vector*> blob_top_vec;\n", 289 | "blob_bottom_vec.push_back(blob_bottom);\n", 290 | "blob_top_vec.push_back(blob_top);\n", 291 | "```" 292 | ] 293 | }, 294 | { 295 | "cell_type": "markdown", 296 | "metadata": {}, 297 | "source": [ 298 | "\uc774\uc81c argmax layer\ub97c \ub9cc\ub4e4\uc5b4 \ubd05\uc2dc\ub2e4. \uc55e\uc5d0\uc11c \uc0b4\ud3b4\ubcf4\uc558\ub4ef\uc774, \ubaa8\ub4e0 layer\ub294 `LayerParameter`\ud0c0\uc785\uc758 \uac12\uc744 \uc778\uc790\ub85c \ubc1b\uc2b5\ub2c8\ub2e4. \uc5ec\uae30\uc11c\ub294 `ArgMaxLayer`\ub97c \uc815\uc758\ud574\uc57c \ud558\uae30 \ub54c\ubb38\uc5d0, `ArgMaxParameter` \ud0c0\uc785\uc758 \ud30c\ub77c\ubbf8\ud130 \uac12\ub4e4\uc744 \uc14b\ud305\ud558\uace0, `layer_param`\uc5d0 \uc800\uc7a5\ud569\ub2c8\ub2e4. " 299 | ] 300 | }, 301 | { 302 | "cell_type": "markdown", 303 | "metadata": {}, 304 | "source": [ 305 | "```\n", 306 | "LayerParameter layer_param;\n", 307 | "ArgMaxParameter* argmax_param = layer_param.mutable_argmax_param();\n", 308 | "argmax_param->set_out_max_val(true); // two channel: 0 arg, 1 max_val\n", 309 | "ArgMaxLayer layer(layer_param);\n", 310 | "layer.SetUp(blob_bottom_vec, blob_top_vec);\n", 311 | "```" 312 | ] 313 | }, 314 | { 315 | "cell_type": "markdown", 316 | "metadata": {}, 317 | "source": [ 318 | "`ArgMaxParameter`\uac00 \ubb34\uc2a8 \ubcc0\uc218\ub4e4\uc744 \uac00\uc9c0\ub294\uc9c0\ub294 \uc5ed\uc2dc proto \ud30c\uc77c\uc5d0\uc11c [\ud574\ub2f9\ubd80\ubd84](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L466-L475)\uc744 \uc0b4\ud3b4\ubcf4\uba74 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc5ec\uae30\uc11c\ub294 `out_max_val`\uac12\uc744 `true`\ub85c \uc124\uc815\ud588\ub294\ub370\uc694, \uc774\ub294 top blob\uc5d0 argmax \uac12 \uc678\uc5d0\ub3c4 max\uac12\ub3c4 \uc800\uc7a5\ud55c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4. \uc989 top blob\uc758 \uccb4\ub110\uc218\uac00 2\uac00 \ub429\ub2c8\ub2e4. " 319 | ] 320 | }, 321 | { 322 | "cell_type": "markdown", 323 | "metadata": {}, 324 | "source": [ 325 | "\uadf8\ub7fc \uc774\uc81c blob\ub4e4\uc774 \uc798 \uc14b\ud305\uc774 \ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud574\ubd05\uc2dc\ub2e4. " 326 | ] 327 | }, 328 | { 329 | "cell_type": "markdown", 330 | "metadata": {}, 331 | "source": [ 332 | "```\n", 333 | "cout<<\"blob_top_num:\"<num()<num()<channels()< 13 | 14 | caffe는 다양한 종류의 layer를 지원하는데요, 예를 들어 convolution filter, pooling layer, inner 15 | product layer, rectified-linear layer, sigmoid layer, transformations, 16 | normalize, loss functions 등등 아주 많이 있구요. caffe 커뮤니티가 발전함에 따라 layer의 종류도 늘어나고 17 | 있습니다. 또한 오픈소스이기 때문에 자신에게 필요한 layer를 설계하고 구현할 수도 있습니다. 18 | 19 | layer에 대한 설명은 caffe 공식 튜토리얼 페이지 중에 20 | [layer](http://caffe.berkeleyvision.org/tutorial/layers.html)에서 찾아보실 수 있습니다. 하지만 21 | 더 좋은 방법은 직접 소스코드를 살펴보는것이겠죠? 바로 오픈소스 코드 중에 각 layer의 기능이 정의된 22 | [헤더파일들](https://github.com/BVLC/caffe/tree/master/include/caffe/layers)과 23 | [소스파일들](https://github.com/BVLC/caffe/tree/master/src/caffe/layers)를 보면 caffe에서 24 | 사용할 수 있는 다양한 layer들의 구현 코드를 다 볼 수 있습니다. 대부분의 layer들이 CPU에서 구현된 .cpp 파일과 GPU에서 25 | 구현된 .cu 파일을 가지고 있습니다. 26 | 27 | ### layer.hpp 28 | 29 | layer를 어떻게 생성하고 사용하는지는 아래에 있는 `argmax layer` 예제를 통해 자세히 살펴볼텐데요. 그 전에 간단히 모든 30 | layer들의 부모클래스인 31 | [layer.hpp](https://github.com/BVLC/caffe/blob/master/include/caffe/layer.hpp)를 32 | 한번 같이 보면서 layer의 기본 구조 및 사용법에 대해 감을 잡아보도록 하죠. 참고로 caffe는 소스코드가 아주 체계적으로 작성되어 있어서 33 | 따로 문서화의 필요성을 못느낄 정도입니다. 소스코드를 보면서 배우고 익히는 재미도 있구요. 34 | 35 | 먼저 Layer class의 생성자를 먼저 보면요. `LayerParameter` 타입의 파라미터 값을 인자로 받습니다. 36 | 37 | ``` 38 | explicit Layer(const LayerParameter& param) 39 | ``` 40 | 41 | 이 `param`값은 각 layer마다 특수하게 요구하는 파라미터들입니다. 기존 layer를 사용하기 위해서는 그 layer가 지원하는 그리고 42 | 필요한 파라미터들이 무엇이 있는지 알아야 할텐데요. 그것은 [proto 43 | 파일](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto)로 스크립트 44 | 형태로 정의되어 있습니다. 만약에 새로운 layer를 만들고 싶다고 하면, 여기 proto 파일에다가 필요한 파라미터들과 초기값을 정의하면 45 | 됩니다. 그러면 caffe를 컴파일할 때 새로 추가된 layer의 파라미터를 정의한 헤더파일이 자동으로 생성됩니다. 자세한건 아래 46 | `argmax` 예제에서 더 알아보도록 하죠. 47 | 48 | layer를 생성한 다음에는 그 layer를 통해 계산되는 입출력 blob을 알려주어야 합니다. 미리 생성된 bottom blob, top 49 | blob들을 `SetUp` 함수를 통해 넘겨주면 됩니다. 50 | 51 | ``` 52 | void SetUp(const vector*>& bottom, 53 | const vector*>& top) 54 | ``` 55 | 56 | 여기서 bottom/top blob들이 각각 vector형태로 정의된것을 볼 수 있는데요. 즉, 입출력으로 한 개 이상의 blob들이 57 | layer로 들어가고 나올수 있다는 말입니다. 이러한MIMO형태의 layer를 이용하여 복잡한 네트워크 모델을 구성할 수 있습니다. 58 | 59 | 이 `SetUp` 함수를 보시면 몇 가지 명령이 실행되는데요, 그 중에 아래 `LayerSetUp`과 `Reshape`은 각 layer들이 60 | 특수하게 수행하는 layer 초기화 과정으로, virtual로 선언되어 있어서 각 자식 class에서 재정의할 수 있습니다. 61 | 62 | ``` 63 | virtual void LayerSetUp(const vector*>& bottom, 64 | const vector*>& top) {} 65 | ``` 66 | 67 | ``` 68 | virtual void Reshape(const vector*>& bottom, 69 | const vector*>& top) = 0; 70 | ``` 71 | 72 | 이번에 보실 두 가지 함수는 가장 중요한 layer의 계산 기능을 담당하는데요. 바로 `Forward`와 `Backward`입니다. 73 | 74 | ``` 75 | inline Dtype Forward(const vector*>& bottom, 76 | const vector*>& top); 77 | ``` 78 | 79 | `Forward`는 bottom blob에서 top blob으로 layer에서 정의된 연산을 수행합니다. 여기서 입력으로 또다시 80 | bottom/top blob을 정의해야 하는데요. 이전에 SetUp에서 정의했는데 왜 또 하는가 하면, layer를 다른 데이터에 이식할 수 81 | 있게 하기 위해서입니다. 각 layer는 정의에 필요한 파라미터 값 외에도 연산에 필요한 변수들(예를 들어 inner product layer의 82 | weight값)을 가지고 있는데요. 이렇게 미리 구성된 또는 학습된 layer를 다른 데이터에 적용할 수 있기 때문에 모델을 훈련 후 새로운 83 | 데이터를 예측하는데 사용될 수 있습니다. 84 | 85 | `Backward`는 `Forward`와는 반대로 top blob에서 bottom blob으로 연산이 진행됩니다. 즉 네트워크 모델을 훈련하는 86 | 기본 메커니즘인 역전파(backpropagation) 알고리즘이 동작하는 것이죠. 87 | 88 | ``` 89 | inline void Backward(const vector*>& top, 90 | const vector& propagate_down, 91 | const vector*>& bottom); 92 | ``` 93 | 94 | 아시다시피 각 학습변수들의 변화량이 최종 출력단의 loss에 미치는 영향은 chain rule에 의해 각 변수별로 분리되어서 계산될 수 95 | 있습니다. 그리고 gradient decent 알고리즘에 의해서 loss가 작아지는 방향과 일치하도록 각 학습변수를 증감하는 과정을 반복하며 96 | 최적의 변수값들이 학습되는 것이죠. 이 과정에서 `Backward` 함수는 top blob의 변화량에 대한 bottom blob의 변화량을 97 | 계산하고, bottom blob에 저장합니다. 이전에 언급했는지 모르겠지만, 각 blob에는 데이터(`blob->cpu_data()`)의 98 | 변화량을 항상 저장하는 변수(`blob.cpu_diff()`)가 따로 있습니다. 결과적으로 `Backward`과정을 통해서 이 `diff()` 99 | 변수값이 업데이트 되는 것입니다. 100 | 101 | `propagate_down` 벡터변수는 bottom blob이 여러개 있을때 역전파를 적용할 blob과 적용하지 않을 blob을 구분하는 102 | 역할을 합니다. 103 | 104 | ## argmax layer 105 | 106 | 자, 그럼 이제 실제 예제코드를 보면서 layer를 사용해보도록 할게요. 여기서는 layer의 기본 사용법을 익히기 위해 한 층의 `argmax 107 | layer`를 정의하고 `SetUp()`과 `Forward()` 기능만 다루도록 하겠습니다. 대신 다음번 예제에서는 두 층의 layer를 108 | 만들고, `Backward()`기능까지 합하여 Logistic Regression Classification을 구현해 보는걸 하겠습니다. 109 | 110 | ### Source code 111 | 112 | 먼저 깃헙에서 [ex4_layer 113 | 파일들](https://github.com/DeepLearningStudy/caffe/tree/master/examples/ex4_layer)을 114 | 준비하시고, [main.cpp 파일](https://github.com/DeepLearningStudy/caffe/blob/master/exam 115 | ples/ex4_layer/main.cpp)을 열어봅니다. 이 예제에서는 임의로 20차원의 값을 가지는 10개의 데이터(10x20x1x1)를 116 | bottom blob에 생성하고, 각 데이터 별로 가장 큰 값을 가지는 차원의 수를 찾는 argmax 문제입니다. 117 | 118 | $$label_i = \underset{j} {\mathrm{argmax}} ~{x_{ij}}$$ 119 | 120 | 첫 번째로, 비어있는 top blob과 `GaussianFiller`를 이용하여 bottom blob을 생성합니다. 121 | 122 | ``` 123 | Blob* blob_top = new Blob(); 124 | Blob* blob_bottom = new Blob(10, 20, 1, 1); 125 | FillerParameter filler_param; 126 | GaussianFiller filler(filler_param); 127 | filler.Fill(blob_bottom); 128 | ``` 129 | 130 | `GaussianFiller` 역시 `FillerParameter`로 정의된 값을 가지는데요, 여기서는 아무 값도 정의하지 않은 기본값을 131 | 사용합니다. 그럼 기본값은 어떻게 정의가 되어 있는지 알 수 있을까요? caffe에서는 모든 파라미터 정의는 위에서 본 proto파일에 정의가 132 | 되어 있습니다. 그 중에서 [FillerParameter 부분](https://github.com/BVLC/caffe/blob/master/sr 133 | c/caffe/proto/caffe.proto#L43-L62) 을 보면, GaissianFiller에 대한 초기값은 아래처럼 설정되어 있는 것을 134 | 찾을 수 있습니다. 135 | 136 | ``` 137 | optional float mean = 5 [default = 0]; // the mean value in Gaussian filler 138 | optional float std = 6 [default = 1]; // the std value in Gaussian filler 139 | ``` 140 | 141 | 즉, 평균 0 표준편차 1인 정규분포에서 임의로 값을 셈플링해서 bottom blob에 채워 넣습니다. 142 | 143 | 그 다음에는 layer에 bottom/top blob들을 정의하기 위해서 blob 벡터를 만듭니다. 여기서는 bottom/top blob이 144 | 하나씩 밖에 없네요. 145 | 146 | ``` 147 | vector*> blob_bottom_vec; 148 | vector*> blob_top_vec; 149 | blob_bottom_vec.push_back(blob_bottom); 150 | blob_top_vec.push_back(blob_top); 151 | ``` 152 | 153 | 이제 argmax layer를 만들어 봅시다. 앞에서 살펴보았듯이, 모든 layer는 `LayerParameter`타입의 값을 인자로 받습니다. 154 | 여기서는 `ArgMaxLayer`를 정의해야 하기 때문에, `ArgMaxParameter` 타입의 파라미터 값들을 셋팅하고, 155 | `layer_param`에 저장합니다. 156 | 157 | ``` 158 | LayerParameter layer_param; 159 | ArgMaxParameter* argmax_param = layer_param.mutable_argmax_param(); 160 | argmax_param->set_out_max_val(true); // two channel: 0 arg, 1 max_val 161 | ArgMaxLayer layer(layer_param); 162 | layer.SetUp(blob_bottom_vec, blob_top_vec); 163 | ``` 164 | 165 | `ArgMaxParameter`가 무슨 변수들을 가지는지는 역시 proto 파일에서 [해당부분](https://github.com/BVLC/ca 166 | ffe/blob/master/src/caffe/proto/caffe.proto#L466-L475)을 살펴보면 알 수 있습니다. 여기서는 167 | `out_max_val`값을 `true`로 설정했는데요, 이는 top blob에 argmax 값 외에도 max값도 저장한다는 의미입니다. 즉 168 | top blob의 체널수가 2가 됩니다. 169 | 170 | 그럼 이제 blob들이 잘 셋팅이 되었는지 확인해봅시다. 171 | 172 | ``` 173 | cout<<"blob_top_num:"<num()<num()<channels()<num(); 204 | int dim = blob_bottom->count() / num; 205 | for (int i = 0; i < num; ++i) { 206 | max_ind = top_data[blob_top->offset(i,0,0,0)]; 207 | max_val = top_data[blob_top->offset(i,1,0,0)]; 208 | cout<<"max_ind:"< 와 각 데이터에 따른 하나의 실수값을 가지는 출력 벡터 가 있을 때, 선형회기는 입력과 출력 사이의 선형변환 관계를 나타내는 D차원의 18 | 변수값 를 구하는 것입니다. 19 | 20 | 이 문제는 다음과 같은 loss function을 최소화 하는 w를 구하는 문제로, 최소자승법을 사용하여 간단히 구할 수 있습니다. 21 | 22 | 23 | 24 | 하지만, X의 값 전체를 미리 알 수 없을 때, 또는 X의 값이 너무 커서 메트릭스 연산이 가능한 메모리 용량을 넘어서게 될때는 최소자승법으로 25 | 구할 수 없습니다. 이런 경우 수치해석적인 방법으로 풀수가 있는데요, 이를 online learning 이라고 하며, 가장 널리 사용되는 26 | 방법으로는 gradient descent algorithm 이 있습니다. 뉴럴네트워크 모델의 기본이 되는 방법이기도 하며, 선형회기 문제에서는 27 | 위의 loss function이 하나의 global optima를 가지므로 gradient descent 방법으로 최적의 해를 찾을 수 28 | 있습니다. 29 | 30 | gradient descent 방법은 간단하게 다음과 같이 설명할 수 있습니다. 모든 w 값을 임의의 값으로 초기화한 다음, 각 데이터가 들어올 31 | 때마다, 현재 w값의 변화에 따른 loss function의 변화량 (gradient)를 계산합니다. 32 | 33 | 34 | 35 | 그 이후에, 각 w 값을 다음 업데이트 룰에 따라 갱신합니다. 여기서 값은 learning rate이라고 하며 1보다 작은 값을 취합니다. 37 | 38 | 39 | 40 | 위의 과정을 w값이 특정 값에 수렴할때까지 모든 데이터에 대해서 반복적으로 수행합니다. 참고로, 데이터 하나마다 w값을 업데이트 하는 것을 41 | incremental learning 이라고 하고, 모든 데이터에 대한 gradient를 모았다가 한번에 w값을 갱신하는 방법을 batch 42 | learning, 그리고 한정된 수 만큼의 데이터에 대한 gradient를 모았다가 갱신하는 방법을 mini-batch learning 이라고 43 | 합니다. 자세한 내용은 Sarle, Warren, S(2002)의 [Neural Network 44 | FAQ2](ftp://ftp.sas.com/pub/neural/FAQ2.html)를 참고하세요. 45 | 46 | ### Logistic Regression Model 47 | 48 | 앞에서 알아본 Logistic Regression은 실수값을 출력으로 갖는 회기분석법입니다. 하지만 이를 이용해서 분류기로 사용할 수 있는데요. 49 | 출력값이 각 데이터의 라벨을 나타내고자 할 때, regression의 출력은 각 카테고리가 라벨이 될 확률값이 됩니다. 0과 1사이의 확률값을 50 | 출력으로 나타내는 regression 모델을 만들기 위해서, logistic function이라고 부르는 비선형 함수를 위에서 본 linear 51 | regression 뒤에 붙이면 되는데요. 수식으로 표현하면 다음과 같이 두 단계로 표현됩니다. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 앞의 예제에서 알아본 Caffe의 layer를 사용하면, 위의 선형 변환, 비선형 logistic 함수로 이루어진 두 단계를 두 층의 60 | layer를 이용하여 나타낼 수 있습니다. 바로 아래와 같은 inner product layer 와 softmax loss layer 입니다. 61 | 62 | Drawing 64 | 65 | 위의 그래프에서 파란색 사각형은 layer를, 노란색 팔각형은 blob을 나타내는데요, inner product (ip) layer는 데이터를 66 | bottom blob으로 하고, 위의 수식에서 g(x)값인 ip라는 top blob을 생성합니다. ip layer 안에 파라미터 blob으로는 67 | 선형변환을 나타내는 w와 b를 가지고 있습니다. 여기서 multi-class인 경우 (즉 MNIST 데이터는 10개의 class), class의 68 | 갯수(m)만큼의 ip 값을 출력 가지는데요. 따라서 w는 dxm 의 메트릭스로 표현이 됩니다. 69 | 70 | softmax loss layer는 m차원의 ip 값을 첫 번째 bottom blob으로 하고 label을 두 번째 bottom blob으로 71 | 합니다. ip값은 각 class 별로 위의 h(z) 단계를 거쳐서 각 class에 대한 추정 확률을 계산하게 되구요, 그 중에서 가장 큰 값을 72 | 가지는 class가 바로 추정된 label 값이 됩니다. 이렇게 softmax loss layer에서 추정된 label과 MNIST 73 | training data에서 정의된 label을 비교하여 loss를 계산합니다. 74 | 75 | ### Forward pass and Backward pass 76 | 77 | 앞에 강의에서 layer는 forward pass, backward pass를 계산할 수 있다는 것을 배웠는데요, LogReg 모델에서 두 78 | 과정이 어떻게 계산이 되는지 알아보겠습니다. 79 | 80 | 82 | 84 | 85 | 첫 번째 그림은 앞서 설명한 데이터로부터 g(x), h(z) 두 식을 이용하여 loss를 구하는 forward 과정을 나타내는 그림입니다. 86 | 여기서 두 번째 그림인 backward 과정을 눈여겨 볼까 합니다. 먼저 forward pass로 부터 loss 가 구해진 이후에, 각 class 별 확률값인 h(z)에 따른 loss의 88 | 변화량 softmax gradient()를 계산할 수 있습니다. 89 | MNIST dataset 인 경우에는 1개의 loss로부터 10개의 가 구해지겠죠. 91 | 92 | 각 softmax gradient로부터 입력 데이터의 차원수 만큼의 weight 값들의 gradient가 계산될 수 있는데요. 이를 라고 하면, 각 weight에 따른 loss의 변화량은 다음과 같은 chain 94 | rule 에 의해 구할 수 있습니다. 95 | 96 | 97 | 98 | 이렇게 얻어진 각 weight의 gradient는 앞에서 소개한 weight update rule ()에 의해 weight를 갱신합니다. 100 | 101 | Caffe의 layer에서 `Backward()` 함수는 이렇게 계산된 각 weight의 gradient ()를 layer의 `diff` 변수에 저장합니다. 그리고 `Update()` 103 | 명령을 통해 weight update rule을 실행하게 됩니다. 104 | 105 | ## Example source code 106 | 107 | 앞에서 설명한 LogReg 모델을 Caffe의 layer를 이용해서 직접 구현해보고, MNIST training dataset을 이용해 학습하고 108 | test dataset을 통해 모델의 예측 정확도를 측정해 봅시다. 먼저 깃헙에 있는 [ex5_logreg_mnist](https://githu 109 | b.com/DeepLearningStudy/caffe/tree/master/examples/ex5_logreg_mnist) 준비합니다. [ex_ 110 | logreg_mnist.cpp](https://github.com/DeepLearningStudy/caffe/blob/master/example 111 | s/ex5_logreg_mnist/ex_logreg_mnist.cpp) 파일의 main 함수를 보면서 설명을 구현 과정을 설명 하겠습니다. 112 | 113 | ### Data layer 114 | 115 | 위의 LogReg 모델에서 가장 아래에 있는 layer는 data layer 입니다. 이 레이어의 역할은 lmdb 또는 leveldb로 정의된 116 | 데이터 파일을 읽어와서 blob으로 저장하고, top blob으로 입력 데이터 x와 출력 데이터 y을 분리해서 두 개의 top blob으로 117 | 생성합니다. 또한 제한된 메모리에 다 저장하지 못하는 양이 많은 데이터인 경우를 위해, batch_size 만큼의 데이터를 렌덤하게 골라서 118 | 한정된 크기의 blob을 만들 수도 있구요, 데이터를 출력하기 전에 스케일링 하기도 합니다. 119 | 120 | 앞선 강좌에서 layer를 정의하는 방법은 알아보았으니, data layer의 경우에만 해당하는 레이어 파라미터 부분을 살펴보도록 하겠습니다. 121 | 122 | ``` 123 | blob_top_data_vec.push_back(blob_data); 124 | blob_top_data_vec.push_back(blob_label); 125 | 126 | LayerParameter layer_data_param; 127 | DataParameter* data_param = layer_data_param.mutable_data_param(); 128 | data_param->set_batch_size(64); 129 | data_param->set_source("caffe/caffe/examples/mnist/mnist_train_lmdb"); 130 | data_param->set_backend(caffe::DataParameter_DB_LMDB); 131 | 132 | TransformationParameter* transform_param = 133 | layer_data_param.mutable_transform_param(); 134 | transform_param->set_scale(1./255.); 135 | 136 | DataLayer layer_data(layer_data_param); 137 | layer_data.SetUp(blob_bottom_data_vec, blob_top_data_vec); 138 | ``` 139 | 140 | 우선 [`DataParameter`](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/c 141 | affe.proto#L565-L597)는 데이터셋의 위치와 타입, batch 크기를 결정합니다. 여기서는 앞에 [MNIST 142 | 강좌](http://deeplearningstudy.github.io/material/doc_caffe_example_3mnist.html)에서 143 | 설치한 mnist lmdb 경로를 지정해줍니다. 먼저 모델을 학습하기 위해 사용하는 training data로 data layer를 만듭니다. 144 | [`TransformationParameter`](https://github.com/BVLC/caffe/blob/master/src/caffe/ 145 | proto/caffe.proto#L398-417)는 데이터를 스케일링 할때 사용합니다. 여기서 MNIST 데이터는 0~255 사이의 값이므로, 146 | 0~1로 정규화 하였습니다. 147 | 148 | ### Inner product (ip) layer 149 | 150 | 두 번째로 ip layer를 만들어보겠습니다. ip layer는 data layer의 top blob인 `blob_data` 를 bottom 151 | blob으로 하고, `blob_top_ip` 를 생성합니다. 152 | 153 | ``` 154 | vector*> blob_bottom_ip_vec; 155 | vector*> blob_top_ip_vec; 156 | Blob* const blob_top_ip = new Blob(); 157 | 158 | blob_bottom_ip_vec.push_back(blob_data); 159 | blob_top_ip_vec.push_back(blob_top_ip); 160 | 161 | LayerParameter layer_ip_param; 162 | layer_ip_param.mutable_inner_product_param()->set_num_output(nClass); 163 | layer_ip_param.mutable_inner_product_param()->mutable_weight_filler()->set_type( 164 | "xavier"); 165 | layer_ip_param.mutable_inner_product_param()->mutable_bias_filler()->set_type("c 166 | onstant"); 167 | 168 | InnerProductLayer layer_ip(layer_ip_param); 169 | layer_ip.SetUp(blob_bottom_ip_vec, blob_top_ip_vec); 170 | ``` 171 | 172 | ip layer의 출력은 class 갯수(10) 만큼이며, ip layer의 [setting parameter](https://github.co 173 | m/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L736-L756)를 통해 weight 및 174 | bias 값을 [xavier](http://andyljones.tumblr.com/post/110998971763/an-explanation- 175 | of-xavier-initialization) 방법을 이용하여 초기화 하였습니다. 176 | 177 | ### Softmax loss layer 178 | 179 | 마지막으로 softmax loss layer를 세팅합니다. 위에 그림에서 보시는데로 ip layer의 top blob과 data layer의 180 | `blob_label` 을 입력으로 하고, loss 값을 `blob_top_loss` blob에 출력으로 저장합니다. 181 | 182 | ``` 183 | vector*> blob_bottom_loss_vec; 184 | vector*> blob_top_loss_vec; 185 | Blob* const blob_top_loss = new Blob(); 186 | 187 | blob_bottom_loss_vec.push_back(blob_top_ip); 188 | blob_bottom_loss_vec.push_back(blob_label); 189 | blob_top_loss_vec.push_back(blob_top_loss); 190 | 191 | LayerParameter layer_loss_param; 192 | SoftmaxWithLossLayer layer_loss(layer_loss_param); 193 | layer_loss.SetUp(blob_bottom_loss_vec, blob_top_loss_vec); 194 | ``` 195 | 196 | ### Forward and backward pass 197 | 198 | 드디어 LogReg 모델이 만들어졌습니다. 이제는 이 모델을 학습할 차례인데요, 학습은 위에서 간략히 설명한것 처럼 forward, 199 | backward, update 이 세 과정을 loss값이 수렴할 때까지 반복합니다. 여기서는 간단히 `nIter` 만큼 `for` 문으로 200 | 반복하도록 하겠습니다. 201 | 202 | ``` 203 | for(int n=0;n backpro_vec; 212 | backpro_vec.push_back(1); 213 | backpro_vec.push_back(0); 214 | layer_loss.Backward(blob_top_loss_vec, backpro_vec, blob_bottom_loss_vec); 215 | layer_ip.Backward(blob_top_ip_vec, backpro_vec, blob_bottom_ip_vec); 216 | 217 | // update weights of layer_ip 218 | Dtype rate = 0.1; 219 | vector > > param = layer_ip.blobs(); 220 | caffe_scal(param[0]->count(), rate, param[0]->mutable_cpu_diff()); 221 | param[0]->Update(); 222 | } 223 | ``` 224 | 225 | 실행결과를 보면 다음과 같이 iteration이 진행될 수록 loss값이 줄어드는 것을 볼 수 있습니다. 226 | 227 | ``` 228 | Iter 0 loss 2.30016 229 | Iter 1 loss 2.12608 230 | Iter 2 loss 2.19263 231 | Iter 3 loss 1.93675 232 | Iter 4 loss 1.85901 233 | Iter 5 loss 1.75871 234 | Iter 6 loss 1.68629 235 | Iter 7 loss 1.68272 236 | Iter 8 loss 1.64218 237 | Iter 9 loss 1.72062 238 | Iter 10 loss 1.57099 239 | ... 240 | Iter 100 loss 0.501477 241 | Iter 101 loss 0.614108 242 | Iter 102 loss 0.401204 243 | Iter 103 loss 0.421984 244 | Iter 104 loss 0.523702 245 | Iter 105 loss 0.487135 246 | Iter 106 loss 0.750514 247 | Iter 107 loss 0.576815 248 | Iter 108 loss 0.639771 249 | Iter 109 loss 0.678125 250 | Iter 110 loss 0.506516 251 | ... 252 | Iter 1000 loss 0.343701 253 | Iter 1001 loss 0.336663 254 | Iter 1002 loss 0.595591 255 | Iter 1003 loss 0.215748 256 | Iter 1004 loss 0.34533 257 | Iter 1005 loss 0.305032 258 | Iter 1006 loss 0.18276 259 | Iter 1007 loss 0.400066 260 | Iter 1008 loss 0.132792 261 | Iter 1009 loss 0.290646 262 | Iter 1010 loss 0.419739 263 | ... 264 | Iter 9990 loss 0.449115 265 | Iter 9991 loss 0.549783 266 | Iter 9992 loss 0.229075 267 | Iter 9993 loss 0.172593 268 | Iter 9994 loss 0.322345 269 | Iter 9995 loss 0.287676 270 | Iter 9996 loss 0.256037 271 | Iter 9997 loss 0.263619 272 | Iter 9998 loss 0.274014 273 | Iter 9999 loss 0.346595 274 | ``` 275 | 276 | 여기서는 batch 갯수를 64개로 하였는데요, 그 갯수만큼 data layer가 임의의 데이터를 추출하기 때문에 60000개의 MNIST 277 | training data를 모두 다 학습하는데 사용하기 위해서는 최소 10000번의 iteration이 필요합니다. 하지만 보시는데로 278 | 1000번에서 9999번 사이에는 training loss의 감소가 유의미하게 보이지 않습니다. 279 | 280 | ### MNIST label prediction 281 | 282 | 이제 학습된 모델을 주어진 MNIST test data에 적용하여 라벨을 예측해보도록 합시다. 위에서 만들어진 LogReg 모델을 새로운 283 | 데이터셋에 맞게 수정을 해야 하는데요, 학습된 weight, bias 값은 유지하면서 레이어를 재조정하는 `Reshape()` 기능을 284 | 사용합니다. 285 | 286 | 먼저 data layer를 새로 만듭니다. 이번에는 mnist test lmdb를 입력으로 하고, batch size를 10000개로 287 | 조정합니다. 288 | 289 | ``` 290 | testdata_param->set_batch_size(10000); 291 | testdata_param->set_source("/home/koosy/caffe/caffe/examples/mnist/mnist_test_lm 292 | db"); 293 | testdata_param->set_backend(caffe::DataParameter_DB_LMDB); 294 | ``` 295 | 296 | 그리고 새로운 data layer의 출력을 입력으로 받는 layer_ip와 layer_loss를 reshaping 합니다. 297 | 298 | ``` 299 | layer_ip.Reshape(blob_bottom_ip_test_vec, blob_top_ip_vec); 300 | ... 301 | layer_loss.Reshape(blob_bottom_loss_test_vec, blob_top_loss_vec); 302 | ``` 303 | 304 | 마지막으로, 이전 강좌에서 다루었던 argmax layer를 ip layer위에 붙여서 label prediction 값을 확인해 보도록 305 | 하겠습니다. 306 | 307 | ``` 308 | blob_bottom_argmax_vec.push_back(blob_top_ip); 309 | blob_top_argmax_vec.push_back(blob_top_argmax); 310 | ... 311 | layer_argmax.SetUp(blob_bottom_argmax_vec, blob_top_argmax_vec); 312 | ``` 313 | 314 | Prediction은 새로 재구성된 layer들의 forward 과정을 통해 결과를 얻을 수 있습니다. 315 | 316 | ``` 317 | layer_testdata.Forward(blob_bottom_testdata_vec, blob_top_testdata_vec); 318 | layer_ip.Forward(blob_bottom_ip_test_vec, blob_top_ip_vec); 319 | layer_argmax.Forward(blob_bottom_argmax_vec, blob_top_argmax_vec); 320 | Dtype loss = layer_loss.Forward(blob_bottom_loss_test_vec, blob_top_loss_vec); 321 | ``` 322 | 323 | ### Result 324 | 325 | 이제 10000개의 test data 중에 얼마나 정확하게 정답을 맞추었는지 한번 보도록 하겠습니다. 326 | 327 | ``` 328 | for (int n = 0; ncount();n++){ 329 | cnt ++; 330 | Dtype* label_data = blob_testlabel->mutable_cpu_data(); 331 | int truelabel = label_data[n]; 332 | 333 | Dtype* prediction_data = blob_top_argmax-> mutable_cpu_data(); 334 | int predictedlabel = prediction_data[n]; 335 | 336 | if(truelabel == predictedlabel){ 337 | correct++; 338 | } 339 | } 340 | cout << "Accuracy: " << correct <<"/" << cnt <