Generated by Cython 0.15.1 on Tue Jan 31 14:40:06 2012
Raw output: model.c
1: import svm
/* "vision/model.pyx":1 * import svm #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import annotations * import features */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__svm), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__svm, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "vision/model.pyx":1 * import svm #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import annotations * import features */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2: import annotations
/* "vision/model.pyx":2 * import svm * import annotations #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import features * import random */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__annotations), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__annotations, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3: import features
/* "vision/model.pyx":3 * import svm * import annotations * import features #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import random * import logging */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__features), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__features, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4: import random
/* "vision/model.pyx":4 * import annotations * import features * import random #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import logging * import numpy */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__random), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5: import logging
/* "vision/model.pyx":5 * import features * import random * import logging #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import numpy * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6: import numpy
/* "vision/model.pyx":6 * import random * import logging * import numpy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * logger = logging.getLogger("vision.model") */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7:
8: logger = logging.getLogger("vision.model")
/* "vision/model.pyx":8 * import numpy * * logger = logging.getLogger("vision.model") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cimport numpy */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logger, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9:
10: cimport numpy
11: from vision cimport annotations
12:
13: class PathModel(object):
/* "vision/model.pyx":13 * from vision cimport annotations * * class PathModel(object): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * A model that learns a linear SVM weight vector based off a path. */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); /* "vision/model.pyx":13 * from vision cimport annotations * * class PathModel(object): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * A model that learns a linear SVM weight vector based off a path. */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_builtin_object); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object); __Pyx_GIVEREF(__pyx_builtin_object); if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_32))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PathModel, __pyx_kp_s_30); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PathModel, __pyx_t_3)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
14: """
15: A model that learns a linear SVM weight vector based off a path.
16:
17: The model extracts positve examples from the given path and negative
18: examples from sliding windows that do not overlap with a given example.
19: We extract both HOG features and RGB features.
20:
21: For fast scoring, use the corresponding convolution.pyx routine.
22: """
23:
24: def __init__(self, images, givens, dim = (40,40), hogbin = 8,
/* "vision/model.pyx":24 * """ * * def __init__(self, images, givens, dim = (40,40), hogbin = 8, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbbin = 8, bgskip = 2, bgsize = 5e4, c = 0.000001): * """ */ static PyObject *__pyx_pf_6vision_5model_9PathModel___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_5model_9PathModel___init__[] = "PathModel.__init__(self, images, givens, dim=(40, 40), hogbin=8, rgbbin=8, bgskip=2, bgsize=50000.0, c=1e-06)\n\n Constructs a path based model from the given path.\n "; static PyMethodDef __pyx_mdef_6vision_5model_9PathModel___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_6vision_5model_9PathModel___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6vision_5model_9PathModel___init__)}; static PyObject *__pyx_pf_6vision_5model_9PathModel___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_images = 0; PyObject *__pyx_v_givens = 0; PyObject *__pyx_v_dim = 0; PyObject *__pyx_v_hogbin = 0; PyObject *__pyx_v_rgbbin = 0; PyObject *__pyx_v_bgskip = 0; PyObject *__pyx_v_bgsize = 0; PyObject *__pyx_v_c = 0; PyObject *__pyx_v_positives = NULL; PyObject *__pyx_v_negatives = NULL; PyObject *__pyx_v_model = NULL; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__images,&__pyx_n_s__givens,&__pyx_n_s__dim,&__pyx_n_s__hogbin,&__pyx_n_s__rgbbin,&__pyx_n_s__bgskip,&__pyx_n_s__bgsize,&__pyx_n_s__c,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__"); __pyx_self = __pyx_self; { PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[3] = ((PyObject *)__pyx_k_tuple_1); values[4] = ((PyObject *)__pyx_int_8); values[5] = ((PyObject *)__pyx_int_8); values[6] = ((PyObject *)__pyx_int_2); values[7] = __pyx_k_2; values[8] = __pyx_k_3; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__images); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__givens); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogbin); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rgbbin); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgskip); if (value) { values[6] = value; kw_args--; } } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgsize); if (value) { values[7] = value; kw_args--; } } case 8: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c); if (value) { values[8] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_images = values[1]; __pyx_v_givens = values[2]; __pyx_v_dim = values[3]; __pyx_v_hogbin = values[4]; __pyx_v_rgbbin = values[5]; __pyx_v_bgskip = values[6]; __pyx_v_bgsize = values[7]; __pyx_v_c = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.model.PathModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "vision/model.pyx":24 * """ * * def __init__(self, images, givens, dim = (40,40), hogbin = 8, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbbin = 8, bgskip = 2, bgsize = 5e4, c = 0.000001): * """ */ __pyx_k_tuple_1 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); __Pyx_INCREF(__pyx_int_40); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_40); __Pyx_GIVEREF(__pyx_int_40); __Pyx_INCREF(__pyx_int_40); PyTuple_SET_ITEM(__pyx_k_tuple_1, 1, __pyx_int_40); __Pyx_GIVEREF(__pyx_int_40); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); /* "vision/model.pyx":24 * """ * * def __init__(self, images, givens, dim = (40,40), hogbin = 8, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbbin = 8, bgskip = 2, bgsize = 5e4, c = 0.000001): * """ */ __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_6vision_5model_9PathModel___init__, NULL, __pyx_kp_s_30); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25: rgbbin = 8, bgskip = 2, bgsize = 5e4, c = 0.000001):
/* "vision/model.pyx":25 * * def __init__(self, images, givens, dim = (40,40), hogbin = 8, * rgbbin = 8, bgskip = 2, bgsize = 5e4, c = 0.000001): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Constructs a path based model from the given path. */ __pyx_t_2 = PyFloat_FromDouble(5e4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_2 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(0.000001); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_3 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
26: """
27: Constructs a path based model from the given path.
28: """
29: self.dim = dim
/* "vision/model.pyx":29 * Constructs a path based model from the given path. * """ * self.dim = dim #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* self.hogbin = hogbin * self.rgbbin = rgbbin */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__dim, __pyx_v_dim)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30: self.hogbin = hogbin
/* "vision/model.pyx":30 * """ * self.dim = dim * self.hogbin = hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* self.rgbbin = rgbbin * self.c = c */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__hogbin, __pyx_v_hogbin)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31: self.rgbbin = rgbbin
/* "vision/model.pyx":31 * self.dim = dim * self.hogbin = hogbin * self.rgbbin = rgbbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* self.c = c * */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__rgbbin, __pyx_v_rgbbin)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32: self.c = c
/* "vision/model.pyx":32 * self.hogbin = hogbin * self.rgbbin = rgbbin * self.c = c #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * logger.info("Extracting features from path") */ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__c, __pyx_v_c)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33:
34: logger.info("Extracting features from path")
/* "vision/model.pyx":34 * self.c = c * * logger.info("Extracting features from path") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* positives, negatives = self.extractpath(images, givens, dim, * hogbin, rgbbin, bgskip, */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "vision/model.pyx":34 * self.c = c * * logger.info("Extracting features from path") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* positives, negatives = self.extractpath(images, givens, dim, * hogbin, rgbbin, bgskip, */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
35: positives, negatives = self.extractpath(images, givens, dim,
/* "vision/model.pyx":35 * * logger.info("Extracting features from path") * positives, negatives = self.extractpath(images, givens, dim, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogbin, rgbbin, bgskip, * bgsize) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__extractpath); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "vision/model.pyx":35 * * logger.info("Extracting features from path") * positives, negatives = self.extractpath(images, givens, dim, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogbin, rgbbin, bgskip, * bgsize) */ __pyx_v_positives = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_negatives = __pyx_t_1; __pyx_t_1 = 0;
36: hogbin, rgbbin, bgskip,
37: bgsize)
/* "vision/model.pyx":37 * positives, negatives = self.extractpath(images, givens, dim, * hogbin, rgbbin, bgskip, * bgsize) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # svm.sanity(positives, negatives) # uncomment when debugging */ __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_images); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_images); __Pyx_GIVEREF(__pyx_v_images); __Pyx_INCREF(__pyx_v_givens); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_givens); __Pyx_GIVEREF(__pyx_v_givens); __Pyx_INCREF(__pyx_v_dim); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_dim); __Pyx_GIVEREF(__pyx_v_dim); __Pyx_INCREF(__pyx_v_hogbin); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_hogbin); __Pyx_GIVEREF(__pyx_v_hogbin); __Pyx_INCREF(__pyx_v_rgbbin); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_rgbbin); __Pyx_GIVEREF(__pyx_v_rgbbin); __Pyx_INCREF(__pyx_v_bgskip); PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_bgskip); __Pyx_GIVEREF(__pyx_v_bgskip); __Pyx_INCREF(__pyx_v_bgsize); PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_bgsize); __Pyx_GIVEREF(__pyx_v_bgsize); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_1 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L7_unpacking_done; __pyx_L6_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L7_unpacking_done:; }
38:
39: # svm.sanity(positives, negatives) # uncomment when debugging
40:
41: logger.info("Learning weights for path with {0} foregrounds and "
/* "vision/model.pyx":41 * # svm.sanity(positives, negatives) # uncomment when debugging * * logger.info("Learning weights for path with {0} foregrounds and " #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* "{1} backgrounds".format(len(positives), len(negatives))) * svm.sanity(negatives, positives) */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
42: "{1} backgrounds".format(len(positives), len(negatives)))
/* "vision/model.pyx":42 * * logger.info("Learning weights for path with {0} foregrounds and " * "{1} backgrounds".format(len(positives), len(negatives))) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* svm.sanity(negatives, positives) * model = svm.train(negatives, positives, c = c) */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_Length(__pyx_v_positives); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PyObject_Length(__pyx_v_negatives); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
43: svm.sanity(negatives, positives)
/* "vision/model.pyx":43 * logger.info("Learning weights for path with {0} foregrounds and " * "{1} backgrounds".format(len(positives), len(negatives))) * svm.sanity(negatives, positives) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* model = svm.train(negatives, positives, c = c) * self.weights, self.bias = model.weights, model.bias */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__svm); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__sanity); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(__pyx_v_negatives); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_negatives); __Pyx_GIVEREF(__pyx_v_negatives); __Pyx_INCREF(__pyx_v_positives); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_positives); __Pyx_GIVEREF(__pyx_v_positives); __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
44: model = svm.train(negatives, positives, c = c)
/* "vision/model.pyx":44 * "{1} backgrounds".format(len(positives), len(negatives))) * svm.sanity(negatives, positives) * model = svm.train(negatives, positives, c = c) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* self.weights, self.bias = model.weights, model.bias * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__svm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__train); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_negatives); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_negatives); __Pyx_GIVEREF(__pyx_v_negatives); __Pyx_INCREF(__pyx_v_positives); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_positives); __Pyx_GIVEREF(__pyx_v_positives); __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__c), __pyx_v_c)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_v_model = __pyx_t_3; __pyx_t_3 = 0;
45: self.weights, self.bias = model.weights, model.bias
/* "vision/model.pyx":45 * svm.sanity(negatives, positives) * model = svm.train(negatives, positives, c = c) * self.weights, self.bias = model.weights, model.bias #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * logger.info("Weights learned with bias {0}".format(self.bias)) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_model, __pyx_n_s__weights); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyObject_GetAttr(__pyx_v_model, __pyx_n_s__bias); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__weights, __pyx_t_3)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__bias, __pyx_t_7)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
46:
47: logger.info("Weights learned with bias {0}".format(self.bias))
/* "vision/model.pyx":47 * self.weights, self.bias = model.weights, model.bias * * logger.info("Weights learned with bias {0}".format(self.bias)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def extractpath(self, images, givens, dim, */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__format); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bias); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("vision.model.PathModel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_positives); __Pyx_XDECREF(__pyx_v_negatives); __Pyx_XDECREF(__pyx_v_model); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
48:
49: def extractpath(self, images, givens, dim,
/* "vision/model.pyx":49 * logger.info("Weights learned with bias {0}".format(self.bias)) * * def extractpath(self, images, givens, dim, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* int hogbin, int rgbbin, int bgskip, int bgsize): * """ */ static PyObject *__pyx_pf_6vision_5model_9PathModel_1extractpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_5model_9PathModel_1extractpath[] = "PathModel.extractpath(self, images, givens, dim, int hogbin, int rgbbin, int bgskip, int bgsize)\n\n Extracts features from a path.\n "; static PyMethodDef __pyx_mdef_6vision_5model_9PathModel_1extractpath = {__Pyx_NAMESTR("extractpath"), (PyCFunction)__pyx_pf_6vision_5model_9PathModel_1extractpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6vision_5model_9PathModel_1extractpath)}; static PyObject *__pyx_pf_6vision_5model_9PathModel_1extractpath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_images = 0; PyObject *__pyx_v_givens = 0; PyObject *__pyx_v_dim = 0; int __pyx_v_hogbin; int __pyx_v_rgbbin; int __pyx_v_bgskip; int __pyx_v_bgsize; int __pyx_v_dimw; int __pyx_v_dimh; int __pyx_v_imw; int __pyx_v_imh; int __pyx_v_i; int __pyx_v_j; int __pyx_v_xtl; int __pyx_v_ytl; int __pyx_v_xbr; int __pyx_v_ybr; double __pyx_v_wr; double __pyx_v_hr; struct __pyx_obj_6vision_11annotations_Box *__pyx_v_given = 0; PyArrayObject *__pyx_v_hogim = 0; PyObject *__pyx_v_positives = NULL; PyObject *__pyx_v_negatives = NULL; PyObject *__pyx_v_negativesperframe = NULL; PyObject *__pyx_v_im = NULL; PyObject *__pyx_v_mapped = NULL; PyObject *__pyx_v_patch = NULL; PyObject *__pyx_v_hogpatch = NULL; PyObject *__pyx_v_rgbpatch = NULL; PyObject *__pyx_v_framenegatives = NULL; int __pyx_v_hogj; int __pyx_v_hogjs; int __pyx_v_hogi; int __pyx_v_hogis; PyObject *__pyx_v_rgbpatchregion = NULL; Py_buffer __pyx_bstruct_hogim; Py_ssize_t __pyx_bstride_0_hogim = 0; Py_ssize_t __pyx_bstride_1_hogim = 0; Py_ssize_t __pyx_bstride_2_hogim = 0; Py_ssize_t __pyx_bshape_0_hogim = 0; Py_ssize_t __pyx_bshape_1_hogim = 0; Py_ssize_t __pyx_bshape_2_hogim = 0; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__images,&__pyx_n_s__givens,&__pyx_n_s__dim,&__pyx_n_s__hogbin,&__pyx_n_s__rgbbin,&__pyx_n_s__bgskip,&__pyx_n_s__bgsize,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("extractpath"); __pyx_self = __pyx_self; { PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__images); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__givens); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogbin); if (likely(values[4])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rgbbin); if (likely(values[5])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgskip); if (likely(values[6])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgsize); if (likely(values[7])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "extractpath")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_self = values[0]; __pyx_v_images = values[1]; __pyx_v_givens = values[2]; __pyx_v_dim = values[3]; __pyx_v_hogbin = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_hogbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_rgbbin = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_rgbbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_bgskip = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_bgskip == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_bgsize = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_bgsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("extractpath", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.model.PathModel.extractpath", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_hogim.buf = NULL; /* "vision/model.pyx":49 * logger.info("Weights learned with bias {0}".format(self.bias)) * * def extractpath(self, images, givens, dim, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* int hogbin, int rgbbin, int bgskip, int bgsize): * """ */ __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_6vision_5model_9PathModel_1extractpath, NULL, __pyx_kp_s_30); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__extractpath, __pyx_t_2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
50: int hogbin, int rgbbin, int bgskip, int bgsize):
51: """
52: Extracts features from a path.
53: """
54: cdef int dimw = dim[0], dimh = dim[1]
/* "vision/model.pyx":54 * Extracts features from a path. * """ * cdef int dimw = dim[0], dimh = dim[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef int imw, imh * cdef int i, j, xtl, ytl, xbr, ybr */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dim, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_dimw = __pyx_t_2; __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dim, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_dimh = __pyx_t_2;
55: cdef int imw, imh
56: cdef int i, j, xtl, ytl, xbr, ybr
57: cdef double wr, hr
58: cdef annotations.Box given
59:
60: cdef numpy.ndarray[ndim=3, dtype=numpy.double_t] hogim
61:
62: positives = []
/* "vision/model.pyx":62 * cdef numpy.ndarray[ndim=3, dtype=numpy.double_t] hogim * * positives = [] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* negatives = [] * negativesperframe = int(bgsize / len(givens)) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_positives = __pyx_t_1; __pyx_t_1 = 0;
63: negatives = []
/* "vision/model.pyx":63 * * positives = [] * negatives = [] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* negativesperframe = int(bgsize / len(givens)) * for given in givens: */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_negatives = __pyx_t_1; __pyx_t_1 = 0;
64: negativesperframe = int(bgsize / len(givens))
/* "vision/model.pyx":64 * positives = [] * negatives = [] * negativesperframe = int(bgsize / len(givens)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for given in givens: * logger.debug("Extracting features from " */ __pyx_t_3 = PyObject_Length(__pyx_v_givens); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_bgsize / __pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_negativesperframe = __pyx_t_1; __pyx_t_1 = 0;
65: for given in givens:
/* "vision/model.pyx":65 * negatives = [] * negativesperframe = int(bgsize / len(givens)) * for given in givens: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* logger.debug("Extracting features from " * "frame {0}".format(given.frame)) */ if (PyList_CheckExact(__pyx_v_givens) || PyTuple_CheckExact(__pyx_v_givens)) { __pyx_t_1 = __pyx_v_givens; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_5 = NULL; } else { __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_givens); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { if (PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; } else if (PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; } else { __pyx_t_4 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_4); } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6vision_11annotations_Box))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_given)); __pyx_v_given = ((struct __pyx_obj_6vision_11annotations_Box *)__pyx_t_4); __pyx_t_4 = 0;
66: logger.debug("Extracting features from "
/* "vision/model.pyx":66 * negativesperframe = int(bgsize / len(givens)) * for given in givens: * logger.debug("Extracting features from " #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* "frame {0}".format(given.frame)) * wr = float(dim[0]) / given.width */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
67: "frame {0}".format(given.frame))
/* "vision/model.pyx":67 * for given in givens: * logger.debug("Extracting features from " * "frame {0}".format(given.frame)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* wr = float(dim[0]) / given.width * hr = float(dim[1]) / given.height */ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_8), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyInt_FromLong(__pyx_v_given->frame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
68: wr = float(dim[0]) / given.width
/* "vision/model.pyx":68 * logger.debug("Extracting features from " * "frame {0}".format(given.frame)) * wr = float(dim[0]) / given.width #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hr = float(dim[1]) / given.height * im = images[given.frame] */ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dim, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_given), __pyx_n_s__width); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_wr = __pyx_t_9;
69: hr = float(dim[1]) / given.height
/* "vision/model.pyx":69 * "frame {0}".format(given.frame)) * wr = float(dim[0]) / given.width * hr = float(dim[1]) / given.height #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* im = images[given.frame] * im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2) */ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_dim, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_t_6); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_given), __pyx_n_s__height); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_hr = __pyx_t_9;
70: im = images[given.frame]
/* "vision/model.pyx":70 * wr = float(dim[0]) / given.width * hr = float(dim[1]) / given.height * im = images[given.frame] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2) * imw, imh = im.size */ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_images, __pyx_v_given->frame, sizeof(int), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_v_im); __pyx_v_im = __pyx_t_7; __pyx_t_7 = 0;
71: im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2)
/* "vision/model.pyx":71 * hr = float(dim[1]) / given.height * im = images[given.frame] * im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* imw, imh = im.size * mapped = given.transform(wr, hr) */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__resize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyFloat_FromDouble(__pyx_v_wr); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyFloat_FromDouble(__pyx_v_hr); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_v_im); __pyx_v_im = __pyx_t_8; __pyx_t_8 = 0;
72: imw, imh = im.size
/* "vision/model.pyx":72 * im = images[given.frame] * im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2) * imw, imh = im.size #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* mapped = given.transform(wr, hr) * mapped.xbr = mapped.xtl + dim[0] */ __pyx_t_8 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { PyObject* sequence = __pyx_t_8; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_4); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_4), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L9_unpacking_done:; } __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_imw = __pyx_t_2; __pyx_v_imh = __pyx_t_12;
73: mapped = given.transform(wr, hr)
/* "vision/model.pyx":73 * im = im.resize((int(im.size[0]*wr), int(im.size[1]*hr)), 2) * imw, imh = im.size * mapped = given.transform(wr, hr) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* mapped.xbr = mapped.xtl + dim[0] * mapped.ybr = mapped.ytl + dim[1] */ __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_given), __pyx_n_s__transform); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyFloat_FromDouble(__pyx_v_wr); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = PyFloat_FromDouble(__pyx_v_hr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_v_mapped); __pyx_v_mapped = __pyx_t_10; __pyx_t_10 = 0;
74: mapped.xbr = mapped.xtl + dim[0]
/* "vision/model.pyx":74 * imw, imh = im.size * mapped = given.transform(wr, hr) * mapped.xbr = mapped.xtl + dim[0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* mapped.ybr = mapped.ytl + dim[1] * */ __pyx_t_10 = PyObject_GetAttr(__pyx_v_mapped, __pyx_n_s__xtl); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_dim, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Add(__pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_v_mapped, __pyx_n_s__xbr, __pyx_t_8)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
75: mapped.ybr = mapped.ytl + dim[1]
/* "vision/model.pyx":75 * mapped = given.transform(wr, hr) * mapped.xbr = mapped.xtl + dim[0] * mapped.ybr = mapped.ytl + dim[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # positives */ __pyx_t_8 = PyObject_GetAttr(__pyx_v_mapped, __pyx_n_s__ytl); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_dim, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = PyNumber_Add(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_v_mapped, __pyx_n_s__ybr, __pyx_t_10)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
76:
77: # positives
78: xtl, ytl, xbr, ybr = mapped[0:4]
/* "vision/model.pyx":78 * * # positives * xtl, ytl, xbr, ybr = mapped[0:4] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* patch = im.crop((xtl-hogbin*2, ytl-hogbin*2, * xbr+hogbin*2, ybr+hogbin*2)) */ __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_mapped, 0, 4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { PyObject* sequence = __pyx_t_10; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); } else { if (unlikely(PyList_GET_SIZE(sequence) != 4)) { if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); __pyx_t_7 = PyList_GET_ITEM(sequence, 2); __pyx_t_6 = PyList_GET_ITEM(sequence, 3); } __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else { Py_ssize_t index = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext; index = 0; __pyx_t_4 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_8)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 2; __pyx_t_7 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); index = 3; __pyx_t_6 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 4)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L11_unpacking_done; __pyx_L10_unpacking_failed:; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_xtl = __pyx_t_12; __pyx_v_ytl = __pyx_t_2; __pyx_v_xbr = __pyx_t_14; __pyx_v_ybr = __pyx_t_15;
79: patch = im.crop((xtl-hogbin*2, ytl-hogbin*2,
/* "vision/model.pyx":79 * # positives * xtl, ytl, xbr, ybr = mapped[0:4] * patch = im.crop((xtl-hogbin*2, ytl-hogbin*2, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* xbr+hogbin*2, ybr+hogbin*2)) * hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] */ __pyx_t_10 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__crop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_6 = PyInt_FromLong((__pyx_v_xtl - (__pyx_v_hogbin * 2))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyInt_FromLong((__pyx_v_ytl - (__pyx_v_hogbin * 2))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7);
80: xbr+hogbin*2, ybr+hogbin*2))
/* "vision/model.pyx":80 * xtl, ytl, xbr, ybr = mapped[0:4] * patch = im.crop((xtl-hogbin*2, ytl-hogbin*2, * xbr+hogbin*2, ybr+hogbin*2)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] * hogpatch = hogpatch.flatten() */ __pyx_t_8 = PyInt_FromLong((__pyx_v_xbr + (__pyx_v_hogbin * 2))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = PyInt_FromLong((__pyx_v_ybr + (__pyx_v_hogbin * 2))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_13)); __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_v_patch); __pyx_v_patch = __pyx_t_13; __pyx_t_13 = 0;
81: hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:]
/* "vision/model.pyx":81 * patch = im.crop((xtl-hogbin*2, ytl-hogbin*2, * xbr+hogbin*2, ybr+hogbin*2)) * hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogpatch = hogpatch.flatten() * patch = im.crop((xtl, ytl, xbr, ybr)) */ __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_4 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__hog); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __Pyx_INCREF(__pyx_v_patch); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_patch); __Pyx_GIVEREF(__pyx_v_patch); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; /* "vision/model.pyx":81 * patch = im.crop((xtl-hogbin*2, ytl-hogbin*2, * xbr+hogbin*2, ybr+hogbin*2)) * hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogpatch = hogpatch.flatten() * patch = im.crop((xtl, ytl, xbr, ybr)) */ __pyx_k_slice_9 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); __pyx_k_slice_10 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_11); __Pyx_GIVEREF(__pyx_k_slice_11); __pyx_t_10 = PyObject_GetItem(__pyx_t_13, ((PyObject *)__pyx_k_tuple_12)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_v_hogpatch); __pyx_v_hogpatch = __pyx_t_10; __pyx_t_10 = 0; __pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); __Pyx_INCREF(__pyx_k_slice_9); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); __Pyx_INCREF(__pyx_k_slice_10); PyTuple_SET_ITEM(__pyx_k_tuple_12, 1, __pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); __Pyx_INCREF(__pyx_k_slice_11); PyTuple_SET_ITEM(__pyx_k_tuple_12, 2, __pyx_k_slice_11); __Pyx_GIVEREF(__pyx_k_slice_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
82: hogpatch = hogpatch.flatten()
/* "vision/model.pyx":82 * xbr+hogbin*2, ybr+hogbin*2)) * hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] * hogpatch = hogpatch.flatten() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* patch = im.crop((xtl, ytl, xbr, ybr)) * rgbpatch = features.rgbmean(patch) */ __pyx_t_10 = PyObject_GetAttr(__pyx_v_hogpatch, __pyx_n_s__flatten); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_v_hogpatch); __pyx_v_hogpatch = __pyx_t_13; __pyx_t_13 = 0;
83: patch = im.crop((xtl, ytl, xbr, ybr))
/* "vision/model.pyx":83 * hogpatch = features.hog(patch, hogbin)[1:-1,1:-1,:] * hogpatch = hogpatch.flatten() * patch = im.crop((xtl, ytl, xbr, ybr)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbpatch = features.rgbmean(patch) * positives.append(numpy.append(hogpatch, rgbpatch)) */ __pyx_t_13 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__crop); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_10 = PyInt_FromLong(__pyx_v_xtl); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_4 = PyInt_FromLong(__pyx_v_ytl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyInt_FromLong(__pyx_v_xbr); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyInt_FromLong(__pyx_v_ybr); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_10 = 0; __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_patch); __pyx_v_patch = __pyx_t_6; __pyx_t_6 = 0;
84: rgbpatch = features.rgbmean(patch)
/* "vision/model.pyx":84 * hogpatch = hogpatch.flatten() * patch = im.crop((xtl, ytl, xbr, ybr)) * rgbpatch = features.rgbmean(patch) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* positives.append(numpy.append(hogpatch, rgbpatch)) * */ __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__rgbmean); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_patch); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_patch); __Pyx_GIVEREF(__pyx_v_patch); __pyx_t_13 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_rgbpatch); __pyx_v_rgbpatch = __pyx_t_13; __pyx_t_13 = 0;
85: positives.append(numpy.append(hogpatch, rgbpatch))
/* "vision/model.pyx":85 * patch = im.crop((xtl, ytl, xbr, ybr)) * rgbpatch = features.rgbmean(patch) * positives.append(numpy.append(hogpatch, rgbpatch)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # we shift the positives patch by a couple of pixels to have a */ if (unlikely(((PyObject *)__pyx_v_positives) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_6 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__append); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); __Pyx_INCREF(__pyx_v_hogpatch); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_hogpatch); __Pyx_GIVEREF(__pyx_v_hogpatch); __Pyx_INCREF(__pyx_v_rgbpatch); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_rgbpatch); __Pyx_GIVEREF(__pyx_v_rgbpatch); __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __pyx_t_16 = PyList_Append(__pyx_v_positives, __pyx_t_7); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
86:
87: # we shift the positives patch by a couple of pixels to have a
88: # larger training set
89: # xtl, ytl, xbr, ybr = mapped[0:4]
90: # for horzoffset in range(-hogbin+1, hogbin):
91: # for vertoffset in range(-hogbin+1, hogbin):
92: # patch = im.crop((xtl-hogbin+horzoffset,
93: # ytl-hogbin+vertoffset,
94: # xbr+hogbin+horzoffset,
95: # ybr+hogbin+vertoffset))
96: # hogpatch = features.hog(patch, hogbin)[1:-1,1:-1].flatten()
97: # rgbpatch = features.rgbhist(patch, self.rgbbin).flatten()
98: # positives.append(numpy.append(hogpatch, rgbpatch))
99:
100: logger.debug("Extracting negatives")
/* "vision/model.pyx":100 * # positives.append(numpy.append(hogpatch, rgbpatch)) * * logger.debug("Extracting negatives") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # negatives */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__debug); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "vision/model.pyx":100 * # positives.append(numpy.append(hogpatch, rgbpatch)) * * logger.debug("Extracting negatives") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # negatives */ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
101:
102: # negatives
103: hogim = features.hog(im, hogbin)
/* "vision/model.pyx":103 * * # negatives * hogim = features.hog(im, hogbin) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogim = features.hogpad(hogim) * framenegatives = [] */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__hog); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogim); __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hogim, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_15<
0)) { PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogim, (PyObject*)__pyx_v_hogim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20); } } __pyx_bstride_0_hogim = __pyx_bstruct_hogim.strides[0]; __pyx_bstride_1_hogim = __pyx_bstruct_hogim.strides[1]; __pyx_bstride_2_hogim = __pyx_bstruct_hogim.strides[2]; __pyx_bshape_0_hogim = __pyx_bstruct_hogim.shape[0]; __pyx_bshape_1_hogim = __pyx_bstruct_hogim.shape[1]; __pyx_bshape_2_hogim = __pyx_bstruct_hogim.shape[2]; if (unlikely(__pyx_t_15<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_hogim)); __pyx_v_hogim = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0;
104: hogim = features.hogpad(hogim)
/* "vision/model.pyx":104 * # negatives * hogim = features.hog(im, hogbin) * hogim = features.hogpad(hogim) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* framenegatives = [] * for i from 0<
= i<
imw-dimw by bgskip: */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__hogpad); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(((PyObject *)__pyx_v_hogim)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_hogim)); __Pyx_GIVEREF(((PyObject *)__pyx_v_hogim)); __pyx_t_13 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_13); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogim); __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hogim, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_15<
0)) { PyErr_Fetch(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogim, (PyObject*)__pyx_v_hogim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18); } } __pyx_bstride_0_hogim = __pyx_bstruct_hogim.strides[0]; __pyx_bstride_1_hogim = __pyx_bstruct_hogim.strides[1]; __pyx_bstride_2_hogim = __pyx_bstruct_hogim.strides[2]; __pyx_bshape_0_hogim = __pyx_bstruct_hogim.shape[0]; __pyx_bshape_1_hogim = __pyx_bstruct_hogim.shape[1]; __pyx_bshape_2_hogim = __pyx_bstruct_hogim.shape[2]; if (unlikely(__pyx_t_15<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_hogim)); __pyx_v_hogim = ((PyArrayObject *)__pyx_t_13); __pyx_t_13 = 0;
105: framenegatives = []
/* "vision/model.pyx":105 * hogim = features.hog(im, hogbin) * hogim = features.hogpad(hogim) * framenegatives = [] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for i from 0<
= i<
imw-dimw by bgskip: * for j from 0<
= j<
imh-dimh by bgskip: */ __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); __Pyx_XDECREF(__pyx_v_framenegatives); __pyx_v_framenegatives = ((PyObject *)__pyx_t_13); __pyx_t_13 = 0;
106: for i from 0 <= i < imw-dimw by bgskip:
/* "vision/model.pyx":106 * hogim = features.hogpad(hogim) * framenegatives = [] * for i from 0<
= i<
imw-dimw by bgskip: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for j from 0<
= j<
imh-dimh by bgskip: * if annotations.Box(i/wr, j/hr, (i + dimw)/wr, */ __pyx_t_15 = (__pyx_v_imw - __pyx_v_dimw); __pyx_t_14 = __pyx_v_bgskip; for (__pyx_v_i = 0; __pyx_v_i<
__pyx_t_15; __pyx_v_i+=__pyx_t_14) {
107: for j from 0 <= j < imh-dimh by bgskip:
/* "vision/model.pyx":107 * framenegatives = [] * for i from 0<
= i<
imw-dimw by bgskip: * for j from 0<
= j<
imh-dimh by bgskip: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if annotations.Box(i/wr, j/hr, (i + dimw)/wr, * (j + dimh)/hr).percentoverlap(given)<
0.5: */ __pyx_t_2 = (__pyx_v_imh - __pyx_v_dimh); __pyx_t_12 = __pyx_v_bgskip; for (__pyx_v_j = 0; __pyx_v_j<
__pyx_t_2; __pyx_v_j+=__pyx_t_12) {
108: if annotations.Box(i/wr, j/hr, (i + dimw)/wr,
/* "vision/model.pyx":108 * for i from 0<
= i<
imw-dimw by bgskip: * for j from 0<
= j<
imh-dimh by bgskip: * if annotations.Box(i/wr, j/hr, (i + dimw)/wr, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* (j + dimh)/hr).percentoverlap(given)<
0.5: * framenegatives.append((i, j)) */ __pyx_t_13 = PyFloat_FromDouble((__pyx_v_i / __pyx_v_wr)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_7 = PyFloat_FromDouble((__pyx_v_j / __pyx_v_hr)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_i + __pyx_v_dimw) / __pyx_v_wr)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6);
109: (j + dimh)/hr).percentoverlap(given) < 0.5:
/* "vision/model.pyx":109 * for j from 0<
= j<
imh-dimh by bgskip: * if annotations.Box(i/wr, j/hr, (i + dimw)/wr, * (j + dimh)/hr).percentoverlap(given)<
0.5: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* framenegatives.append((i, j)) * */ __pyx_t_8 = PyFloat_FromDouble(((__pyx_v_j + __pyx_v_dimh) / __pyx_v_hr)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_13 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6vision_11annotations_Box)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__percentoverlap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(((PyObject *)__pyx_v_given)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_given)); __Pyx_GIVEREF(((PyObject *)__pyx_v_given)); __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_21<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_21) {
110: framenegatives.append((i, j))
/* "vision/model.pyx":110 * if annotations.Box(i/wr, j/hr, (i + dimw)/wr, * (j + dimh)/hr).percentoverlap(given)<
0.5: * framenegatives.append((i, j)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * logger.debug("Sampling negatives") */ __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_framenegatives, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L16; } __pyx_L16:; } }
111:
112: logger.debug("Sampling negatives")
/* "vision/model.pyx":112 * framenegatives.append((i, j)) * * logger.debug("Sampling negatives") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if len(framenegatives) > negativesperframe: * framenegatives = random.sample(framenegatives, */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "vision/model.pyx":112 * framenegatives.append((i, j)) * * logger.debug("Sampling negatives") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if len(framenegatives) > negativesperframe: * framenegatives = random.sample(framenegatives, */ __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_15)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
113: if len(framenegatives) > negativesperframe:
/* "vision/model.pyx":113 * * logger.debug("Sampling negatives") * if len(framenegatives) > negativesperframe: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* framenegatives = random.sample(framenegatives, * negativesperframe) */ __pyx_t_22 = PyObject_Length(__pyx_v_framenegatives); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_v_negativesperframe, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_21<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_21) {
114: framenegatives = random.sample(framenegatives,
/* "vision/model.pyx":114 * logger.debug("Sampling negatives") * if len(framenegatives) > negativesperframe: * framenegatives = random.sample(framenegatives, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* negativesperframe) * */ __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sample); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
115: negativesperframe)
/* "vision/model.pyx":115 * if len(framenegatives) > negativesperframe: * framenegatives = random.sample(framenegatives, * negativesperframe) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for i, j in framenegatives: */ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_framenegatives); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_framenegatives); __Pyx_GIVEREF(__pyx_v_framenegatives); __Pyx_INCREF(__pyx_v_negativesperframe); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_negativesperframe); __Pyx_GIVEREF(__pyx_v_negativesperframe); __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_framenegatives); __pyx_v_framenegatives = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L17; } __pyx_L17:;
116:
117: for i, j in framenegatives:
/* "vision/model.pyx":117 * negativesperframe) * * for i, j in framenegatives: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogj = j/hogbin * hogjs = (j+dimh)/hogbin */ if (PyList_CheckExact(__pyx_v_framenegatives) || PyTuple_CheckExact(__pyx_v_framenegatives)) { __pyx_t_4 = __pyx_v_framenegatives; __Pyx_INCREF(__pyx_t_4); __pyx_t_22 = 0; __pyx_t_23 = NULL; } else { __pyx_t_22 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_framenegatives); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_23 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { if (PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_4)) break; __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_22); __Pyx_INCREF(__pyx_t_6); __pyx_t_22++; } else if (PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_4)) break; __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_22); __Pyx_INCREF(__pyx_t_6); __pyx_t_22++; } else { __pyx_t_6 = __pyx_t_23(__pyx_t_4); if (unlikely(!__pyx_t_6)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_6); } if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { PyObject* sequence = __pyx_t_6; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext; index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_8)) goto __pyx_L20_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L20_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L21_unpacking_done; __pyx_L20_unpacking_failed:; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L21_unpacking_done:; } __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_i = __pyx_t_14; __pyx_v_j = __pyx_t_15;
118: hogj = j/hogbin
/* "vision/model.pyx":118 * * for i, j in framenegatives: * hogj = j/hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogjs = (j+dimh)/hogbin * hogi = i/hogbin */ __pyx_v_hogj = (__pyx_v_j / __pyx_v_hogbin);
119: hogjs = (j+dimh)/hogbin
/* "vision/model.pyx":119 * for i, j in framenegatives: * hogj = j/hogbin * hogjs = (j+dimh)/hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogi = i/hogbin * hogis = (i+dimw)/hogbin */ __pyx_v_hogjs = ((__pyx_v_j + __pyx_v_dimh) / __pyx_v_hogbin);
120: hogi = i/hogbin
/* "vision/model.pyx":120 * hogj = j/hogbin * hogjs = (j+dimh)/hogbin * hogi = i/hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogis = (i+dimw)/hogbin * */ __pyx_v_hogi = (__pyx_v_i / __pyx_v_hogbin);
121: hogis = (i+dimw)/hogbin
/* "vision/model.pyx":121 * hogjs = (j+dimh)/hogbin * hogi = i/hogbin * hogis = (i+dimw)/hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * hogpatch = hogim[hogj:hogjs, hogi:hogis, :] */ __pyx_v_hogis = ((__pyx_v_i + __pyx_v_dimw) / __pyx_v_hogbin);
122:
123: hogpatch = hogim[hogj:hogjs, hogi:hogis, :]
/* "vision/model.pyx":123 * hogis = (i+dimw)/hogbin * * hogpatch = hogim[hogj:hogjs, hogi:hogis, :] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogpatch = hogpatch.flatten() * */ __pyx_t_6 = PyInt_FromLong(__pyx_v_hogj); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyInt_FromLong(__pyx_v_hogjs); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PySlice_New(__pyx_t_6, __pyx_t_7, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_hogi); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyInt_FromLong(__pyx_v_hogis); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_13 = PySlice_New(__pyx_t_7, __pyx_t_6, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __Pyx_INCREF(__pyx_k_slice_17); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); __pyx_t_8 = 0; __pyx_t_13 = 0; __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_hogim), ((PyObject *)__pyx_t_6)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_hogpatch); __pyx_v_hogpatch = __pyx_t_13; __pyx_t_13 = 0; /* "vision/model.pyx":123 * hogis = (i+dimw)/hogbin * * hogpatch = hogim[hogj:hogjs, hogi:hogis, :] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hogpatch = hogpatch.flatten() * */ __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17);
124: hogpatch = hogpatch.flatten()
/* "vision/model.pyx":124 * * hogpatch = hogim[hogj:hogjs, hogi:hogis, :] * hogpatch = hogpatch.flatten() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * rgbpatchregion = (i, j, i+dimw, j+dimh) */ __pyx_t_13 = PyObject_GetAttr(__pyx_v_hogpatch, __pyx_n_s__flatten); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_6 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_v_hogpatch); __pyx_v_hogpatch = __pyx_t_6; __pyx_t_6 = 0;
125:
126: rgbpatchregion = (i, j, i+dimw, j+dimh)
/* "vision/model.pyx":126 * hogpatch = hogpatch.flatten() * * rgbpatchregion = (i, j, i+dimw, j+dimh) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbpatch = features.rgbmean(im.crop(rgbpatchregion)) * rgbpatch = rgbpatch.flatten() */ __pyx_t_6 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_13 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_8 = PyInt_FromLong((__pyx_v_i + __pyx_v_dimw)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyInt_FromLong((__pyx_v_j + __pyx_v_dimh)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_rgbpatchregion)); __pyx_v_rgbpatchregion = __pyx_t_10; __pyx_t_10 = 0;
127: rgbpatch = features.rgbmean(im.crop(rgbpatchregion))
/* "vision/model.pyx":127 * * rgbpatchregion = (i, j, i+dimw, j+dimh) * rgbpatch = features.rgbmean(im.crop(rgbpatchregion)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* rgbpatch = rgbpatch.flatten() * */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_7 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__rgbmean); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__crop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(((PyObject *)__pyx_v_rgbpatchregion)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_rgbpatchregion)); __Pyx_GIVEREF(((PyObject *)__pyx_v_rgbpatchregion)); __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_rgbpatch); __pyx_v_rgbpatch = __pyx_t_13; __pyx_t_13 = 0;
128: rgbpatch = rgbpatch.flatten()
/* "vision/model.pyx":128 * rgbpatchregion = (i, j, i+dimw, j+dimh) * rgbpatch = features.rgbmean(im.crop(rgbpatchregion)) * rgbpatch = rgbpatch.flatten() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * negatives.append(numpy.append(hogpatch, rgbpatch)) */ __pyx_t_13 = PyObject_GetAttr(__pyx_v_rgbpatch, __pyx_n_s__flatten); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_8 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_v_rgbpatch); __pyx_v_rgbpatch = __pyx_t_8; __pyx_t_8 = 0;
129:
130: negatives.append(numpy.append(hogpatch, rgbpatch))
/* "vision/model.pyx":130 * rgbpatch = rgbpatch.flatten() * * negatives.append(numpy.append(hogpatch, rgbpatch)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return positives, negatives * */ if (unlikely(((PyObject *)__pyx_v_negatives) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_13 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__append); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_v_hogpatch); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_hogpatch); __Pyx_GIVEREF(__pyx_v_hogpatch); __Pyx_INCREF(__pyx_v_rgbpatch); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_rgbpatch); __Pyx_GIVEREF(__pyx_v_rgbpatch); __pyx_t_7 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_16 = PyList_Append(__pyx_v_negatives, __pyx_t_7); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
131: return positives, negatives
/* "vision/model.pyx":131 * * negatives.append(numpy.append(hogpatch, rgbpatch)) * return positives, negatives #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def hogweights(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_positives)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_positives)); __Pyx_GIVEREF(((PyObject *)__pyx_v_positives)); __Pyx_INCREF(((PyObject *)__pyx_v_negatives)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_negatives)); __Pyx_GIVEREF(((PyObject *)__pyx_v_negatives)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogim); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.model.PathModel.extractpath", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogim); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_given); __Pyx_XDECREF((PyObject *)__pyx_v_hogim); __Pyx_XDECREF(__pyx_v_positives); __Pyx_XDECREF(__pyx_v_negatives); __Pyx_XDECREF(__pyx_v_negativesperframe); __Pyx_XDECREF(__pyx_v_im); __Pyx_XDECREF(__pyx_v_mapped); __Pyx_XDECREF(__pyx_v_patch); __Pyx_XDECREF(__pyx_v_hogpatch); __Pyx_XDECREF(__pyx_v_rgbpatch); __Pyx_XDECREF(__pyx_v_framenegatives); __Pyx_XDECREF(__pyx_v_rgbpatchregion); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
132:
133: def hogweights(self):
/* "vision/model.pyx":133 * return positives, negatives * * def hogweights(self): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Returns the SVM weights just for the HOG features. */ static PyObject *__pyx_pf_6vision_5model_9PathModel_2hogweights(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6vision_5model_9PathModel_2hogweights[] = "PathModel.hogweights(self)\n\n Returns the SVM weights just for the HOG features.\n "; static PyMethodDef __pyx_mdef_6vision_5model_9PathModel_2hogweights = {__Pyx_NAMESTR("hogweights"), (PyCFunction)__pyx_pf_6vision_5model_9PathModel_2hogweights, METH_O, __Pyx_DOCSTR(__pyx_doc_6vision_5model_9PathModel_2hogweights)}; static PyObject *__pyx_pf_6vision_5model_9PathModel_2hogweights(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_v_x = NULL; PyObject *__pyx_v_y = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hogweights"); __pyx_self = __pyx_self; /* "vision/model.pyx":133 * return positives, negatives * * def hogweights(self): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Returns the SVM weights just for the HOG features. */ __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_6vision_5model_9PathModel_2hogweights, NULL, __pyx_kp_s_30); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__hogweights, __pyx_t_2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
134: """
135: Returns the SVM weights just for the HOG features.
136: """
137: x = self.dim[0]/self.hogbin
/* "vision/model.pyx":137 * Returns the SVM weights just for the HOG features. * """ * x = self.dim[0]/self.hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* y = self.dim[1]/self.hogbin * return self.weights[0:x*y*13].reshape((y, x, 13)) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__hogbin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_x = __pyx_t_3; __pyx_t_3 = 0;
138: y = self.dim[1]/self.hogbin
/* "vision/model.pyx":138 * """ * x = self.dim[0]/self.hogbin * y = self.dim[1]/self.hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return self.weights[0:x*y*13].reshape((y, x, 13)) * */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__hogbin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_y = __pyx_t_2; __pyx_t_2 = 0;
139: return self.weights[0:x*y*13].reshape((y, x, 13))
/* "vision/model.pyx":139 * x = self.dim[0]/self.hogbin * y = self.dim[1]/self.hogbin * return self.weights[0:x*y*13].reshape((y, x, 13)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def rgbweights(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__weights); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Multiply(__pyx_v_x, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_int_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_t_2, 0, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); __Pyx_INCREF(__pyx_int_13); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_13); __Pyx_GIVEREF(__pyx_int_13); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("vision.model.PathModel.hogweights", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_x); __Pyx_XDECREF(__pyx_v_y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
140:
141: def rgbweights(self):
/* "vision/model.pyx":141 * return self.weights[0:x*y*13].reshape((y, x, 13)) * * def rgbweights(self): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Returns the SVM weights just for the RGB features. */ static PyObject *__pyx_pf_6vision_5model_9PathModel_3rgbweights(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6vision_5model_9PathModel_3rgbweights[] = "PathModel.rgbweights(self)\n\n Returns the SVM weights just for the RGB features.\n "; static PyMethodDef __pyx_mdef_6vision_5model_9PathModel_3rgbweights = {__Pyx_NAMESTR("rgbweights"), (PyCFunction)__pyx_pf_6vision_5model_9PathModel_3rgbweights, METH_O, __Pyx_DOCSTR(__pyx_doc_6vision_5model_9PathModel_3rgbweights)}; static PyObject *__pyx_pf_6vision_5model_9PathModel_3rgbweights(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_v_x = NULL; PyObject *__pyx_v_y = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rgbweights"); __pyx_self = __pyx_self; /* "vision/model.pyx":141 * return self.weights[0:x*y*13].reshape((y, x, 13)) * * def rgbweights(self): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Returns the SVM weights just for the RGB features. */ __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_6vision_5model_9PathModel_3rgbweights, NULL, __pyx_kp_s_30); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__rgbweights, __pyx_t_2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
142: """
143: Returns the SVM weights just for the RGB features.
144: """
145: x = self.dim[0]/self.hogbin
/* "vision/model.pyx":145 * Returns the SVM weights just for the RGB features. * """ * x = self.dim[0]/self.hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* y = self.dim[1]/self.hogbin * return self.weights[x*y*13:] */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__hogbin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_x = __pyx_t_3; __pyx_t_3 = 0;
146: y = self.dim[1]/self.hogbin
/* "vision/model.pyx":146 * """ * x = self.dim[0]/self.hogbin * y = self.dim[1]/self.hogbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return self.weights[x*y*13:] */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__hogbin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_y = __pyx_t_2; __pyx_t_2 = 0;
147: return self.weights[x*y*13:]
/* "vision/model.pyx":147 * x = self.dim[0]/self.hogbin * y = self.dim[1]/self.hogbin * return self.weights[x*y*13:] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
*/ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__weights); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Multiply(__pyx_v_x, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_int_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_t_2, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("vision.model.PathModel.rgbweights", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_x); __Pyx_XDECREF(__pyx_v_y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }