diff options
author | T.E.A de Souza <tea.desouza@gmail.com> | 2015-11-29 14:24:09 +0800 |
---|---|---|
committer | Tea <tea.desouza@gmail.com> | 2015-12-04 13:59:55 +0800 |
commit | 99571c471d493c650c53be1416bb26d5b984f178 (patch) | |
tree | 04c23a408d89f4feb921277c7fe0ead2890cc725 /tools | |
parent | 7e40583db034fc292de3a3a09ea08a2861dd288c (diff) | |
download | caffeonacl-99571c471d493c650c53be1416bb26d5b984f178.tar.gz caffeonacl-99571c471d493c650c53be1416bb26d5b984f178.tar.bz2 caffeonacl-99571c471d493c650c53be1416bb26d5b984f178.zip |
Correct type of device_id; disambiguate shared_ptr
Diffstat (limited to 'tools')
-rw-r--r-- | tools/extract_features.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/extract_features.cpp b/tools/extract_features.cpp index 1ef13266..d6562f98 100644 --- a/tools/extract_features.cpp +++ b/tools/extract_features.cpp @@ -16,7 +16,6 @@ using caffe::Blob; using caffe::Caffe; using caffe::Datum; using caffe::Net; -using boost::shared_ptr; using std::string; namespace db = caffe::db; @@ -51,7 +50,7 @@ int feature_extraction_pipeline(int argc, char** argv) { arg_pos = num_required_args; if (argc > arg_pos && strcmp(argv[arg_pos], "GPU") == 0) { LOG(ERROR)<< "Using GPU"; - uint device_id = 0; + int device_id = 0; if (argc > arg_pos + 1) { device_id = atoi(argv[arg_pos + 1]); CHECK_GE(device_id, 0); @@ -95,7 +94,7 @@ int feature_extraction_pipeline(int argc, char** argv) { } */ std::string feature_extraction_proto(argv[++arg_pos]); - shared_ptr<Net<Dtype> > feature_extraction_net( + boost::shared_ptr<Net<Dtype> > feature_extraction_net( new Net<Dtype>(feature_extraction_proto, caffe::TEST)); feature_extraction_net->CopyTrainedLayersFrom(pretrained_binary_proto); @@ -119,15 +118,15 @@ int feature_extraction_pipeline(int argc, char** argv) { int num_mini_batches = atoi(argv[++arg_pos]); - std::vector<shared_ptr<db::DB> > feature_dbs; - std::vector<shared_ptr<db::Transaction> > txns; + std::vector<boost::shared_ptr<db::DB> > feature_dbs; + std::vector<boost::shared_ptr<db::Transaction> > txns; const char* db_type = argv[++arg_pos]; for (size_t i = 0; i < num_features; ++i) { LOG(INFO)<< "Opening dataset " << dataset_names[i]; - shared_ptr<db::DB> db(db::GetDB(db_type)); + boost::shared_ptr<db::DB> db(db::GetDB(db_type)); db->Open(dataset_names.at(i), db::NEW); feature_dbs.push_back(db); - shared_ptr<db::Transaction> txn(db->NewTransaction()); + boost::shared_ptr<db::Transaction> txn(db->NewTransaction()); txns.push_back(txn); } @@ -139,8 +138,8 @@ int feature_extraction_pipeline(int argc, char** argv) { for (int batch_index = 0; batch_index < num_mini_batches; ++batch_index) { feature_extraction_net->Forward(input_vec); for (int i = 0; i < num_features; ++i) { - const shared_ptr<Blob<Dtype> > feature_blob = feature_extraction_net - ->blob_by_name(blob_names[i]); + const boost::shared_ptr<Blob<Dtype> > feature_blob = + feature_extraction_net->blob_by_name(blob_names[i]); int batch_size = feature_blob->num(); int dim_features = feature_blob->count() / batch_size; const Dtype* feature_blob_data; |