summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKai Li <kaili_kloud@163.com>2014-06-17 16:27:24 +0800
committerKai Li <kaili_kloud@163.com>2014-06-24 22:12:44 +0800
commit4415f8c0453cd272fb2439711f74efd3f88aab1d (patch)
treeb72ee88091e91d24c19fa9f891aba27a2fcfe676 /tools
parentda0f89bbd495c604f63744374165cdc9f3cbba9f (diff)
downloadcaffeonacl-4415f8c0453cd272fb2439711f74efd3f88aab1d.tar.gz
caffeonacl-4415f8c0453cd272fb2439711f74efd3f88aab1d.tar.bz2
caffeonacl-4415f8c0453cd272fb2439711f74efd3f88aab1d.zip
Progress should be reported for each feature blob
Diffstat (limited to 'tools')
-rw-r--r--tools/extract_features.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/extract_features.cpp b/tools/extract_features.cpp
index 99eb0dbc..aa665a00 100644
--- a/tools/extract_features.cpp
+++ b/tools/extract_features.cpp
@@ -141,7 +141,7 @@ int feature_extraction_pipeline(int argc, char** argv) {
char key_str[kMaxKeyStrLength];
int num_bytes_of_binary_code = sizeof(Dtype);
vector<Blob<float>*> input_vec;
- int image_index = 0;
+ vector<int> image_indices(num_features, 0);
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) {
@@ -163,13 +163,13 @@ int feature_extraction_pipeline(int argc, char** argv) {
}
string value;
datum.SerializeToString(&value);
- snprintf(key_str, kMaxKeyStrLength, "%d", image_index);
+ snprintf(key_str, kMaxKeyStrLength, "%d", image_indices[i]);
feature_batches[i]->Put(string(key_str), value);
- ++image_index;
- if (image_index % 1000 == 0) {
+ ++image_indices[i];
+ if (image_indices[i] % 1000 == 0) {
feature_dbs[i]->Write(leveldb::WriteOptions(), feature_batches[i]);
- LOG(ERROR)<< "Extracted features of " << image_index <<
- " query images.";
+ LOG(ERROR)<< "Extracted features of " << image_indices[i] <<
+ " query images for feature blob " << blob_names[i];
delete feature_batches[i];
feature_batches[i] = new leveldb::WriteBatch();
}
@@ -177,12 +177,12 @@ int feature_extraction_pipeline(int argc, char** argv) {
} // for (int i = 0; i < num_features; ++i)
} // for (int batch_index = 0; batch_index < num_mini_batches; ++batch_index)
// write the last batch
- if (image_index % 1000 != 0) {
- for (int i = 0; i < num_features; ++i) {
+ for (int i = 0; i < num_features; ++i) {
+ if (image_indices[i] % 1000 != 0) {
feature_dbs[i]->Write(leveldb::WriteOptions(), feature_batches[i]);
}
- LOG(ERROR)<< "Extracted features of " << image_index <<
- " query images.";
+ LOG(ERROR)<< "Extracted features of " << image_indices[i] <<
+ " query images for feature blob " << blob_names[i];
}
for (int i = 0; i < num_features; ++i) {