Skip to content

Commit 9852e80

Browse files
committed
add libs hint on OS X in for cmake
1 parent 97d49a8 commit 9852e80

40 files changed

+105951
-215
lines changed

modules/README.md.orig

Lines changed: 0 additions & 59 deletions
This file was deleted.

modules/cnn_3dobj/CMakeLists.txt

100644100755
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ else()
88
message(STATUS "Caffe: NO")
99
endif()
1010

11+
find_package(Protobuf)
12+
if(Protobuf_FOUND)
13+
message(STATUS "Protobuf: YES")
14+
set(HAVE_PROTOBUF 1)
15+
else()
16+
message(STATUS "Protobuf: NO")
17+
endif()
18+
19+
find_package(Glog)
20+
if(Glog_FOUND)
21+
message(STATUS "Glog: YES")
22+
set(HAVE_GLOG 1)
23+
else()
24+
message(STATUS "Glog: NO")
25+
endif()
26+
1127
if(HAVE_CAFFE)
1228
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cnn_3dobj_config.hpp.in
1329
${CMAKE_CURRENT_SOURCE_DIR}/include/opencv2/cnn_3dobj_config.hpp @ONLY)
@@ -21,6 +37,6 @@ endif()
2137
ocv_define_module(cnn_3dobj opencv_core opencv_imgproc opencv_viz opencv_highgui OPTIONAL WRAP python)
2238

2339
if(${Caffe_FOUND})
24-
target_link_libraries(opencv_cnn_3dobj ${Caffe_LIBS})
40+
target_link_libraries(opencv_cnn_3dobj ${Caffe_LIBS} ${Glog_LIBS} ${Protobuf_LIBS})
2541
endif()
2642
endif()

modules/cnn_3dobj/FindCaffe.cmake

100644100755
File mode changed.

modules/cnn_3dobj/FindGlog.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Glog package for CNN Triplet training
2+
unset(Glog_FOUND)
3+
4+
find_library(Glog_LIBS NAMES glog
5+
HINTS
6+
/usr/local/lib)
7+
8+
if(Glog_LIBS)
9+
set(Glog_FOUND 1)
10+
endif()

modules/cnn_3dobj/FindProtobuf.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Protobuf package for CNN Triplet training
2+
unset(Protobuf_FOUND)
3+
4+
find_library(Protobuf_LIBS NAMES protobuf
5+
HINTS
6+
/usr/local/lib)
7+
8+
if(Protobuf_LIBS)
9+
set(Protobuf_FOUND 1)
10+
endif()

modules/cnn_3dobj/README.md

100644100755
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $ sudo make install
3030
$ cd <opencv_source_directory>
3131
$ mkdir build
3232
$ cd build
33-
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=OFF -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON -D INSTALL_TESTS=ON -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules ..
33+
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=OFF -D WITH_V4L=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D WITH_VTK=ON -D INSTALL_TESTS=ON -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules ..
3434
$ make -j4
3535
$ sudo make install
3636
```
@@ -56,22 +56,24 @@ $ make
5656
##Demo1: training data generation
5757
####Imagas generation from different pose, by default there are 4 models used, there will be 276 images in all which each class contains 69 iamges, if you want to use additional .ply models, it is necessary to change the class number parameter to the new class number and also give it a new class label. If you will train net work and extract feature from RGB images set the parameter rgb_use as 1.
5858
```
59-
$ ./sphereview_test -plymodel=../data/3Dmodel/ape.ply -label_class=0
59+
$ ./sphereview_test -plymodel=../data/3Dmodel/ape.ply -label_class=0 -cam_head_x=0 -cam_head_y=0 -cam_head_z=1
6060
```
6161
####press 'Q' to start 2D image genaration
6262
```
63-
$ ./sphereview_test -plymodel=../data/3Dmodel/ant.ply -label_class=1
63+
$ ./sphereview_test -plymodel=../data/3Dmodel/ant.ply -label_class=1 -cam_head_x=0 -cam_head_y=-1 -cam_head_z=0
6464
```
65-
####press 'Q' to start
6665
```
67-
$ ./sphereview_test -plymodel=../data/3Dmodel/cow.ply -label_class=2
66+
$ ./sphereview_test -plymodel=../data/3Dmodel/cow.ply -label_class=2 -cam_head_x=0 -cam_head_y=-1 -cam_head_z=0
6867
```
69-
####press 'Q' to start
7068
```
71-
$ ./sphereview_test -plymodel=../data/3Dmodel/plane.ply -label_class=3
69+
$ ./sphereview_test -plymodel=../data/3Dmodel/plane.ply -label_class=3 -cam_head_x=0 -cam_head_y=-1 -cam_head_z=0
70+
```
71+
```
72+
$ ./sphereview_test -plymodel=../data/3Dmodel/bunny.ply -label_class=4 -cam_head_x=0 -cam_head_y=-1 -cam_head_z=0
73+
```
74+
```
75+
$ ./sphereview_test -plymodel=../data/3Dmodel/horse.ply -label_class=5 -cam_head_x=0 -cam_head_y=0 -cam_head_z=-1
7276
```
73-
####press 'Q' to start
74-
7577
####When all images are created in images_all folder as a collection of training images for network tranining and as a gallery of reference images for the classification part, then proceed on.
7678
####After this demo, the binary files of images and labels will be stored as 'binary_image' and 'binary_label' in current path, you should copy them into the leveldb folder in Caffe triplet training, for example: copy these 2 files in <caffe_source_directory>/data/linemod and rename them as 'binary_image_train', 'binary_image_test' and 'binary_label_train', 'binary_label_train'. Here I use the same as trianing and testing data, you can use different data for training and testing the performance in the CAFFE training process. It's important to observe the loss of testing data to check whether training data is suitable for the your aim. Loss should be obseved as keep decreasing and remain on a much smaller number than the initial loss.
7779
####You could start triplet tranining using Caffe like this:

modules/cnn_3dobj/cnn_3dobj_config.hpp.in

100644100755
File mode changed.

modules/cnn_3dobj/doc/cnn_3dobj.bib

100644100755
File mode changed.

modules/cnn_3dobj/include/opencv2/cnn_3dobj.hpp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ the use of this software, even if advised of the possibility of such damage.
5555
#include <set>
5656
#include <string.h>
5757
#include <stdlib.h>
58-
#include <tr1/memory>
5958
#include <dirent.h>
6059
#define CPU_ONLY
6160

61+
#include <opencv2/cnn_3dobj_config.hpp>
6262
#ifdef HAVE_CAFFE
6363
#include <caffe/blob.hpp>
6464
#include <caffe/common.hpp>

modules/cnn_3dobj/include/opencv2/cnn_3dobj_config.hpp

100644100755
File mode changed.

0 commit comments

Comments
 (0)