kevinlin311tw / caffe-augmentation Goto Github PK
View Code? Open in Web Editor NEW:zap: Caffe real-time data augmentation on-the-fly!!
License: Other
:zap: Caffe real-time data augmentation on-the-fly!!
License: Other
Hello, and thank you for providing this code.
I have configured and built the project but I am getting the following error in make runtest:
[----------] 4 tests from ImageDataLayerTest/2, where TypeParam = caffe::GPUDevice<float>
[ RUN ] ImageDataLayerTest/2.TestResize
F0419 17:37:02.960711 23471 data_transformer.cpp:780] Check failed: rng_
*** Check failure stack trace: ***
@ 0x2b9b19650daa (unknown)
@ 0x2b9b19650ce4 (unknown)
@ 0x2b9b196506e6 (unknown)
@ 0x2b9b19653687 (unknown)
@ 0x2b9b1ae1d463 caffe::DataTransformer<>::Rand()
@ 0x2b9b1ae22c9e caffe::DataTransformer<>::Transform()
@ 0x2b9b1ad8659a caffe::ImageDataLayer<>::load_batch()
@ 0x2b9b1adbc539 caffe::BasePrefetchingDataLayer<>::InternalThreadEntry()
@ 0x2b9b1ae2a180 caffe::InternalThread::entry()
@ 0x2b9b230d6a4a (unknown)
@ 0x2b9b1b87a182 start_thread
@ 0x2b9b1bb8a47d (unknown)
@ (nil) (unknown)
make: *** [runtest] Aborted (core dumped)
I am not sure which version of caffe this branch is based on -I am compiling on CUDNN v3 and CUDA 7.0, used for older branches -the build process seems to work fine in this regard.
Thank you very much in any case.
When I try to train your caffe version, I got the following error:
I0521 16:29:55.447962 1219 solver.cpp:96] Creating training net from net file: /.../model.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 79:17: Message type "caffe.LayerParameter" has no field named "scale_param".
F0521 16:29:55.448328 1219 upgrade_proto.cpp:928] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file:
/...model/.prototxt
*** Check failure stack trace: ***
@ 0x7f034f105dbd google::LogMessage::Fail()
@ 0x7f034f107c5d google::LogMessage::SendToLog()
@ 0x7f034f1059ac google::LogMessage::Flush()
@ 0x7f034f10857e google::LogMessageFatal::~LogMessageFatal()
@ 0x7f034f7de7de caffe::ReadNetParamsFromTextFileOrDie()
@ 0x7f034f6e6e8b caffe::Solver<>::InitTrainNet()
@ 0x7f034f6e7e54 caffe::Solver<>::Init()
@ 0x7f034f6e8159 caffe::Solver<>::Solver()
@ 0x40ffc5 caffe::GetSolver<>()
@ 0x408cce train()
@ 0x406b71 main
@ 0x7f034de67f45 (unknown)
@ 0x40730b (unknown)
Aborted (core dumped)
It seems that there are no Scale
layer in your caffe version? @kevinlin311tw
May I know what is the minimal modification to make a standard caffe framework to this caffe-augmentation version? e.g. put which *.hpp and *.cpp , *.cu to src folder, and recompile ? I need this technique to integrate system. Thanks!
Because you project is real-time data augmentation on-the-fly.
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 227
mean_file: "/home/your/imagenet_mean.binaryproto"
contrast_adjustment: true
smooth_filtering: true
jpeg_compression: true
rotation_angle_interval: 30
display: true
}
image_data_param {
source: "/home/your/image/list.txt"
batch_size: 32
shuffle: true
new_height: 256
new_width: 256
}
}
How can I get this file ? -- > /home/your/imagenet_mean.binaryproto
If it's real time and I don't find the code where we create it.
So.
Should I change the code make it happen?
Or the mean file is used Org image files LMDB convert to it?
Hello,
Can you do it?
It is a very nice addition to the official build.
I wanted to use this build, but since I am using the latest caffe branch, and thus its new features, My models dont run in this branch.
How ever if you could do a PR in caffe it would benifit us all.
or if that is not possible, Would you please very briefly guide me how I can integrate this layer into the official branch?
Best Regards
Hi,
Thanks for the code.
I cloned the repo and tried to make.
Get the following error:
src/caffe/layers/cudnn_conv_layer.cu(140): error: too few arguments in function call
detected during instantiation of "void caffe::CuDNNConvolutionLayer::Backward_gpu(const std::vectorcaffe::Blob<Dtype *, std::allocatorcaffe::Blob<Dtype *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vectorcaffe::Blob<Dtype *, std::allocatorcaffe::Blob<Dtype *>> &) [with Dtype=double]"
(157): here
After some Googling, other people have had this issue when they have newer versions of CUDNN that are not supported... any ideas what's causing this issue?
@kevinlin311tw Does this repo support batch norm? Getting error while using batch_norm.
when make in cpu model errors happen as follow:
/caffe-augmentation/include/caffe/util/device_alternate.hpp:15:36: error: no ‘void caffe::K1_EuclideanLossLayer::Forward_gpu(const std::vector<caffe::Blob>&, const std::vector<caffe::Blob>&)’ member function declared in class ‘caffe::K1_EuclideanLossLayer’
const vector<Blob>& top) { NO_GPU; }
^
/caffe-augmentation/src/caffe/layers/K1_euclidean_loss_layer.cpp:86:1: note: in expansion of macro ‘STUB_GPU’
STUB_GPU(K1_EuclideanLossLayer);
/caffe-augmentation/include/caffe/util/device_alternate.hpp:19:39: error: no ‘void caffe::K1_EuclideanLossLayer::Backward_gpu(const std::vector<caffe::Blob>&, const std::vector&, const std::vector<caffe::Blob>&)’ member function declared in class ‘caffe::K1_EuclideanLossLayer’
const vector<Blob>& bottom) { NO_GPU; }
^
/caffe-augmentation/src/caffe/layers/K1_euclidean_loss_layer.cpp:86:1: note: in expansion of macro ‘STUB_GPU’
STUB_GPU(K1_EuclideanLossLayer);
hi,kevinlin311tw
thanks so much for sharing your code here!
since i've tried to understand how to use some parameters such as "rotation_angle_interval" ,i read your code in /src/caffe/data_transformer.cpp .and i am a little confused about rotation.when i set "rotation_angle_interval" to be 30,does it mean the input image would be rotated to any angle in [0,30,60,90,120...330]? because in usual cases,Maybe we just rotate the image to an limited angle (max angle=30)randomly?
Looking forward to your reply~
I'd like to use your this code. However make runtest error
Hi,
I've downloaded the repo (as zip), extracted and build caffe using cmake. But when I try run a network using one of the new implemented features, I get the following error:
"caffe.TransformationParameter" has no field named "rotation_angle_interval"
Anyone else experiencing this problem?
EDIT: Sorry, just wrong path specified, problem fixed.
Is there any documentation which files to add to caffe to make this work in a current installation?
It seems that the original image instead of the cropped image will be fed into the blob if you skip the rotation process(set rotation_interval=1). In src/caffe/data_transformer.cpp, the cv_img is cropped and stored in cv_cropped_img. Then in the rotation process, the cv_cropped_img is rotated and stored back in cv_img. At last, the cv_img is fed into the blob. So if you skip the rotation process, the cv_img is directly fed into the blob and the croped image is discarded.
Is there a "golden system" requirement for this library? I'm having unexpected build problems as detailed in the log below.
(caffe) toby@w8pc:~/caffe-augmentation$ CXXFLAGS=-std=c++11 CPPFLAGS=-std=c++11 cmake .
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.62.0
-- Found the following Boost libraries:
-- system
-- thread
-- chrono
-- date_time
-- atomic
-- Found GFlags: /usr/include
-- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found Glog: /usr/include
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
CMake Warning at /usr/share/cmake-3.9/Modules/FindProtobuf.cmake:429 (message):
Protobuf compiler version 3.6.1 doesn't match library version 3.0.0
Call Stack (most recent call first):
cmake/ProtoBuf.cmake:4 (find_package)
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:28 (include)
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0")
-- Found PROTOBUF Compiler: /home/toby/miniconda3/envs/caffe/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found HDF5: /home/toby/miniconda3/envs/caffe/lib/libhdf5_cpp.so;/home/toby/miniconda3/envs/caffe/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/home/toby/miniconda3/envs/caffe/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.2") found components: HL
-- Found LMDB: /usr/include
-- Found lmdb (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so)
-- Found LevelDB: /usr/include
-- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so)
-- Found Snappy: /usr/include
-- Found Snappy (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libsnappy.so)
-- CUDA detected: 8.0
-- Found cuDNN (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Added CUDA NVCC flags for: sm_61
-- OpenCV found (/home/toby/miniconda3/envs/caffe/share/OpenCV)
-- Found Atlas: /usr/include/x86_64-linux-gnu
-- Found Atlas (include: /usr/include/x86_64-linux-gnu, library: /usr/lib/x86_64-linux-gnu/libatlas.so)
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.14", minimum required is "2.7")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.14", minimum required is "2.7")
-- Found NumPy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (found suitable version "1.14.1", minimum required is "1.7.1")
-- NumPy ver. 1.14.1 found (include: /usr/local/lib/python2.7/dist-packages/numpy/core/include)
-- Boost version: 1.62.0
-- Found the following Boost libraries:
-- python
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Found Git: /usr/bin/git (found version "2.14.1")
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : <TODO> (Caffe doesn't declare its version in headers)
-- Git : ca5b3c1-dirty
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -std=c++11 -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -std=c++11 -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Build type : Release
--
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : OFF
--
-- Dependencies:
-- BLAS : Yes (Atlas)
-- Boost : Yes (ver. 1.62)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.0.0)
-- lmdb : Yes (ver. 0.9.21)
-- Snappy : Yes (ver. ..)
-- LevelDB : Yes (ver. 1.20)
-- OpenCV : Yes (ver. 3.4.2)
-- CUDA : Yes (ver. 8.0)
--
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_61
-- cuDNN : Yes
--
-- Python:
-- Interpreter : /usr/bin/python2.7 (ver. 2.7.14)
-- Libraries : /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.14)
-- NumPy : /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.14.1)
--
-- Documentaion:
-- Doxygen : No
-- config_file :
--
-- Install:
-- Install path : /home/toby/caffe-augmentation/install
--
-- Configuring done
CMake Warning at src/caffe/CMakeLists.txt:20 (add_library):
Cannot generate a safe runtime search path for target caffe because files
in some directories may conflict with libraries in implicit directories:
runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/toby/miniconda3/envs/caffe/lib
runtime library [libgflags.so.2.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/toby/miniconda3/envs/caffe/lib
runtime library [libleveldb.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/toby/miniconda3/envs/caffe/lib
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/toby/miniconda3/envs/caffe/lib
runtime library [libcudnn.so.7] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/toby/miniconda3/envs/caffe/lib
Some of these libraries may not be found correctly.
...many repetitions of the above snipped...
-- Generating done
-- Build files have been written to: /home/toby/caffe-augmentation
(caffe) toby@w8pc:~/caffe-augmentation$ make -j4 all
[ 0%] Building CXX object src/caffe/CMakeFiles/proto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
[ 1%] Linking CXX static library ../../lib/libproto.a
[ 2%] Built target proto
[ 2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_absval_layer.cu.o
[ 2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_concat_layer.cu.o
[ 4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_bnll_layer.cu.o
[ 4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_base_data_layer.cu.o
/home/toby/miniconda3/envs/caffe/include/gflags/gflags.h(226): warning: attribute "visibility" does not apply here
/home/toby/miniconda3/envs/caffe/include/gflags/gflags.h(226): warning: attribute "visibility" does not apply here
/home/toby/miniconda3/envs/caffe/include/gflags/gflags.h(226): warning: attribute "visibility" does not apply here
/home/toby/miniconda3/envs/caffe/include/gflags/gflags.h(226): warning: attribute "visibility" does not apply here
/home/toby/caffe-augmentation/include/caffe/common.hpp(80): error: namespace "std" has no member "isnan"
/home/toby/caffe-augmentation/include/caffe/common.hpp(81): error: namespace "std" has no member "isinf"
/home/toby/caffe-augmentation/include/caffe/common.hpp(80): error: namespace "std" has no member "isnan"
/home/toby/caffe-augmentation/include/caffe/common.hpp(81): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00005e6f_00000000-7_absval_layer.cpp1.ii".
/home/toby/caffe-augmentation/include/caffe/common.hpp(80): error: namespace "std" has no member "isnan"
/home/toby/caffe-augmentation/include/caffe/common.hpp(81): error: namespace "std" has no member "isinf"
CMake Error at cuda_compile_1_generated_absval_layer.cu.o.Release.cmake:282 (message):
Error generating file
/home/toby/caffe-augmentation/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/./cuda_compile_1_generated_absval_layer.cu.o
src/caffe/CMakeFiles/caffe.dir/build.make:63: recipe for target 'src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_absval_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_absval_layer.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/toby/caffe-augmentation/include/caffe/common.hpp(80): error: namespace "std" has no member "isnan"
/home/toby/caffe-augmentation/include/caffe/common.hpp(81): error: namespace "std" has no member "isinf"
2 errors detected in the compilation of "/tmp/tmpxft_00005e62_00000000-7_concat_layer.cpp1.ii".
CMake Error at cuda_compile_1_generated_concat_layer.cu.o.Release.cmake:282 (message):
Error generating file
/home/toby/caffe-augmentation/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/./cuda_compile_1_generated_concat_layer.cu.o
src/caffe/CMakeFiles/caffe.dir/build.make:84: recipe for target 'src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_concat_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_concat_layer.cu.o] Error 1
2 errors detected in the compilation of "/tmp/tmpxft_00005e63_00000000-7_bnll_layer.cpp1.ii".
CMake Error at cuda_compile_1_generated_bnll_layer.cu.o.Release.cmake:282 (message):
Error generating file
/home/toby/caffe-augmentation/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/./cuda_compile_1_generated_bnll_layer.cu.o
src/caffe/CMakeFiles/caffe.dir/build.make:77: recipe for target 'src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_bnll_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_bnll_layer.cu.o] Error 1
2 errors detected in the compilation of "/tmp/tmpxft_00005e76_00000000-7_base_data_layer.cpp1.ii".
CMake Error at cuda_compile_1_generated_base_data_layer.cu.o.Release.cmake:282 (message):
Error generating file
/home/toby/caffe-augmentation/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/./cuda_compile_1_generated_base_data_layer.cu.o
src/caffe/CMakeFiles/caffe.dir/build.make:70: recipe for target 'src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_base_data_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_base_data_layer.cu.o] Error 1
CMakeFiles/Makefile2:235: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.