Skip to content

Instantly share code, notes, and snippets.

View WillieMaddox's full-sized avatar

Willie Maddox WillieMaddox

View GitHub Profile
/*
Passing variables / arrays between cython and cpp
Example from
http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html
Adapted to include passing of multidimensional arrays
*/
#include "Rectangle.h"
@WillieMaddox
WillieMaddox / k_means_anchor_points.py
Created April 13, 2017 13:15
create darknet anchor points using k-means. Uses fast numpy array ops: pascal ~= 1.0 s coco ~= 16 s
# -*- coding: utf-8 -*-
import numpy as np
import xml.etree.ElementTree as ET
from pycocotools.coco import COCO
def convert_coco_bbox(size, box):
dw = 1. / size[0]
dh = 1. / size[1]
x = box[0] + box[2] / 2.0