Skip to content

Instantly share code, notes, and snippets.

View masouduut94's full-sized avatar
👨‍👩‍👦‍👦
Family comes before Work.

Masoud Masoumi Moghadam masouduut94

👨‍👩‍👦‍👦
Family comes before Work.
View GitHub Profile
#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;
#ifndef OPENMP_EVALUATOR_H
#define OPENMP_EVALUATOR_H
#include <vector>
#include <string>
#include <tuple>
class BoundingBox {
public:
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],
#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);
#ifndef EVALUATOR_H
#define EVALUATOR_H
#include <vector>
#include <mutex>
#include <thread>
#include <iostream>
#include <algorithm>
#include <nlohmann/json.hpp>
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
#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
#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;
#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);
@masouduut94
masouduut94 / compile.sh
Created October 12, 2024 22:55
bash script to set up the so modules.
#!/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