From e18be284a86af8a5d57cc3201674f36bc503928b Mon Sep 17 00:00:00 2001 From: abner2015 Date: Wed, 8 Nov 2017 10:58:33 +0800 Subject: [PATCH 1/4] Update README.md changed the make way --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e0f184..2879b9d 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,9 @@ the mxnet unoffical version Feature Pyramid Network: https://github.com/unsky/F dowload VGG16 `VGG16.v2.caffemodel` and your dataset ### make caffe ``` -cd FP-caffe -mkdir build -cd build -cmake .. -make -j16 all +cd caffe-FP_Net +make -j8 && make pycaffe + ``` ### make lib From f9dcead325d4ebbfae5bee600a3419caceca39df Mon Sep 17 00:00:00 2001 From: abner2015 Date: Wed, 8 Nov 2017 11:00:46 +0800 Subject: [PATCH 2/4] Update Makefile delete the all code and replace with other Makefile --- caffe-FP_Net/Makefile | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/caffe-FP_Net/Makefile b/caffe-FP_Net/Makefile index 598d28d..9662db3 100644 --- a/caffe-FP_Net/Makefile +++ b/caffe-FP_Net/Makefile @@ -178,8 +178,8 @@ ifneq ($(CPU_ONLY), 1) LIBRARIES := cudart cublas curand endif -LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 - +#LIBRARIES += glog gflags protobuf boost_system boost_filesystem boost_regex m hdf5_hl hdf5 +LIBRARIES += glog gflags protobuf boost_system boost_filesystem boost_regex m hdf5_serial_hl hdf5_serial opencv_imgcodecs # handle IO dependencies USE_LEVELDB ?= 1 USE_LMDB ?= 1 @@ -192,12 +192,15 @@ ifeq ($(USE_LMDB), 1) LIBRARIES += lmdb endif ifeq ($(USE_OPENCV), 1) - LIBRARIES += opencv_core opencv_highgui opencv_imgproc + LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_videoio ifeq ($(OPENCV_VERSION), 3) - LIBRARIES += opencv_imgcodecs + LIBRARIES += glog gflags protobuf leveldb snappy + lmdb boost_system boost_filesystem hdf5_hl hdf5 m + opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio + #LIBRARIES += opencv_imgcodecs opencv_videoio endif - + endif PYTHON_LIBRARIES ?= boost_python python2.7 WARNINGS := -Wall -Wno-sign-compare @@ -248,6 +251,8 @@ ifeq ($(UNAME), Linux) LINUX := 1 else ifeq ($(UNAME), Darwin) OSX := 1 + OSX_MAJOR_VERSION := $(shell sw_vers -productVersion | cut -f 1 -d .) + OSX_MINOR_VERSION := $(shell sw_vers -productVersion | cut -f 2 -d .) endif # Linux @@ -270,22 +275,29 @@ endif ifeq ($(OSX), 1) CXX := /usr/bin/clang++ ifneq ($(CPU_ONLY), 1) - CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release \d' | grep -o '\d') + CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release [0-9.]*' | tr -d '[a-z ]') ifeq ($(shell echo | awk '{exit $(CUDA_VERSION) < 7.0;}'), 1) CXXFLAGS += -stdlib=libstdc++ LINKFLAGS += -stdlib=libstdc++ endif # clang throws this warning for cuda headers WARNINGS += -Wno-unneeded-internal-declaration + # 10.11 strips DYLD_* env vars so link CUDA (rpath is available on 10.5+) + OSX_10_OR_LATER := $(shell [ $(OSX_MAJOR_VERSION) -ge 10 ] && echo true) + OSX_10_5_OR_LATER := $(shell [ $(OSX_MINOR_VERSION) -ge 5 ] && echo true) + ifeq ($(OSX_10_OR_LATER),true) + ifeq ($(OSX_10_5_OR_LATER),true) + LDFLAGS += -Wl,-rpath,$(CUDA_LIB_DIR) + endif + endif endif # gtest needs to use its own tuple to not conflict with clang COMMON_FLAGS += -DGTEST_USE_OWN_TR1_TUPLE=1 # boost::thread is called boost_thread-mt to mark multithreading on OS X LIBRARIES += boost_thread-mt # we need to explicitly ask for the rpath to be obeyed - DYNAMIC_FLAGS := -install_name @rpath/libcaffe.so ORIGIN := @loader_path - VERSIONFLAGS += -Wl,-install_name,$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib + VERSIONFLAGS += -Wl,-install_name,@rpath/$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib else ORIGIN := \$$ORIGIN endif @@ -355,9 +367,9 @@ ifeq ($(BLAS), mkl) # MKL LIBRARIES += mkl_rt COMMON_FLAGS += -DUSE_MKL - MKL_DIR ?= /opt/intel/mkl - BLAS_INCLUDE ?= $(MKL_DIR)/include - BLAS_LIB ?= $(MKL_DIR)/lib $(MKL_DIR)/lib/intel64 + MKLROOT ?= /opt/intel/mkl + BLAS_INCLUDE ?= $(MKLROOT)/include + BLAS_LIB ?= $(MKLROOT)/lib $(MKLROOT)/lib/intel64 else ifeq ($(BLAS), open) # OpenBLAS LIBRARIES += openblas @@ -373,8 +385,11 @@ else LIBRARIES += cblas # 10.10 has accelerate while 10.9 has veclib XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep 'version' | sed 's/[^0-9]*\([0-9]\).*/\1/') + XCODE_CLT_GEQ_7 := $(shell [ $(XCODE_CLT_VER) -gt 6 ] && echo 1) XCODE_CLT_GEQ_6 := $(shell [ $(XCODE_CLT_VER) -gt 5 ] && echo 1) - ifeq ($(XCODE_CLT_GEQ_6), 1) + ifeq ($(XCODE_CLT_GEQ_7), 1) + BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$(shell ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ | sort | tail -1)/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers + else ifeq ($(XCODE_CLT_GEQ_6), 1) BLAS_INCLUDE ?= /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/ LDFLAGS += -framework Accelerate else @@ -392,7 +407,7 @@ LIBRARY_DIRS += $(LIB_BUILD_DIR) CXXFLAGS += -MMD -MP # Complete build flags. -COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) +COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir)) CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) # mex may invoke an older gcc that is too liberal with -Wuninitalized @@ -552,7 +567,7 @@ $(ALL_BUILD_DIRS): | $(BUILD_DIR_LINK) $(DYNAMIC_NAME): $(OBJS) | $(LIB_BUILD_DIR) @ echo LD -o $@ - $(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS) $(DYNAMIC_FLAGS) + $(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS) @ cd $(BUILD_DIR)/lib; rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT) $(STATIC_NAME): $(OBJS) | $(LIB_BUILD_DIR) From 41e19ec7083515b1d29a7641a222c66fdae6b611 Mon Sep 17 00:00:00 2001 From: abner2015 Date: Wed, 8 Nov 2017 11:01:38 +0800 Subject: [PATCH 3/4] Create Makefile.config add new file --- caffe-FP_Net/Makefile.config | 116 +++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 caffe-FP_Net/Makefile.config diff --git a/caffe-FP_Net/Makefile.config b/caffe-FP_Net/Makefile.config new file mode 100644 index 0000000..756cb54 --- /dev/null +++ b/caffe-FP_Net/Makefile.config @@ -0,0 +1,116 @@ +## Refer to http://caffe.berkeleyvision.org/installation.html +# Contributions simplifying and improving our build system are welcome! + +# cuDNN acceleration switch (uncomment to build with cuDNN). +# USE_CUDNN := 1 + +# CPU-only switch (uncomment to build without GPU support). +# CPU_ONLY := 1 + +# uncomment to disable IO dependencies and corresponding data layers +# USE_OPENCV := 0 +# USE_LEVELDB := 0 +# USE_LMDB := 0 + +# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary) +# You should not set this flag if you will be reading LMDBs with any +# possibility of simultaneous read and write +# ALLOW_LMDB_NOLOCK := 1 + +# Uncomment if you're using OpenCV 3 +# OPENCV_VERSION := 3 + +# To customize your choice of compiler, uncomment and set the following. +# N.B. the default for Linux is g++ and the default for OSX is clang++ +# CUSTOM_CXX := g++ + +# CUDA directory contains bin/ and lib/ directories that we need. +CUDA_DIR := /usr/local/cuda +# On Ubuntu 14.04, if cuda tools are installed via +# "sudo apt-get install nvidia-cuda-toolkit" then use this instead: +# CUDA_DIR := /usr + +# CUDA architecture setting: going with all of them. +# For CUDA < 6.0, comment the lines after *_35 for compatibility. +CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \ + -gencode arch=compute_20,code=sm_21 \ + -gencode arch=compute_30,code=sm_30 \ + -gencode arch=compute_35,code=sm_35 \ + -gencode arch=compute_50,code=sm_50 \ + -gencode arch=compute_52,code=sm_52 \ + -gencode arch=compute_61,code=sm_61 + +# BLAS choice: +# atlas for ATLAS (default) +# mkl for MKL +# open for OpenBlas +# BLAS := atlas +BLAS := open +# Custom (MKL/ATLAS/OpenBLAS) include and lib directories. +# Leave commented to accept the defaults for your choice of BLAS +# (which should work)! +# BLAS_INCLUDE := /path/to/your/blas +# BLAS_LIB := /path/to/your/blas + +# Homebrew puts openblas in a directory that is not on the standard search path +# BLAS_INCLUDE := $(shell brew --prefix openblas)/include +# BLAS_LIB := $(shell brew --prefix openblas)/lib + +# This is required only if you will compile the matlab interface. +# MATLAB directory should contain the mex binary in /bin. +# MATLAB_DIR := /usr/local +# MATLAB_DIR := /Applications/MATLAB_R2012b.app + +# NOTE: this is required only if you will compile the python interface. +# We need to be able to find Python.h and numpy/arrayobject.h. +PYTHON_INCLUDE := /usr/include/python2.7 \ + /usr/lib/python2.7/dist-packages/numpy/core/include +# Anaconda Python distribution is quite popular. Include path: +# Verify anaconda location, sometimes it's in root. +# ANACONDA_HOME := $(HOME)/anaconda2 +# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ + $(ANACONDA_HOME)/include/python2.7 \ + $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \ + +# Uncomment to use Python 3 (default is Python 2) +# PYTHON_LIBRARIES := boost_python3 python3.5m +# PYTHON_INCLUDE := /usr/include/python3.5m \ +# /usr/lib/python3.5/dist-packages/numpy/core/include + +# We need to be able to find libpythonX.X.so or .dylib. +PYTHON_LIB := /usr/lib +# PYTHON_LIB := $(ANACONDA_HOME)/lib + +# Homebrew installs numpy in a non standard path (keg only) +# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include +# PYTHON_LIB += $(shell brew --prefix numpy)/lib + +# Uncomment to support layers written in Python (will link against Python libs) +WITH_PYTHON_LAYER := 1 + +# Whatever else you find you need goes here. +#INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial +INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial +LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86-linux-gnu/hdf5/serial +#LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib + +# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies +# INCLUDE_DIRS += $(shell brew --prefix)/include +# LIBRARY_DIRS += $(shell brew --prefix)/lib + +# Uncomment to use `pkg-config` to specify OpenCV library paths. +# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) +# USE_PKG_CONFIG := 1 + +# N.B. both build and distribute dirs are cleared on `make clean` +BUILD_DIR := build +DISTRIBUTE_DIR := distribute + +# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171 +# DEBUG := 1 + +# The ID of the GPU that 'make runtest' will use to run unit tests. +TEST_GPUID := 0 + +# enable pretty build (comment to see full commands) +Q ?= @ From f63542909eb2d2166c0fb75be030ceb72d8d5577 Mon Sep 17 00:00:00 2001 From: abner2015 Date: Wed, 8 Nov 2017 11:59:04 +0800 Subject: [PATCH 4/4] Update FP_Net_end2end.sh weight path --- experiments/scripts/FP_Net_end2end.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/scripts/FP_Net_end2end.sh b/experiments/scripts/FP_Net_end2end.sh index ae23793..1fc76d3 100644 --- a/experiments/scripts/FP_Net_end2end.sh +++ b/experiments/scripts/FP_Net_end2end.sh @@ -50,7 +50,7 @@ echo Logging output to "$LOG" time ./tools/train_net.py --gpu ${GPU_ID} \ --solver models/${PT_DIR}/${NET}/FP_Net_end2end/solver.prototxt \ - --weights output/FP_Net_end2end/voc_2007_trainval/fpn_iter_25000.caffemodel \ + --weights model/VGG16.v2.caffemodel \ --imdb ${TRAIN_IMDB} \ --iters ${ITERS} \ --cfg experiments/cfgs/FP_Net_end2end.yml \