👨👩👦👦
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "openmp_evaluator.h" | |
#include <nlohmann/json.hpp> | |
#include <fstream> | |
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <cmath> | |
#include <omp.h> // For OpenMP | |
using json = nlohmann::json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef OPENMP_EVALUATOR_H | |
#define OPENMP_EVALUATOR_H | |
#include <vector> | |
#include <string> | |
#include <tuple> | |
class BoundingBox { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from setuptools import setup, Extension | |
import pybind11 | |
pybind11_include = pybind11.get_include() | |
parallel_cpp_evaluator = Extension( | |
'parallel_cpp_evaluator', | |
sources=['parallel_cpp_evaluator.cpp', 'parallel_cpp_evaluator_wrapper.cpp'], # Source files | |
include_dirs=[pybind11_include], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "parallel_cpp_evaluator.h" | |
#include <fstream> | |
#include <nlohmann/json.hpp> | |
using json = nlohmann::json; | |
double BoundingBox::calculate_iou(const BoundingBox& other) const { | |
int x1_inter = std::max(x1, other.x1); | |
int y1_inter = std::max(y1, other.y1); | |
int x2_inter = std::min(x2, other.x2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef EVALUATOR_H | |
#define EVALUATOR_H | |
#include <vector> | |
#include <mutex> | |
#include <thread> | |
#include <iostream> | |
#include <algorithm> | |
#include <nlohmann/json.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from setuptools import setup, Extension | |
import pybind11 | |
# Get the include path for pybind11 | |
pybind11_include = pybind11.get_include() | |
# Define the C++ extension module | |
cpp_evaluator = Extension( | |
'cpp_evaluator', # The name of the module that will be imported in Python | |
sources=['cpp_evaluator.cpp', 'cpp_evaluator_wrapper.cpp'], # Source files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pybind11/pybind11.h> | |
#include <pybind11/stl.h> | |
#include "cpp_evaluator.h" // Include your evaluator C++ module | |
namespace py = pybind11; | |
PYBIND11_MODULE(cpp_evaluator, m) { | |
py::class_<CppEvaluator>(m, "CppEvaluator") | |
.def(py::init<const std::string&, const std::string&>()) // Constructor binding | |
.def("evaluate", &CppEvaluator::evaluate); // Bind evaluate method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cpp_evaluator.h" // Include the header file | |
#include <fstream> | |
#include <nlohmann/json.hpp> // Assuming you're using nlohmann JSON library | |
using json = nlohmann::json; | |
// BoundingBox constructor | |
BoundingBox::BoundingBox(int annotation_id, int image_id, int category_id, int x1, int y1, int w, int h) | |
: annotation_id(annotation_id), image_id(image_id), category_id(category_id), x1(x1), y1(y1), w(w), h(h) { | |
x2 = x1 + w; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef EVALUATOR_H // Include guards to prevent double inclusion | |
#define EVALUATOR_H | |
#include <string> | |
#include <vector> | |
class BoundingBox { | |
public: | |
// Constructor | |
BoundingBox(int annotation_id, int image_id, int category_id, int x1, int y1, int w, int h); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ensure the script stops if any command fails | |
set -e | |
# Activate the Conda environment | |
source ~/anaconda3/etc/profile.d/conda.sh | |
conda activate py11 | |
# Build the Cython file |
NewerOlder