Skip to content

Instantly share code, notes, and snippets.

@masouduut94
Last active October 14, 2024 07:40
Show Gist options
  • Save masouduut94/44c7faeb81d7d987f56eb17932b36b93 to your computer and use it in GitHub Desktop.
Save masouduut94/44c7faeb81d7d987f56eb17932b36b93 to your computer and use it in GitHub Desktop.
#ifndef OPENMP_EVALUATOR_H
#define OPENMP_EVALUATOR_H
#include <vector>
#include <string>
#include <tuple>
class BoundingBox {
public:
// Constructor
BoundingBox(int ann_id, int img_id, int cat_id, int x1, int y1, int w, int h);
double calculate_iou(const BoundingBox& other_box) const;
bool is_true_positive_or_false_positive(const std::vector<BoundingBox>& ground_truth_boxes, double iou_threshold = 0.5) const;
bool is_false_negative(const std::vector<BoundingBox>& predicted_boxes, double iou_threshold = 0.5) const;
int annotation_id;
int image_id;
int category_id;
int x1, y1, x2, y2;
};
class OpenmpEvaluator {
public:
// Constructor
OpenmpEvaluator(const std::string& ground_truth_json, const std::string& predictions_json);
std::tuple<std::vector<int>, std::vector<int>, std::vector<int>> evaluate();
private:
std::vector<BoundingBox> ground_truth_boxes;
std::vector<BoundingBox> predicted_boxes;
};
#endif // OPENMP_EVALUATOR_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment