Commit 5a05d91cb9e87d81732ab25da6811d053ea90b7c
1 parent
39f7a653
fixed memory aliasing bug and caffe verbose output
Showing
1 changed file
with
2 additions
and
1 deletions
openbr/plugins/classification/caffe.cpp
| ... | ... | @@ -45,6 +45,7 @@ private: |
| 45 | 45 | |
| 46 | 46 | CaffeNet *net = new CaffeNet(model, caffe::TEST); |
| 47 | 47 | net->CopyTrainedLayersFrom(weights.toStdString()); |
| 48 | + FLAGS_minloglevel = google::ERROR; // Disable Caffe's verbose output after loading the first model | |
| 48 | 49 | return net; |
| 49 | 50 | } |
| 50 | 51 | }; |
| ... | ... | @@ -104,7 +105,7 @@ protected: |
| 104 | 105 | |
| 105 | 106 | int dimFeatures = output->count() / dataLayer->batch_size(); |
| 106 | 107 | for (int n = 0; n < dataLayer->batch_size(); n++) |
| 107 | - dst += Mat(1, dimFeatures, CV_32FC1, output->mutable_cpu_data() + output->offset(n)); | |
| 108 | + dst += Mat(1, dimFeatures, CV_32FC1, output->mutable_cpu_data() + output->offset(n)).clone(); | |
| 108 | 109 | |
| 109 | 110 | caffeResource.release(net); |
| 110 | 111 | } | ... | ... |