4 #include <IceUtil/Time.h>
14 auto start = std::chrono::high_resolution_clock::now();
16 int num_instances = 0;
17 std::vector<armarx::aron::data::NDArrayPtr> images_snapshot;
18 std::vector<armarx::aron::data::FloatPtr> floats_snapshot;
19 std::vector<float> distances;
23 for(
auto key:
data->getAllKeys()){
26 auto d =
data->at(key);
27 ; img_desc =
data->at(key)->getDescriptor();
29 ARMARX_INFO <<
"Problem with accessing image description";
34 images_snapshot.insert(images_snapshot.end(), img_nd);
38 floats_snapshot.push_back(fl);
42 <<
"Only ndarray and float data types are supported for equality filters yet.";
47 if(images.size() < 2){
48 ARMARX_INFO <<
"Adding first images, because nothing to compare";
49 images.push_back(images_snapshot);
51 auto end = std::chrono::high_resolution_clock::now();
55 }
else if(images.size() < max_images){
56 ARMARX_INFO <<
"Not enough elements yet to do full comparison of last " << max_images
58 images.push_back(images_snapshot);
60 auto end = std::chrono::high_resolution_clock::now();
67 std::vector<armarx::aron::data::NDArrayPtr> lastCommittedImages;
68 int sizeOfCommited = 0;
69 for(
int i = 0; i < max_images; i++){
70 std::vector<armarx::aron::data::NDArrayPtr> lastCommitImages = images.at(images.size() - i - 1);
71 sizeOfCommited = lastCommitImages.size();
72 for(
int j = 0; j < lastCommitImages.size(); j++){
73 lastCommittedImages.push_back(lastCommitImages.at(j));
80 for(
int i= 0; i < images_snapshot.size(); i++){
82 std::vector<armarx::aron::data::NDArrayPtr> commited_images;
83 for(
int j = 0; j < max_images; j++){
85 auto image = lastCommittedImages.at(
index);
86 commited_images.emplace_back(image);
91 distances.insert(distances.end(),
distance);
95 float sum_distances = 0;
96 float max_distance = 0;
97 for(
auto d: distances){
108 accept = (max_distance > this->threshold);
110 accept = (sum_distances > this->threshold);
115 images.push_back(images_snapshot);
117 auto end = std::chrono::high_resolution_clock::now();
123 auto end = std::chrono::high_resolution_clock::now();
141 if(type_string ==
"MSE"){
145 }
else if (type_string ==
"MAE"){
149 }
else if (type_string ==
"Chernoff"){
153 }
else if (type_string ==
"Cosine"){
158 ARMARX_WARNING <<
"Undefined similarity measure detected in JSON file";
170 stats.
start_time = std::chrono::high_resolution_clock::now();