modify samples for feature storing option

pull/276/head
Wangyida 9 years ago
parent a81322a8bd
commit dd50d5bc93
  1. 19
      modules/cnn_3dobj/include/opencv2/cnn_3dobj.hpp
  2. 90
      modules/cnn_3dobj/samples/datagen.sh
  3. 90
      modules/cnn_3dobj/samples/datagen_all.sh
  4. 51
      modules/cnn_3dobj/samples/datagen_front.sh
  5. 113
      modules/cnn_3dobj/samples/demo_classify.cpp
  6. 20
      modules/cnn_3dobj/samples/demo_model_analysis.cpp
  7. 213
      modules/cnn_3dobj/samples/demo_sphereview_data.cpp
  8. 32
      modules/cnn_3dobj/samples/demo_video.cpp
  9. 1
      modules/cnn_3dobj/samples/featstore.sh
  10. 15
      modules/cnn_3dobj/src/cnn_feature.cpp
  11. 4
      modules/cnn_3dobj/src/cnn_sphereview.cpp
  12. 14
      modules/cnn_3dobj/test/test_cnn_3dobj_feature_extract.cpp

@ -72,7 +72,6 @@ the use of this software, even if advised of the possibility of such damage.
#include "opencv2/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc.hpp"
using std::string;
using caffe::Blob;
using caffe::Caffe;
using caffe::Datum;
@ -185,7 +184,7 @@ namespace cnn_3dobj
/** @brief Suit the position of bytes in 4 byte data structure for particular system.
*/
CV_WRAP static uint32_t swapEndian(uint32_t val);
CV_WRAP static int swapEndian(int val);
/** @brief Create header in binary files collecting the image data and label.
@param num_item Number of items.
@ -206,7 +205,7 @@ namespace cnn_3dobj
@param z Pose label of Z.
@param isrgb Option for choice of using RGB images or not.
*/
CV_WRAP static void writeBinaryfile(string filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb);
CV_WRAP static void writeBinaryfile(String filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb);
};
/** @brief Caffe based 3D images descriptor.
@ -223,13 +222,13 @@ namespace cnn_3dobj
bool net_set;
int net_ready;
cv::Mat mean_;
string deviceType;
String deviceType;
int deviceId;
/** @brief Load the mean file in binaryproto format if it is needed.
@param mean_file Path of mean file which stores the mean of training images, it is usually generated by Caffe tool.
*/
void setMean(const string& mean_file);
void setMean(const String& mean_file);
/** @brief Wrap the input layer of the network in separate cv::Mat objects(one per channel).
This way we save one memcpy operation and we don't need to rely on cudaMemcpy2D.
@ -246,11 +245,11 @@ namespace cnn_3dobj
@param device_type CPU or GPU.
@param device_id ID of GPU.
*/
descriptorExtractor(const string& device_type, int device_id = 0);
descriptorExtractor(const String& device_type, int device_id = 0);
/** @brief Get device type information for feature extraction.
*/
string getDeviceType();
String getDeviceType();
/** @brief Get device ID information for feature extraction.
*/
@ -260,7 +259,7 @@ namespace cnn_3dobj
Useful to change device without the need to reload the net.
@param device_type CPU or GPU.
*/
void setDeviceType(const string& device_type);
void setDeviceType(const String& device_type);
/** @brief Set device ID information for feature extraction.
Useful to change device without the need to reload the net. Only used for GPU.
@ -274,7 +273,7 @@ namespace cnn_3dobj
@param trained_file Path of prototxt which defining the structure of CNN.
@param mean_file Path of mean file(option).
*/
void loadNet(const string& model_file, const string& trained_file, const string& mean_file = "");
void loadNet(const String& model_file, const String& trained_file, const String& mean_file = "");
/** @brief Extract features from a single image or from a vector of images.
If loadNet was not called before, this method invocation will fail.
@ -282,7 +281,7 @@ namespace cnn_3dobj
@param feature Output features.
@param feature_blob Layer which the feature is extracted from.
*/
void extract(InputArrayOfArrays inputimg, OutputArray feature, std::string feature_blob);
void extract(InputArrayOfArrays inputimg, OutputArray feature, String feature_blob);
};
//! @}
}

@ -1,90 +0,0 @@
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/01.ply -label_class=1 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/02.ply -label_class=1 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/03.ply -label_class=1 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/04.ply -label_class=1 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/05.ply -label_class=1 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/06.ply -label_class=1 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/07.ply -label_class=1 -label_item=7
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/08.ply -label_class=1 -label_item=8
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/01.ply -label_class=2 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/02.ply -label_class=2 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/03.ply -label_class=2 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/04.ply -label_class=2 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/05.ply -label_class=2 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/06.ply -label_class=2 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/01.ply -label_class=3 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/02.ply -label_class=3 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/03.ply -label_class=3 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/04.ply -label_class=3 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/05.ply -label_class=3 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/06.ply -label_class=3 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/01.ply -label_class=4 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/02.ply -label_class=4 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/03.ply -label_class=4 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/04.ply -label_class=4 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/05.ply -label_class=4 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/06.ply -label_class=4 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/07.ply -label_class=4 -label_item=7
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/08.ply -label_class=4 -label_item=8
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/01.ply -label_class=5 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/02.ply -label_class=5 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/03.ply -label_class=5 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/04.ply -label_class=5 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/05.ply -label_class=5 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/06.ply -label_class=5 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/01.ply -label_class=6 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/02.ply -label_class=6 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/03.ply -label_class=6 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/04.ply -label_class=6 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/05.ply -label_class=6 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/06.ply -label_class=6 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/07.ply -label_class=6 -label_item=7
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/08.ply -label_class=6 -label_item=8
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/09.ply -label_class=6 -label_item=9
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/10.ply -label_class=6 -label_item=10
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/01.ply -label_class=7 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/02.ply -label_class=7 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/03.ply -label_class=7 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/04.ply -label_class=7 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/05.ply -label_class=7 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/06.ply -label_class=7 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/07.ply -label_class=7 -label_item=7
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/08.ply -label_class=7 -label_item=8
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/09.ply -label_class=7 -label_item=9
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/10.ply -label_class=7 -label_item=10
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/01.ply -label_class=8 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/02.ply -label_class=8 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/03.ply -label_class=8 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/04.ply -label_class=8 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/05.ply -label_class=8 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/06.ply -label_class=8 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/01.ply -label_class=9 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/02.ply -label_class=9 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/03.ply -label_class=9 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/04.ply -label_class=9 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/05.ply -label_class=9 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/01.ply -label_class=10 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/02.ply -label_class=10 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/03.ply -label_class=10 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/04.ply -label_class=10 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/05.ply -label_class=10 -label_item=5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/06.ply -label_class=10 -label_item=6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/01.ply -label_class=11 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/02.ply -label_class=11 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/03.ply -label_class=11 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/04.ply -label_class=11 -label_item=4
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/01.ply -label_class=12 -label_item=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/02.ply -label_class=12 -label_item=2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/03.ply -label_class=12 -label_item=3
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/04.ply -label_class=12 -label_item=4

@ -0,0 +1,90 @@
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/01.ply -label_class=1 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/02.ply -label_class=1 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/03.ply -label_class=1 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/04.ply -label_class=1 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/05.ply -label_class=1 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/06.ply -label_class=1 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/07.ply -label_class=1 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/08.ply -label_class=1 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/01.ply -label_class=2 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/02.ply -label_class=2 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/03.ply -label_class=2 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/04.ply -label_class=2 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/05.ply -label_class=2 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/06.ply -label_class=2 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/01.ply -label_class=3 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/02.ply -label_class=3 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/03.ply -label_class=3 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/04.ply -label_class=3 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/05.ply -label_class=3 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/06.ply -label_class=3 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/01.ply -label_class=4 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/02.ply -label_class=4 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/03.ply -label_class=4 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/04.ply -label_class=4 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/05.ply -label_class=4 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/06.ply -label_class=4 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/07.ply -label_class=4 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bottle/08.ply -label_class=4 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bottle_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/01.ply -label_class=5 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/02.ply -label_class=5 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/03.ply -label_class=5 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/04.ply -label_class=5 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/05.ply -label_class=5 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/06.ply -label_class=5 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/01.ply -label_class=6 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/02.ply -label_class=6 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/03.ply -label_class=6 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/04.ply -label_class=6 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/05.ply -label_class=6 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/06.ply -label_class=6 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/07.ply -label_class=6 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/08.ply -label_class=6 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/09.ply -label_class=6 -label_item=9 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/10.ply -label_class=6 -label_item=10 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/01.ply -label_class=7 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/02.ply -label_class=7 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/03.ply -label_class=7 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/04.ply -label_class=7 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/05.ply -label_class=7 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/06.ply -label_class=7 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/07.ply -label_class=7 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/08.ply -label_class=7 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/09.ply -label_class=7 -label_item=9 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/chair/10.ply -label_class=7 -label_item=10 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/chair_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/01.ply -label_class=8 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/02.ply -label_class=8 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/03.ply -label_class=8 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/04.ply -label_class=8 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/05.ply -label_class=8 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/diningtable/06.ply -label_class=8 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/diningtable_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/01.ply -label_class=9 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/02.ply -label_class=9 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/03.ply -label_class=9 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/04.ply -label_class=9 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/05.ply -label_class=9 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/01.ply -label_class=10 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/02.ply -label_class=10 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/03.ply -label_class=10 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/04.ply -label_class=10 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/05.ply -label_class=10 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/sofa/06.ply -label_class=10 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/sofa_pascal/ -z_range=0.6
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/01.ply -label_class=11 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/02.ply -label_class=11 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/03.ply -label_class=11 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/04.ply -label_class=11 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/01.ply -label_class=12 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/tvmonitor_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/02.ply -label_class=12 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/tvmonitor_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/03.ply -label_class=12 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/tvmonitor_pascal/ -z_range=0.5
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/tvmonitor/04.ply -label_class=12 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/tvmonitor_pascal/ -z_range=0.5

@ -0,0 +1,51 @@
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/01.ply -label_class=1 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/02.ply -label_class=1 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/03.ply -label_class=1 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/04.ply -label_class=1 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/05.ply -label_class=1 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/06.ply -label_class=1 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/07.ply -label_class=1 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/aeroplane/08.ply -label_class=1 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/aeroplane_pascal/ -semisphere=0 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/01.ply -label_class=2 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/02.ply -label_class=2 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/03.ply -label_class=2 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/04.ply -label_class=2 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/05.ply -label_class=2 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bicycle/06.ply -label_class=2 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bicycle_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/01.ply -label_class=3 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/02.ply -label_class=3 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/03.ply -label_class=3 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/04.ply -label_class=3 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/05.ply -label_class=3 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/boat/06.ply -label_class=3 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/boat_pascal/ -z_range=0.6 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/01.ply -label_class=5 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/02.ply -label_class=5 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/03.ply -label_class=5 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/04.ply -label_class=5 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/05.ply -label_class=5 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/bus/06.ply -label_class=5 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/bus_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/01.ply -label_class=6 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/02.ply -label_class=6 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/03.ply -label_class=6 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/04.ply -label_class=6 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/05.ply -label_class=6 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/06.ply -label_class=6 -label_item=6 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/07.ply -label_class=6 -label_item=7 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/08.ply -label_class=6 -label_item=8 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/09.ply -label_class=6 -label_item=9 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/car/10.ply -label_class=6 -label_item=10 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/car_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/01.ply -label_class=9 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/02.ply -label_class=9 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/03.ply -label_class=9 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/04.ply -label_class=9 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/motorbike/05.ply -label_class=9 -label_item=5 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/motorbike_pascal/ -z_range=0.5 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/01.ply -label_class=11 -label_item=1 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/02.ply -label_class=11 -label_item=2 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/03.ply -label_class=11 -label_item=3 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2 -front_view=1
./sphereview_test -plymodel=/Users/yidawang/Downloads/PASCAL3D+_release1.1/CAD/train/04.ply -label_class=11 -label_item=4 -bakgrdir=/Users/yidawang/Documents/database/backgrd_pascal/train_pascal/ -z_range=0.2 -front_view=1

@ -48,7 +48,7 @@ using namespace cv::cnn_3dobj;
* @function listDir
* @brief Making all files names under a directory into a list
*/
void listDir(const char *path, std::vector<string>& files, bool r)
void listDir(const char *path, std::vector<String>& files, bool r)
{
DIR *pDir;
struct dirent *ent;
@ -59,11 +59,11 @@ void listDir(const char *path, std::vector<string>& files, bool r)
{
if (ent->d_type & DT_DIR)
{
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0 || strcmp(ent->d_name, ".DS_Store") == 0)
{
continue;
}
if(r)
if (r)
{
sprintf(childpath, "%s/%s", path, ent->d_name);
listDir(childpath,files,false);
@ -71,18 +71,40 @@ void listDir(const char *path, std::vector<string>& files, bool r)
}
else
{
files.push_back(ent->d_name);
if (strcmp(ent->d_name, ".DS_Store") != 0)
files.push_back(ent->d_name);
}
}
sort(files.begin(),files.end());
};
/**
* @function featureWrite
* @brief Writing features of gallery images into binary files
*/
int featureWrite(const Mat &features, const String &fname)
{
ofstream ouF;
ouF.open(fname.c_str(), std::ofstream::binary);
if (!ouF)
{
cerr << "failed to open the file : " << fname << endl;
return 0;
}
for (int r = 0; r < features.rows; r++)
{
ouF.write(reinterpret_cast<const char*>(features.ptr(r)), features.cols*features.elemSize());
}
ouF.close();
return 1;
}
/**
* @function main
*/
int main(int argc, char** argv)
{
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}"
const String keys = "{help | | This sample will extract features 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}"
"{src_dir | ../data/images_all/ | Source direction of the images ready for being used for extract feature as gallery.}"
"{caffemodel | ../../testdata/cv/3d_triplet_iter_30000.caffemodel | caffe model for feature exrtaction.}"
"{network_forIMG | ../../testdata/cv/3d_triplet_testIMG.prototxt | Network definition file used for extracting feature from a single image and making a classification}"
@ -91,7 +113,8 @@ int main(int argc, char** argv)
"{feature_blob | feat | Name of layer which will represent as the feature, in this network, ip1 or feat is well.}"
"{num_candidate | 15 | Number of candidates in gallery as the prediction result.}"
"{device | CPU | Device type: CPU or GPU}"
"{dev_id | 0 | Device id}";
"{dev_id | 0 | Device id}"
"{gallery_out | 0 | Option on output binary features on gallery images}";
/* get parameters from comand line */
cv::CommandLineParser parser(argc, argv, keys);
parser.about("Feature extraction and classification");
@ -100,15 +123,16 @@ int main(int argc, char** argv)
parser.printMessage();
return 0;
}
string src_dir = parser.get<string>("src_dir");
string caffemodel = parser.get<string>("caffemodel");
string network_forIMG = parser.get<string>("network_forIMG");
string mean_file = parser.get<string>("mean_file");
string target_img = parser.get<string>("target_img");
string feature_blob = parser.get<string>("feature_blob");
String src_dir = parser.get<String>("src_dir");
String caffemodel = parser.get<String>("caffemodel");
String network_forIMG = parser.get<String>("network_forIMG");
String mean_file = parser.get<String>("mean_file");
String target_img = parser.get<String>("target_img");
String feature_blob = parser.get<String>("feature_blob");
int num_candidate = parser.get<int>("num_candidate");
string device = parser.get<string>("device");
String device = parser.get<String>("device");
int dev_id = parser.get<int>("dev_id");
int gallery_out = parser.get<int>("gallery_out");
/* Initialize a net work with Device */
cv::cnn_3dobj::descriptorExtractor descriptor(device);
std::cout << "Using" << descriptor.getDeviceType() << std::endl;
@ -117,9 +141,16 @@ int main(int argc, char** argv)
descriptor.loadNet(network_forIMG, caffemodel);
else
descriptor.loadNet(network_forIMG, caffemodel, mean_file);
std::vector<string> name_gallery;
std::vector<String> name_gallery;
/* List the file names under a given path */
listDir(src_dir.c_str(), name_gallery, false);
if (gallery_out)
{
ofstream namelist_out("gallelist.txt");
/* Writing name of the reference images. */
for (unsigned int i = 0; i < name_gallery.size(); i++)
namelist_out << name_gallery.at(i) << endl;
}
for (unsigned int i = 0; i < name_gallery.size(); i++)
{
name_gallery[i] = src_dir + name_gallery[i];
@ -128,31 +159,43 @@ int main(int argc, char** argv)
cv::Mat feature_reference;
for (unsigned int i = 0; i < name_gallery.size(); i++)
{
img_gallery.push_back(cv::imread(name_gallery[i], -1));
img_gallery.push_back(cv::imread(name_gallery[i]));
}
/* Extract feature from a set of images */
descriptor.extract(img_gallery, feature_reference, feature_blob);
std::cout << std::endl << "---------- Prediction for " << target_img << " ----------" << std::endl;
cv::Mat img = cv::imread(target_img, -1);
std::cout << std::endl << "---------- Features of gallery images ----------" << std::endl;
std::vector<std::pair<string, float> > prediction;
/* Print features of the reference images. */
for (unsigned int i = 0; i < feature_reference.rows; i++)
std::cout << feature_reference.row(i) << endl;
cv::Mat feature_test;
descriptor.extract(img, feature_test, feature_blob);
/* Initialize a matcher which using L2 distance. */
cv::BFMatcher matcher(NORM_L2);
std::vector<std::vector<cv::DMatch> > matches;
/* Have a KNN match on the target and reference images. */
matcher.knnMatch(feature_test, feature_reference, matches, num_candidate);
/* Print feature of the target image waiting to be classified. */
std::cout << std::endl << "---------- Features of target image: " << target_img << "----------" << endl << feature_test << std::endl;
/* Print the top N prediction. */
std::cout << std::endl << "---------- Prediction result(Distance - File Name in Gallery) ----------" << std::endl;
for (size_t i = 0; i < matches[0].size(); ++i)
if (gallery_out)
{
std::cout << std::endl << "---------- Features of gallery images ----------" << std::endl;
/* Print features of the reference images. */
for (unsigned int i = 0; i < feature_reference.rows; i++)
std::cout << feature_reference.row(i) << endl;
std::cout << std::endl << "---------- Saving features of gallery images into feature.bin ----------" << std::endl;
featureWrite(feature_reference, "feature.bin");
}
else
{
std::cout << i << " - " << std::fixed << std::setprecision(2) << name_gallery[matches[0][i].trainIdx] << " - \"" << matches[0][i].distance << "\"" << std::endl;
std::cout << std::endl << "---------- Prediction for " << target_img << " ----------" << std::endl;
cv::Mat img = cv::imread(target_img);
std::cout << std::endl << "---------- Features of gallery images ----------" << std::endl;
std::vector<std::pair<String, float> > prediction;
/* Print features of the reference images. */
for (unsigned int i = 0; i < feature_reference.rows; i++)
std::cout << feature_reference.row(i) << endl;
cv::Mat feature_test;
descriptor.extract(img, feature_test, feature_blob);
/* Initialize a matcher which using L2 distance. */
cv::BFMatcher matcher(NORM_L2);
std::vector<std::vector<cv::DMatch> > matches;
/* Have a KNN match on the target and reference images. */
matcher.knnMatch(feature_test, feature_reference, matches, num_candidate);
/* Print feature of the target image waiting to be classified. */
std::cout << std::endl << "---------- Features of target image: " << target_img << "----------" << endl << feature_test << std::endl;
/* Print the top N prediction. */
std::cout << std::endl << "---------- Prediction result(Distance - File Name in Gallery) ----------" << std::endl;
for (size_t i = 0; i < matches[0].size(); ++i)
{
std::cout << i << " - " << std::fixed << std::setprecision(2) << name_gallery[matches[0][i].trainIdx] << " - \"" << matches[0][i].distance << "\"" << std::endl;
}
}
return 0;
}

@ -64,18 +64,18 @@ int main(int argc, char** argv)
parser.printMessage();
return 0;
}
string caffemodel = parser.get<string>("caffemodel");
string network_forIMG = parser.get<string>("network_forIMG");
string mean_file = parser.get<string>("mean_file");
string target_img = parser.get<string>("target_img");
string ref_img1 = parser.get<string>("ref_img1");
string ref_img2 = parser.get<string>("ref_img2");
string ref_img3 = parser.get<string>("ref_img3");
string feature_blob = parser.get<string>("feature_blob");
string device = parser.get<string>("device");
String caffemodel = parser.get<String>("caffemodel");
String network_forIMG = parser.get<String>("network_forIMG");
String mean_file = parser.get<String>("mean_file");
String target_img = parser.get<String>("target_img");
String ref_img1 = parser.get<String>("ref_img1");
String ref_img2 = parser.get<String>("ref_img2");
String ref_img3 = parser.get<String>("ref_img3");
String feature_blob = parser.get<String>("feature_blob");
String device = parser.get<String>("device");
int dev_id = parser.get<int>("dev_id");
std::vector<string> ref_img;
std::vector<String> ref_img;
/* Sample which is most closest in pose to reference image
*and also the same class.
*/

@ -41,9 +41,45 @@
#include <opencv2/viz/vizcore.hpp>
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace cv;
using namespace std;
using namespace cv::cnn_3dobj;
/**
* @function listDir
* @brief Making all files names under a directory into a list
*/
void listDir(const char *path, std::vector<String>& files, bool r)
{
DIR *pDir;
struct dirent *ent;
char childpath[512];
pDir = opendir(path);
memset(childpath, 0, sizeof(childpath));
while ((ent = readdir(pDir)) != NULL)
{
if (ent->d_type & DT_DIR)
{
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0 || strcmp(ent->d_name, ".DS_Store") == 0)
{
continue;
}
if (r)
{
sprintf(childpath, "%s/%s", path, ent->d_name);
listDir(childpath,files,false);
}
}
else
{
if (strcmp(ent->d_name, ".DS_Store") != 0)
files.push_back(ent->d_name);
}
}
sort(files.begin(),files.end());
};
int main(int argc, char *argv[])
{
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=6 -label_class=0, then press 'q' to run the demo for images generation when you see the gray background and a coordinate.}"
@ -51,17 +87,20 @@ int main(int argc, char *argv[])
"{plymodel | ../data/3Dmodel/ape.ply | Path of the '.ply' file for image rendering. }"
"{imagedir | ../data/images_all/ | Path of the generated images for one particular .ply model. }"
"{labeldir | ../data/label_all.txt | Path of the generated images for one particular .ply model. }"
"{bakgrdir | | Path of the backgroud images sets. }"
"{cam_head_x | 0 | Head of the camera. }"
"{cam_head_y | 0 | Head of the camera. }"
"{cam_head_z | -1 | Head of the camera. }"
"{semisphere | 1 | Camera only has positions on half of the whole sphere. }"
"{z_range | 0.6 | Maximum camera position on z axis. }"
"{center_gen | 0 | Find center from all points. }"
"{image_size | 128 | Size of captured images. }"
"{label_class | 1 | Class label of current .ply model. }"
"{label_item | 1 | Item label of current .ply model. }"
"{label_class | | Class label of current .ply model. }"
"{label_item | | Item label of current .ply model. }"
"{rgb_use | 0 | Use RGB image or grayscale. }"
"{num_class | 6 | Total number of classes of models. }"
"{binary_out | 0 | Produce binaryfiles for images and label. }";
"{binary_out | 0 | Produce binaryfiles for images and label. }"
"{front_view | 0 | Take a special view of front angle}";
/* Get parameters from comand line. */
cv::CommandLineParser parser(argc, argv, keys);
parser.about("Generating training data for CNN with triplet loss");
@ -71,33 +110,78 @@ int main(int argc, char *argv[])
return 0;
}
int ite_depth = parser.get<int>("ite_depth");
string plymodel = parser.get<string>("plymodel");
string imagedir = parser.get<string>("imagedir");
string labeldir = parser.get<string>("labeldir");
String plymodel = parser.get<String>("plymodel");
String imagedir = parser.get<String>("imagedir");
string labeldir = parser.get<String>("labeldir");
String bakgrdir = parser.get<string>("bakgrdir");
int label_class = parser.get<int>("label_class");
int label_item = parser.get<int>("label_item");
float cam_head_x = parser.get<float>("cam_head_x");
float cam_head_y = parser.get<float>("cam_head_y");
float cam_head_z = parser.get<float>("cam_head_z");
int semisphere = parser.get<int>("semisphere");
float z_range = parser.get<float>("z_range");
int center_gen = parser.get<int>("center_gen");
int image_size = parser.get<int>("image_size");
int rgb_use = parser.get<int>("rgb_use");
int num_class = parser.get<int>("num_class");
int binary_out = parser.get<int>("binary_out");
int front_view = parser.get<int>("front_view");
double obj_dist, bg_dist, y_range;
if (front_view)
{
ite_depth = ite_depth + 1;
obj_dist = 240;
bg_dist = 700;
y_range = 0.85;
}
else
{
obj_dist = 370;
bg_dist = 400;
}
cv::cnn_3dobj::icoSphere ViewSphere(10,ite_depth);
std::vector<cv::Point3d> campos;
std::vector<cv::Point3d> campos_temp = ViewSphere.CameraPos;
if (semisphere)
{
for (int pose = 0; pose < (int)campos_temp.size(); pose++)
if (front_view)
{
for (int pose = 0; pose < static_cast<int>(campos_temp.size()); pose++)
{
if (campos_temp.at(pose).z >= 0 && campos_temp.at(pose).z < z_range && (campos_temp.at(pose).y < -y_range || campos_temp.at(pose).y > y_range))
campos.push_back(campos_temp.at(pose));
}
}
else
{
if (campos_temp.at(pose).z >= 0)
campos.push_back(campos_temp.at(pose));
for (int pose = 0; pose < static_cast<int>(campos_temp.size()); pose++)
{
if (campos_temp.at(pose).z >= 0 && campos_temp.at(pose).z < z_range)
campos.push_back(campos_temp.at(pose));
}
}
}
else
campos = campos_temp;
{
if (front_view)
{
obj_dist = 200;
for (int pose = 0; pose < static_cast<int>(campos_temp.size()); pose++)
{
if (campos_temp.at(pose).z < 0.2 && campos_temp.at(pose).z > -0.2 && (campos_temp.at(pose).y < -y_range || campos_temp.at(pose).y > y_range))
campos.push_back(campos_temp.at(pose));
}
}
else
{
for (int pose = 0; pose < static_cast<int>(campos_temp.size()); pose++)
{
if (campos_temp.at(pose).z < 0.2 && campos_temp.at(pose).z > -0.6)
campos.push_back(campos_temp.at(pose));
}
}
}
std::fstream imglabel;
char* p=(char*)labeldir.data();
imglabel.open(p, fstream::app|fstream::out);
@ -110,7 +194,7 @@ int main(int argc, char *argv[])
myWindow.setBackgroundColor(viz::Color::gray());
myWindow.spin();
/* Add light. */
myWindow.addLight(Vec3d(0,0,100000), Vec3d(0,0,0), viz::Color::white(), viz::Color::gray(), viz::Color::black(), viz::Color::white());
//myWindow.addLight(Vec3d(0,0,100000), Vec3d(0,0,0), viz::Color::white(), viz::Color::gray(), viz::Color::black(), viz::Color::white());
/* Create a Mesh widget, loading .ply models. */
viz::Mesh objmesh = viz::Mesh::load(plymodel);
/* Get the center of the generated mesh widget, cause some .ply files, this could be ignored if you are using PASCAL database*/
@ -123,7 +207,7 @@ int main(int argc, char *argv[])
const char* binaryPath = "../data/binary_";
if (binary_out)
{
ViewSphere.createHeader((int)campos.size(), image_size, image_size, headerPath);
ViewSphere.createHeader(static_cast<int>(campos.size()), image_size, image_size, headerPath);
}
float radius = ViewSphere.getRadius(objmesh.cloud, cam_focal_point);
objmesh.cloud = objmesh.cloud/radius*100;
@ -134,54 +218,73 @@ int main(int argc, char *argv[])
cam_y_dir.z = cam_head_z;
char* temp = new char;
char* bgname = new char;
/* Images will be saved as .png files. */
for(int pose = 0; pose < (int)campos.size(); pose++){
int label_x, label_y, label_z;
label_x = (int)(campos.at(pose).x*100);
label_y = (int)(campos.at(pose).y*100);
label_z = (int)(campos.at(pose).z*100);
sprintf (temp,"%02d_%02d_%04i_%04i_%04i", label_class, label_item, label_x, label_y, label_z);
string filename = temp;
filename += ".png";
imglabel << filename << ' ' << label_class << endl;
filename = imagedir + filename;
/* Get the pose of the camera using makeCameraPoses. */
Affine3f cam_pose = viz::makeCameraPose(campos.at(pose)*380+cam_focal_point, cam_focal_point, cam_y_dir*380+cam_focal_point);
/* Get the transformation matrix from camera coordinate system to global. */
Affine3f transform = viz::makeTransformToGlobal(Vec3f(1.0f,0.0f,0.0f), Vec3f(0.0f,1.0f,0.0f), Vec3f(0.0f,0.0f,1.0f), campos.at(pose));
viz::WMesh mesh_widget(objmesh);
/* Pose of the widget in camera frame. */
Affine3f cloud_pose = Affine3f().translate(Vec3f(1.0f,1.0f,1.0f));
/* Pose of the widget in global frame. */
Affine3f cloud_pose_global = transform * cloud_pose;
/* Visualize camera frame. */
if (!camera_pov)
std::vector<String> name_bkg;
if (bakgrdir.size() != 0)
{
/* List the file names under a given path */
listDir(bakgrdir.c_str(), name_bkg, false);
for (unsigned int i = 0; i < name_bkg.size(); i++)
{
viz::WCameraPosition cpw(1); // Coordinate axes
viz::WCameraPosition cpw_frustum(Vec2f(0.5, 0.5)); // Camera frustum
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
name_bkg.at(i) = bakgrdir + name_bkg.at(i);
}
}
/* Images will be saved as .png files. */
int cnt_img;
srand((int)time(0));
do
{
cnt_img = 0;
for(int pose = 0; pose < static_cast<int>(campos.size()); pose++){
int label_x, label_y, label_z;
label_x = static_cast<int>(campos.at(pose).x*100);
label_y = static_cast<int>(campos.at(pose).y*100);
label_z = static_cast<int>(campos.at(pose).z*100);
sprintf (temp,"%02i_%02i_%04i_%04i_%04i_%02i", label_class, label_item, label_x, label_y, label_z, static_cast<int>(obj_dist/100));
String filename = temp;
filename += ".png";
imglabel << filename << ' ' << label_class << endl;
filename = imagedir + filename;
/* Get the pose of the camera using makeCameraPoses. */
Affine3f cam_pose = viz::makeCameraPose(campos.at(pose)*obj_dist+cam_focal_point, cam_focal_point, cam_y_dir*obj_dist+cam_focal_point);
/* Get the transformation matrix from camera coordinate system to global. */
Affine3f transform = viz::makeTransformToGlobal(Vec3f(1.0f,0.0f,0.0f), Vec3f(0.0f,1.0f,0.0f), Vec3f(0.0f,0.0f,1.0f), campos.at(pose));
viz::WMesh mesh_widget(objmesh);
/* Pose of the widget in camera frame. */
Affine3f cloud_pose = Affine3f().translate(Vec3f(1.0f,1.0f,1.0f));
/* Pose of the widget in global frame. */
Affine3f cloud_pose_global = transform * cloud_pose;
/* Visualize camera frame. */
if (!camera_pov)
{
viz::WCameraPosition cpw(1); // Coordinate axes
viz::WCameraPosition cpw_frustum(Vec2f(0.5, 0.5)); // Camera frustum
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
}
/* Visualize widget. */
sprintf(bgname,"/Users/yidawang/Desktop/bg%i.jpg",pose%10+1);
cv::Mat img_bg = cv::imread(bgname);
cv::viz::WImage3D background_widget(img_bg, Size2d(image_size*4, image_size*4), Vec3d(-campos.at(pose)*380-cam_focal_point), Vec3d(campos.at(pose)*380+cam_focal_point), Vec3d(0,0,100));
// mesh_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("targetwidget", mesh_widget, cloud_pose_global);
myWindow.showWidget("bgwidget", background_widget, cloud_pose_global);
/* Visualize widget. */
if (bakgrdir.size() != 0)
{
cv::Mat img_bg = cv::imread(name_bkg.at(rand()%name_bkg.size()));
cv::viz::WImage3D background_widget(img_bg, Size2d(image_size*4, image_size*4), Vec3d(-campos.at(pose)*bg_dist-cam_focal_point), Vec3d(campos.at(pose)*bg_dist+cam_focal_point), Vec3d(0,0,-100));
myWindow.showWidget("bgwidget", background_widget, cloud_pose_global);
}
// mesh_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("targetwidget", mesh_widget, cloud_pose_global);
/* Set the viewer pose to that of camera. */
if (camera_pov)
myWindow.setViewerPose(cam_pose);
/* Save screen shot as images. */
myWindow.saveScreenshot(filename);
if (binary_out)
{
/* Write images into binary files for further using in CNN training. */
ViewSphere.writeBinaryfile(filename, binaryPath, headerPath,(int)campos.size()*num_class, label_class, (int)(campos.at(pose).x*100), (int)(campos.at(pose).y*100), (int)(campos.at(pose).z*100), rgb_use);
/* Set the viewer pose to that of camera. */
if (camera_pov)
myWindow.setViewerPose(cam_pose);
/* Save screen shot as images. */
myWindow.saveScreenshot(filename);
if (binary_out)
{
/* Write images into binary files for further using in CNN training. */
ViewSphere.writeBinaryfile(filename, binaryPath, headerPath,static_cast<int>(campos.size())*num_class, label_class, static_cast<int>(campos.at(pose).x*100), static_cast<int>(campos.at(pose).y*100), static_cast<int>(campos.at(pose).z*100), rgb_use);
}
cnt_img++;
}
}
} while (cnt_img != campos.size());
imglabel.close();
return 1;
};

@ -12,7 +12,7 @@ using namespace cv::cnn_3dobj;
* @function listDir
* @brief Making all files names under a directory into a list
*/
void listDir(const char *path, std::vector<string>& files, bool r)
void listDir(const char *path, std::vector<String>& files, bool r)
{
DIR *pDir;
struct dirent *ent;
@ -89,22 +89,22 @@ int main(int argc, char **argv)
parser.printMessage();
return 0;
}
string src_dir = parser.get<string>("src_dir");
string caffemodellist = parser.get<string>("caffemodellist");
string network_forIMG = parser.get<string>("network_forIMG");
string mean_file = parser.get<string>("mean_file");
string target_img1 = parser.get<string>("target_img1");
string target_img2 = parser.get<string>("target_img2");
string target_img3 = parser.get<string>("target_img3");
string target_img4 = parser.get<string>("target_img4");
string target_img5 = parser.get<string>("target_img5");
string target_img6 = parser.get<string>("target_img6");
string feature_blob = parser.get<string>("feature_blob");
String src_dir = parser.get<String>("src_dir");
String caffemodellist = parser.get<String>("caffemodellist");
String network_forIMG = parser.get<String>("network_forIMG");
String mean_file = parser.get<String>("mean_file");
String target_img1 = parser.get<String>("target_img1");
String target_img2 = parser.get<String>("target_img2");
String target_img3 = parser.get<String>("target_img3");
String target_img4 = parser.get<String>("target_img4");
String target_img5 = parser.get<String>("target_img5");
String target_img6 = parser.get<String>("target_img6");
String feature_blob = parser.get<String>("feature_blob");
int num_candidate = parser.get<int>("num_candidate");
string device = parser.get<string>("device");
String device = parser.get<String>("device");
int dev_id = parser.get<int>("dev_id");
ifstream namelist_model(caffemodellist.c_str(), ios::in);
vector<string> caffemodel;
vector<String> caffemodel;
char *buf = new char[512];
int number_model = 0;
while (!namelist_model.eof())
@ -114,7 +114,7 @@ int main(int argc, char **argv)
number_model++;
}
/* List the file names under a given path */
std::vector<string> name_gallery;
std::vector<String> name_gallery;
listDir(src_dir.c_str(), name_gallery, false);
for (unsigned int i = 0; i < name_gallery.size(); i++)
{
@ -229,7 +229,7 @@ int main(int argc, char **argv)
int count_pre, num_rotate, max_rotate;
String titlename, Hint, Pred("prediction: ");
vector<viz::WImageOverlay> imagepredict;
string widgename[24] = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"};
String widgename[24] = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"};
vector<Mat> slide;
slide.push_back(imread("1.png"));
slide.push_back(imread("2.png"));

@ -0,0 +1 @@
./classify_test --src_dir=/Users/yidawang/Downloads/PASCAL3D+_release1.1/ImageCollection/ --network_forIMG=/Users/yidawang/Documents/buildboat/caffe/examples/triplet/pascal_triplet.prototxt --caffemodel=/Users/yidawang/Documents/buildboat/caffe/examples/triplet/pascal_triplet_iter_10000.caffemodel --gallery_out=1

@ -1,12 +1,11 @@
#include "precomp.hpp"
using namespace caffe;
using std::string;
namespace cv
{
namespace cnn_3dobj
{
descriptorExtractor::descriptorExtractor(const string& device_type, int device_id)
descriptorExtractor::descriptorExtractor(const String& device_type, int device_id)
{
net_ready = 0;
if (strcmp(device_type.c_str(), "CPU") == 0 || strcmp(device_type.c_str(), "GPU") == 0)
@ -34,9 +33,9 @@ namespace cnn_3dobj
}
};
string descriptorExtractor::getDeviceType()
String descriptorExtractor::getDeviceType()
{
string device_info_out;
String device_info_out;
device_info_out = deviceType;
return device_info_out;
};
@ -48,7 +47,7 @@ namespace cnn_3dobj
return device_info_out;
};
void descriptorExtractor::setDeviceType(const string& device_type)
void descriptorExtractor::setDeviceType(const String& device_type)
{
if (strcmp(device_type.c_str(), "CPU") == 0 || strcmp(device_type.c_str(), "GPU") == 0)
{
@ -85,7 +84,7 @@ namespace cnn_3dobj
}
};
void descriptorExtractor::loadNet(const string& model_file, const string& trained_file, const string& mean_file)
void descriptorExtractor::loadNet(const String& model_file, const String& trained_file, const String& mean_file)
{
if (net_set)
{
@ -119,7 +118,7 @@ namespace cnn_3dobj
};
/* Load the mean file in binaryproto format. */
void descriptorExtractor::setMean(const string& mean_file)
void descriptorExtractor::setMean(const String& mean_file)
{
BlobProto blob_proto;
ReadProtoFromBinaryFileOrDie(mean_file.c_str(), &blob_proto);
@ -147,7 +146,7 @@ namespace cnn_3dobj
mean_ = cv::Mat(input_geometry, mean.type(), channel_mean);
};
void descriptorExtractor::extract(InputArrayOfArrays inputimg, OutputArray feature, std::string feature_blob)
void descriptorExtractor::extract(InputArrayOfArrays inputimg, OutputArray feature, String feature_blob)
{
if (net_ready)
{

@ -108,7 +108,7 @@ namespace cnn_3dobj
subdivide(v12, v23, v31, depth - 1);
};
uint32_t icoSphere::swapEndian(uint32_t val)
int icoSphere::swapEndian(int val)
{
val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
return (val << 16) | (val >> 16);
@ -175,7 +175,7 @@ namespace cnn_3dobj
headerLabel.close();
};
void icoSphere::writeBinaryfile(string filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb)
void icoSphere::writeBinaryfile(String filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb)
{
cv::Mat ImgforBin = cv::imread(filenameImg, isrgb);
char* A0 = (char*)malloc(1024);

@ -26,13 +26,13 @@ CV_CNN_Feature_Test::CV_CNN_Feature_Test()
*/
void CV_CNN_Feature_Test::run(int)
{
string caffemodel = std::string(ts->get_data_path()) + "3d_triplet_iter_30000.caffemodel";
string network_forIMG = cvtest::TS::ptr()->get_data_path() + "3d_triplet_testIMG.prototxt";
string mean_file = "no";
std::vector<string> ref_img;
string target_img = std::string(ts->get_data_path()) + "1_8.png";
string feature_blob = "feat";
string device = "CPU";
String caffemodel = String(ts->get_data_path()) + "3d_triplet_iter_30000.caffemodel";
String network_forIMG = cvtest::TS::ptr()->get_data_path() + "3d_triplet_testIMG.prototxt";
String mean_file = "no";
std::vector<String> ref_img;
String target_img = String(ts->get_data_path()) + "1_8.png";
String feature_blob = "feat";
String device = "CPU";
int dev_id = 0;
cv::Mat img_base = cv::imread(target_img, -1);

Loading…
Cancel
Save