Add CMakeLists.txt for CPU library only.

This commit is contained in:
szykk1993 2018-11-21 15:27:02 -05:00
parent 61c9d02ec4
commit fb5acbcfaa
3 changed files with 84 additions and 2 deletions

6
.gitignore vendored
View File

@ -1,4 +1,6 @@
*.o
*.a
*.so
*.dSYM
*.csv
*.out
@ -25,3 +27,7 @@ ehthumbs.db
Icon?
Thumbs.db
*.swp
# Jetbrains files
.idea/
cmake-build-*

76
CMakeLists.txt Normal file
View File

@ -0,0 +1,76 @@
cmake_minimum_required(VERSION 2.8)
project(darknet)
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF ()
# TODO: Add CUDA support.
option(USE_CUDA "CUDA support." ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
set(CORE_FILES
${PROJECT_SOURCE_DIR}/src/activation_layer.c
${PROJECT_SOURCE_DIR}/src/activations.c
${PROJECT_SOURCE_DIR}/src/avgpool_layer.c
${PROJECT_SOURCE_DIR}/src/batchnorm_layer.c
${PROJECT_SOURCE_DIR}/src/blas.c
${PROJECT_SOURCE_DIR}/src/box.c
${PROJECT_SOURCE_DIR}/src/col2im.c
${PROJECT_SOURCE_DIR}/src/connected_layer.c
${PROJECT_SOURCE_DIR}/src/convolutional_layer.c
${PROJECT_SOURCE_DIR}/src/cost_layer.c
${PROJECT_SOURCE_DIR}/src/crnn_layer.c
${PROJECT_SOURCE_DIR}/src/crop_layer.c
${PROJECT_SOURCE_DIR}/src/cuda.c
${PROJECT_SOURCE_DIR}/src/data.c
${PROJECT_SOURCE_DIR}/src/deconvolutional_layer.c
${PROJECT_SOURCE_DIR}/src/demo.c
${PROJECT_SOURCE_DIR}/src/detection_layer.c
${PROJECT_SOURCE_DIR}/src/dropout_layer.c
${PROJECT_SOURCE_DIR}/src/gemm.c
${PROJECT_SOURCE_DIR}/src/gru_layer.c
${PROJECT_SOURCE_DIR}/src/im2col.c
${PROJECT_SOURCE_DIR}/src/image.c
${PROJECT_SOURCE_DIR}/src/image_opencv.cpp
${PROJECT_SOURCE_DIR}/src/iseg_layer.c
${PROJECT_SOURCE_DIR}/src/l2norm_layer.c
${PROJECT_SOURCE_DIR}/src/layer.c
${PROJECT_SOURCE_DIR}/src/list.c
${PROJECT_SOURCE_DIR}/src/local_layer.c
${PROJECT_SOURCE_DIR}/src/logistic_layer.c
${PROJECT_SOURCE_DIR}/src/lstm_layer.c
${PROJECT_SOURCE_DIR}/src/matrix.c
${PROJECT_SOURCE_DIR}/src/maxpool_layer.c
${PROJECT_SOURCE_DIR}/src/network.c
${PROJECT_SOURCE_DIR}/src/normalization_layer.c
${PROJECT_SOURCE_DIR}/src/option_list.c
${PROJECT_SOURCE_DIR}/src/parser.c
${PROJECT_SOURCE_DIR}/src/region_layer.c
${PROJECT_SOURCE_DIR}/src/reorg_layer.c
${PROJECT_SOURCE_DIR}/src/rnn_layer.c
${PROJECT_SOURCE_DIR}/src/route_layer.c
${PROJECT_SOURCE_DIR}/src/shortcut_layer.c
${PROJECT_SOURCE_DIR}/src/softmax_layer.c
${PROJECT_SOURCE_DIR}/src/tree.c
${PROJECT_SOURCE_DIR}/src/upsample_layer.c
${PROJECT_SOURCE_DIR}/src/utils.c
${PROJECT_SOURCE_DIR}/src/yolo_layer.c)
set(CORE_CU_FILES
${PROJECT_SOURCE_DIR}/src/activation_kernels.cu
${PROJECT_SOURCE_DIR}/src/avgpool_layer_kernels.cu
${PROJECT_SOURCE_DIR}/src/col2im_kernels.cu
${PROJECT_SOURCE_DIR}/src/blas_kernels.cu
${PROJECT_SOURCE_DIR}/src/convolutional_kernels.cu
${PROJECT_SOURCE_DIR}/src/crop_layer_kernels.cu
${PROJECT_SOURCE_DIR}/src/deconvolutional_kernels.cu
${PROJECT_SOURCE_DIR}/src/dropout_layer_kernels.cu
${PROJECT_SOURCE_DIR}/src/im2col_kernels.cu
${PROJECT_SOURCE_DIR}/src/maxpool_layer_kernels.cu)
INCLUDE_DIRECTORIES(include)
ADD_LIBRARY(darknet STATIC ${CORE_FILES})

View File

@ -287,7 +287,7 @@ void validate_attention_single(char *datacfg, char *filename, char *weightfile)
printf("\n");
copy_cpu(classes, pred, 1, avgs, 1);
top_k(pred + classes, divs*divs, divs*divs, inds);
show_image(crop, "crop");
show_image(crop, "crop", 1);
for(j = 0; j < extra; ++j){
int index = inds[j];
int row = index / divs;
@ -298,7 +298,7 @@ void validate_attention_single(char *datacfg, char *filename, char *weightfile)
image tile = crop_image(crop, x, y, net->w, net->h);
float *pred = network_predict(net, tile.data);
axpy_cpu(classes, 1., pred, 1, avgs, 1);
show_image(tile, "tile");
show_image(tile, "tile", 1);
//cvWaitKey(10);
}
if(net->hierarchy) hierarchy_predictions(pred, net->outputs, net->hierarchy, 1, 1);