You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const String keys = "{help | | this demo will convert a set of images in a particular path into leveldb database for feature extraction using Caffe. If there little variance in data such as human faces, you can add a mean_file, otherwise it is not so useful}"
86
+
const String keys = "{help | | This sample will extract featrues from reference images and target image for classification. You can add a mean_file if there little variance in data such as human faces, otherwise it is not so useful}"
76
87
"{src_dir | ../data/images_all/ | Source direction of the images ready for being used for extract feature as gallery.}"
77
88
"{caffemodel | ../../testdata/cv/3d_triplet_iter_30000.caffemodel | caffe model for feature exrtaction.}"
78
89
"{network_forIMG | ../../testdata/cv/3d_triplet_testIMG.prototxt | Network definition file used for extracting feature from a single image and making a classification}"
79
90
"{mean_file | no | The mean file generated by Caffe from all gallery images, this could be used for mean value substraction from all images. If you want to use the mean file, you can set this as ../data/images_mean/triplet_mean.binaryproto.}"
80
91
"{target_img | ../data/images_all/1_8.png | Path of image waiting to be classified.}"
81
92
"{feature_blob | feat | Name of layer which will represent as the feature, in this network, ip1 or feat is well.}"
82
93
"{num_candidate | 15 | Number of candidates in gallery as the prediction result.}"
83
-
"{device | CPU | device}"
84
-
"{dev_id | 0 | dev_id}";
94
+
"{device | CPU | Device type: CPU or GPU}"
95
+
"{dev_id | 0 | Device id}";
96
+
97
+
/* get parameters from comand line */
85
98
cv::CommandLineParser parser(argc, argv, keys);
86
-
parser.about("Demo for object data classification and pose estimation");
99
+
parser.about("Feature extraction and classification");
87
100
if (parser.has("help"))
88
101
{
89
102
parser.printMessage();
@@ -99,13 +112,18 @@ int main(int argc, char** argv)
Copy file name to clipboardExpand all lines: modules/cnn_3dobj/samples/demo_sphereview_data.cpp
+29-20Lines changed: 29 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,11 @@
32
32
* POSSIBILITY OF SUCH DAMAGE.
33
33
*
34
34
*/
35
+
/**
36
+
* @file demo_sphereview_data.cpp
37
+
* @brief Generating training data for CNN with triplet loss.
38
+
* @author Yida Wang
39
+
*/
35
40
#defineHAVE_CAFFE
36
41
#include<opencv2/cnn_3dobj.hpp>
37
42
#include<opencv2/viz/vizcore.hpp>
@@ -44,14 +49,15 @@ int main(int argc, char *argv[])
44
49
{
45
50
const String keys = "{help | | demo :$ ./sphereview_test -ite_depth=2 -plymodel=../data/3Dmodel/ape.ply -imagedir=../data/images_all/ -labeldir=../data/label_all.txt -num_class=4 -label_class=0, then press 'q' to run the demo for images generation when you see the gray background and a coordinate.}"
46
51
"{ite_depth | 2 | Iteration of sphere generation.}"
47
-
"{plymodel | ../data/3Dmodel/ape.ply | path of the '.ply' file for image rendering. }"
48
-
"{imagedir | ../data/images_all/ | path of the generated images for one particular .ply model. }"
49
-
"{labeldir | ../data/label_all.txt | path of the generated images for one particular .ply model. }"
50
-
"{num_class | 4 | total number of classes of models}"
51
-
"{label_class | 0 | class label of current .ply model}"
52
-
"{rgb_use | 0 | use RGB image or grayscale}";
52
+
"{plymodel | ../data/3Dmodel/ape.ply | Path of the '.ply' file for image rendering. }"
53
+
"{imagedir | ../data/images_all/ | Path of the generated images for one particular .ply model. }"
54
+
"{labeldir | ../data/label_all.txt | Path of the generated images for one particular .ply model. }"
55
+
"{num_class | 4 | Total number of classes of models}"
56
+
"{label_class | 0 | Class label of current .ply model}"
57
+
"{rgb_use | 0 | Use RGB image or grayscale}";
58
+
/* Get parameters from comand line. */
53
59
cv::CommandLineParser parser(argc, argv, keys);
54
-
parser.about("Demo for Sphere View data generation");
60
+
parser.about("Generating training data for CNN with triplet loss");
55
61
if (parser.has("help"))
56
62
{
57
63
parser.printMessage();
@@ -70,23 +76,25 @@ int main(int argc, char *argv[])
70
76
char* p=(char*)labeldir.data();
71
77
imglabel.open(p, fstream::app|fstream::out);
72
78
bool camera_pov = (true);
73
-
/// Create a window
79
+
/* Create a window using viz. */
74
80
viz::Viz3d myWindow("Coordinate Frame");
81
+
/* Set window size as 64*64, we use this scale as default. */
0 commit comments