Generated by Cython 0.15.1 on Tue Jan 31 14:40:12 2012
Raw output: linear.c
1: import math, logging, multiprocessing, numpy
/* "vision/alearn/linear.pyx":1 * import math, logging, multiprocessing, numpy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* from vision import annotations, convolution, model * from vision.track import interpolation */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__math), 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__math, __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; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 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__logging, __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; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__multiprocessing), 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__multiprocessing, __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; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 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__numpy, __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/alearn/linear.pyx":1 * import math, logging, multiprocessing, numpy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* from vision import annotations, convolution, model * from vision.track import interpolation */ __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: from vision import annotations, convolution, model
/* "vision/alearn/linear.pyx":2 * import math, logging, multiprocessing, numpy * from vision import annotations, convolution, model #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* from vision.track import interpolation * */ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__annotations)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__annotations)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__annotations)); __Pyx_INCREF(((PyObject *)__pyx_n_s__convolution)); PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__convolution)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__convolution)); __Pyx_INCREF(((PyObject *)__pyx_n_s__model)); PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__model)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__model)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__vision), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__annotations); 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; __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__convolution); 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__convolution, __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; __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__model); 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__model, __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; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3: from vision.track import interpolation
/* "vision/alearn/linear.pyx":3 * import math, logging, multiprocessing, numpy * from vision import annotations, convolution, model * from vision.track import interpolation #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cimport numpy */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__interpolation)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__interpolation)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__interpolation)); __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_41), ((PyObject *)__pyx_t_2), -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); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__interpolation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__interpolation, __pyx_t_2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4:
5: cimport numpy
6: from vision cimport annotations
7:
8: cdef extern from "math.h":
9: float exp(float n)
10:
11: log = logging.getLogger("vision.track.alearn")
/* "vision/alearn/linear.pyx":11 * float exp(float n) * * log = logging.getLogger("vision.track.alearn") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def pick(images, path, dim = (40, 40), errortube = 100, */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __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 = 11; __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_43), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __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__log, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12:
13: def pick(images, path, dim = (40, 40), errortube = 100,
/* "vision/alearn/linear.pyx":13 * log = logging.getLogger("vision.track.alearn") * * def pick(images, path, dim = (40, 40), errortube = 100, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* double sigma = 0.1, bgskip = 4, bgsize = 5e4, * skip = 1, plot = False, pool = None): */ static PyObject *__pyx_pf_6vision_6alearn_6linear_pick(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_6alearn_6linear_pick[] = "pick(images, path, dim=(40, 40), errortube=100, double sigma=0.1, bgskip=4, bgsize=50000.0, skip=1, plot=False, pool=None)\n\n Given a path, picks the most informative frame that we currently lack.\n "; static PyMethodDef __pyx_mdef_6vision_6alearn_6linear_pick = {__Pyx_NAMESTR("pick"), (PyCFunction)__pyx_pf_6vision_6alearn_6linear_pick, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6vision_6alearn_6linear_pick)}; static PyObject *__pyx_pf_6vision_6alearn_6linear_pick(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_images = 0; PyObject *__pyx_v_path = 0; PyObject *__pyx_v_dim = 0; PyObject *__pyx_v_errortube = 0; double __pyx_v_sigma; PyObject *__pyx_v_bgskip = 0; PyObject *__pyx_v_bgsize = 0; PyObject *__pyx_v_skip = 0; PyObject *__pyx_v_plot = 0; PyObject *__pyx_v_pool = 0; PyObject *__pyx_v_svm = NULL; PyObject *__pyx_v_scores = NULL; PyObject *__pyx_v_prev = NULL; PyObject *__pyx_v_cur = NULL; PyObject *__pyx_v_lpath = NULL; PyObject *__pyx_v_workorders = NULL; PyObject *__pyx_v_workorder = NULL; PyObject *__pyx_v_best = NULL; PyObject *__pyx_v_plt = NULL; PyObject *__pyx_v_x = NULL; long __pyx_v_y; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__images,&__pyx_n_s__path,&__pyx_n_s__dim,&__pyx_n_s__errortube,&__pyx_n_s__sigma,&__pyx_n_s__bgskip,&__pyx_n_s__bgsize,&__pyx_n_s__skip,&__pyx_n_s__plot,&__pyx_n_s__pool,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pick"); __pyx_self = __pyx_self; { PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_k_tuple_1); values[3] = ((PyObject *)__pyx_int_100); values[5] = ((PyObject *)__pyx_int_4); values[6] = __pyx_k_2; values[7] = ((PyObject *)__pyx_int_1); values[8] = __pyx_k_3; /* "vision/alearn/linear.pyx":13 * log = logging.getLogger("vision.track.alearn") * * def pick(images, path, dim = (40, 40), errortube = 100, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* double sigma = 0.1, bgskip = 4, bgsize = 5e4, * skip = 1, plot = False, pool = None): */ __pyx_k_tuple_1 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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/alearn/linear.pyx":13 * log = logging.getLogger("vision.track.alearn") * * def pick(images, path, dim = (40, 40), errortube = 100, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* double sigma = 0.1, bgskip = 4, bgsize = 5e4, * skip = 1, plot = False, pool = None): */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6vision_6alearn_6linear_pick, NULL, __pyx_n_s_44); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pick, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14: double sigma = 0.1, bgskip = 4, bgsize = 5e4,
/* "vision/alearn/linear.pyx":14 * * def pick(images, path, dim = (40, 40), errortube = 100, * double sigma = 0.1, bgskip = 4, bgsize = 5e4, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* skip = 1, plot = False, pool = None): * """ */ __pyx_v_sigma = ((double)0.1); } __pyx_v_bgskip = values[5]; __pyx_v_bgsize = values[6]; __pyx_v_skip = values[7]; __pyx_v_plot = values[8]; __pyx_v_pool = values[9]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("pick", 0, 2, 10, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.alearn.linear.pick", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "vision/alearn/linear.pyx":14 * * def pick(images, path, dim = (40, 40), errortube = 100, * double sigma = 0.1, bgskip = 4, bgsize = 5e4, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* skip = 1, plot = False, pool = None): * """ */ __pyx_t_1 = PyFloat_FromDouble(5e4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_2 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
15: skip = 1, plot = False, pool = None):
/* "vision/alearn/linear.pyx":15 * def pick(images, path, dim = (40, 40), errortube = 100, * double sigma = 0.1, bgskip = 4, bgsize = 5e4, * skip = 1, plot = False, pool = None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Given a path, picks the most informative frame that we currently lack. */ values[9] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); 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__images); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("pick", 0, 2, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errortube); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgskip); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bgsize); if (value) { values[6] = value; kw_args--; } } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__skip); if (value) { values[7] = value; kw_args--; } } case 8: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__plot); if (value) { values[8] = value; kw_args--; } } case 9: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pool); if (value) { values[9] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pick")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); 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); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_images = values[0]; __pyx_v_path = values[1]; __pyx_v_dim = values[2]; __pyx_v_errortube = values[3]; if (values[4]) { __pyx_v_sigma = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_sigma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "vision/alearn/linear.pyx":15 * def pick(images, path, dim = (40, 40), errortube = 100, * double sigma = 0.1, bgskip = 4, bgsize = 5e4, * skip = 1, plot = False, pool = None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Given a path, picks the most informative frame that we currently lack. */ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_3 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
16: """
17: Given a path, picks the most informative frame that we currently lack.
18: """
19: log.info("Picking most informative frame through active learning")
/* "vision/alearn/linear.pyx":19 * Given a path, picks the most informative frame that we currently lack. * """ * log.info("Picking most informative frame through active learning") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* svm = model.PathModel(images, path, dim = dim, * bgskip = bgskip, bgsize = bgsize) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 19; __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 = 19; __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/alearn/linear.pyx":19 * Given a path, picks the most informative frame that we currently lack. * """ * log.info("Picking most informative frame through active learning") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* svm = model.PathModel(images, path, dim = dim, * bgskip = bgskip, bgsize = bgsize) */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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));
20: svm = model.PathModel(images, path, dim = dim,
/* "vision/alearn/linear.pyx":20 * """ * log.info("Picking most informative frame through active learning") * svm = model.PathModel(images, path, dim = dim, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* bgskip = bgskip, bgsize = bgsize) * scores = [] */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__model); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__PathModel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_images); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_images); __Pyx_GIVEREF(__pyx_v_images); __Pyx_INCREF(__pyx_v_path); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_path); __Pyx_GIVEREF(__pyx_v_path); __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dim), __pyx_v_dim)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21: bgskip = bgskip, bgsize = bgsize)
/* "vision/alearn/linear.pyx":21 * log.info("Picking most informative frame through active learning") * svm = model.PathModel(images, path, dim = dim, * bgskip = bgskip, bgsize = bgsize) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* scores = [] * */ if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__bgskip), __pyx_v_bgskip)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__bgsize), __pyx_v_bgsize)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_svm = __pyx_t_4; __pyx_t_4 = 0;
22: scores = []
/* "vision/alearn/linear.pyx":22 * svm = model.PathModel(images, path, dim = dim, * bgskip = bgskip, bgsize = bgsize) * scores = [] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * log.info("Scoring frames") */ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_v_scores = __pyx_t_4; __pyx_t_4 = 0;
23:
24: log.info("Scoring frames")
/* "vision/alearn/linear.pyx":24 * scores = [] * * log.info("Scoring frames") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for prev, cur in zip(path, path[1:]): * lpath = interpolation.Linear(prev, cur)[1:-1:skip] */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "vision/alearn/linear.pyx":24 * scores = [] * * log.info("Scoring frames") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for prev, cur in zip(path, path[1:]): * lpath = interpolation.Linear(prev, cur)[1:-1:skip] */ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
25: for prev, cur in zip(path, path[1:]):
/* "vision/alearn/linear.pyx":25 * * log.info("Scoring frames") * for prev, cur in zip(path, path[1:]): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lpath = interpolation.Linear(prev, cur)[1:-1:skip] * workorders = [(x, images, svm, prev, cur, */ __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_path, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_path); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_path); __Pyx_GIVEREF(__pyx_v_path); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { if (PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; } else if (PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; } else { __pyx_t_4 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_4); } if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { PyObject* sequence = __pyx_t_4; 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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = 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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L9_unpacking_done:; } __Pyx_XDECREF(__pyx_v_prev); __pyx_v_prev = __pyx_t_1; __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_cur); __pyx_v_cur = __pyx_t_2; __pyx_t_2 = 0;
26: lpath = interpolation.Linear(prev, cur)[1:-1:skip]
/* "vision/alearn/linear.pyx":26 * log.info("Scoring frames") * for prev, cur in zip(path, path[1:]): * lpath = interpolation.Linear(prev, cur)[1:-1:skip] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* workorders = [(x, images, svm, prev, cur, * dim, errortube, sigma, plot) for x in lpath] */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__interpolation); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Linear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(__pyx_v_prev); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_prev); __Pyx_GIVEREF(__pyx_v_prev); __Pyx_INCREF(__pyx_v_cur); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_cur); __Pyx_GIVEREF(__pyx_v_cur); __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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_4)); __pyx_t_4 = 0; __pyx_t_4 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, __pyx_v_skip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_t_4); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_v_lpath); __pyx_v_lpath = __pyx_t_2; __pyx_t_2 = 0;
27: workorders = [(x, images, svm, prev, cur,
/* "vision/alearn/linear.pyx":27 * for prev, cur in zip(path, path[1:]): * lpath = interpolation.Linear(prev, cur)[1:-1:skip] * workorders = [(x, images, svm, prev, cur, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dim, errortube, sigma, plot) for x in lpath] * if pool: */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2));
28: dim, errortube, sigma, plot) for x in lpath]
/* "vision/alearn/linear.pyx":28 * lpath = interpolation.Linear(prev, cur)[1:-1:skip] * workorders = [(x, images, svm, prev, cur, * dim, errortube, sigma, plot) for x in lpath] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if pool: * scores.extend(pool.map(score_frame_do, workorders)) */ if (PyList_CheckExact(__pyx_v_lpath) || PyTuple_CheckExact(__pyx_v_lpath)) { __pyx_t_4 = __pyx_v_lpath; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_lpath); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { if (PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break; __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; } else if (PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break; __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; } else { __pyx_t_1 = __pyx_t_10(__pyx_t_4); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_x); __pyx_v_x = __pyx_t_1; __pyx_t_1 = 0; /* "vision/alearn/linear.pyx":27 * for prev, cur in zip(path, path[1:]): * lpath = interpolation.Linear(prev, cur)[1:-1:skip] * workorders = [(x, images, svm, prev, cur, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dim, errortube, sigma, plot) for x in lpath] * if pool: */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sigma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "vision/alearn/linear.pyx":28 * lpath = interpolation.Linear(prev, cur)[1:-1:skip] * workorders = [(x, images, svm, prev, cur, * dim, errortube, sigma, plot) for x in lpath] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if pool: * scores.extend(pool.map(score_frame_do, workorders)) */ __pyx_t_7 = PyTuple_New(9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); __Pyx_INCREF(__pyx_v_images); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_images); __Pyx_GIVEREF(__pyx_v_images); __Pyx_INCREF(__pyx_v_svm); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_svm); __Pyx_GIVEREF(__pyx_v_svm); __Pyx_INCREF(__pyx_v_prev); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_prev); __Pyx_GIVEREF(__pyx_v_prev); __Pyx_INCREF(__pyx_v_cur); PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_cur); __Pyx_GIVEREF(__pyx_v_cur); __Pyx_INCREF(__pyx_v_dim); PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_v_dim); __Pyx_GIVEREF(__pyx_v_dim); __Pyx_INCREF(__pyx_v_errortube); PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_v_errortube); __Pyx_GIVEREF(__pyx_v_errortube); PyTuple_SET_ITEM(__pyx_t_7, 7, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_plot); PyTuple_SET_ITEM(__pyx_t_7, 8, __pyx_v_plot); __Pyx_GIVEREF(__pyx_v_plot); __pyx_t_1 = 0; if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_2)); __Pyx_XDECREF(((PyObject *)__pyx_v_workorders)); __pyx_v_workorders = __pyx_t_2; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
29: if pool:
/* "vision/alearn/linear.pyx":29 * workorders = [(x, images, svm, prev, cur, * dim, errortube, sigma, plot) for x in lpath] * if pool: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* scores.extend(pool.map(score_frame_do, workorders)) * else: */ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_pool); if (unlikely(__pyx_t_11<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_11) {
30: scores.extend(pool.map(score_frame_do, workorders))
/* "vision/alearn/linear.pyx":30 * dim, errortube, sigma, plot) for x in lpath] * if pool: * scores.extend(pool.map(score_frame_do, workorders)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* else: * for workorder in workorders: */ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_scores), __pyx_n_s__extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyObject_GetAttr(__pyx_v_pool, __pyx_n_s__map); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__score_frame_do); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_workorders)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_workorders)); __Pyx_GIVEREF(((PyObject *)__pyx_v_workorders)); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L12; } /*else*/ {
31: else:
32: for workorder in workorders:
/* "vision/alearn/linear.pyx":32 * scores.extend(pool.map(score_frame_do, workorders)) * else: * for workorder in workorders: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* scores.append(score_frame_do(workorder)) * */ if (unlikely(((PyObject *)__pyx_v_workorders) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = ((PyObject *)__pyx_v_workorders); __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0; for (;;) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break; __pyx_t_1 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; __Pyx_XDECREF(__pyx_v_workorder); __pyx_v_workorder = __pyx_t_1; __pyx_t_1 = 0;
33: scores.append(score_frame_do(workorder))
/* "vision/alearn/linear.pyx":33 * else: * for workorder in workorders: * scores.append(score_frame_do(workorder)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * best = max([min(x) for x in zip(*[scores[y:] for y in range(25)])])[1] */ if (unlikely(((PyObject *)__pyx_v_scores) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__score_frame_do); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_workorder); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_workorder); __Pyx_GIVEREF(__pyx_v_workorder); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __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_2)); __pyx_t_2 = 0; __pyx_t_12 = PyList_Append(__pyx_v_scores, __pyx_t_4); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_L12:; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34:
35: best = max([min(x) for x in zip(*[scores[y:] for y in range(25)])])[1]
/* "vision/alearn/linear.pyx":35 * scores.append(score_frame_do(workorder)) * * best = max([min(x) for x in zip(*[scores[y:] for y in range(25)])])[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * if plot: */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); for (__pyx_t_13 = 0; __pyx_t_13<
25; __pyx_t_13+=1) { __pyx_v_y = __pyx_t_13; __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_scores), __pyx_v_y, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (unlikely(PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } __pyx_t_4 = PySequence_Tuple(((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); 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_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { if (PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; } else if (PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; } else { __pyx_t_7 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_7)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF(__pyx_v_x); __pyx_v_x = __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 = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__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 = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), 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(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__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_v_best = __pyx_t_4; __pyx_t_4 = 0;
36:
37: if plot:
/* "vision/alearn/linear.pyx":37 * best = max([min(x) for x in zip(*[scores[y:] for y in range(25)])])[1] * * if plot: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import matplotlib.pyplot as plt * log.info("Saving score plot") */ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_plot); if (unlikely(__pyx_t_11<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_11) {
38: import matplotlib.pyplot as plt
/* "vision/alearn/linear.pyx":38 * * if plot: * import matplotlib.pyplot as plt #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* log.info("Saving score plot") * plt.close() */ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(((PyObject *)__pyx_n_s_9)); PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_9)); __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_8), ((PyObject *)__pyx_t_4), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_plt = __pyx_t_3; __pyx_t_3 = 0;
39: log.info("Saving score plot")
/* "vision/alearn/linear.pyx":39 * if plot: * import matplotlib.pyplot as plt * log.info("Saving score plot") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.close() * plt.plot([x[1] for x in scores], [x[0] for x in scores]) */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "vision/alearn/linear.pyx":39 * if plot: * import matplotlib.pyplot as plt * log.info("Saving score plot") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.close() * plt.plot([x[1] for x in scores], [x[0] for x in scores]) */ __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
40: plt.close()
/* "vision/alearn/linear.pyx":40 * import matplotlib.pyplot as plt * log.info("Saving score plot") * plt.close() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.plot([x[1] for x in scores], [x[0] for x in scores]) * plt.grid() */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41: plt.plot([x[1] for x in scores], [x[0] for x in scores])
/* "vision/alearn/linear.pyx":41 * log.info("Saving score plot") * plt.close() * plt.plot([x[1] for x in scores], [x[0] for x in scores]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.grid() * plt.savefig("{0}/scoreplot.png".format(plot)) */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__plot); 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_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (unlikely(((PyObject *)__pyx_v_scores) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = ((PyObject *)__pyx_v_scores); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; for (;;) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; __Pyx_XDECREF(__pyx_v_x); __pyx_v_x = __pyx_t_7; __pyx_t_7 = 0; __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (unlikely(((PyObject *)__pyx_v_scores) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = ((PyObject *)__pyx_v_scores); __Pyx_INCREF(__pyx_t_7); __pyx_t_5 = 0; for (;;) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_7)) break; __pyx_t_1 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; __Pyx_XDECREF(__pyx_v_x); __pyx_v_x = __pyx_t_1; __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(2); 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)); __Pyx_INCREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42: plt.grid()
/* "vision/alearn/linear.pyx":42 * plt.close() * plt.plot([x[1] for x in scores], [x[0] for x in scores]) * plt.grid() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.savefig("{0}/scoreplot.png".format(plot)) * */ __pyx_t_2 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__grid); 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_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
43: plt.savefig("{0}/scoreplot.png".format(plot))
/* "vision/alearn/linear.pyx":43 * plt.plot([x[1] for x in scores], [x[0] for x in scores]) * plt.grid() * plt.savefig("{0}/scoreplot.png".format(plot)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * return best */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__savefig); 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_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_12), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(1); 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_plot); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_plot); __Pyx_GIVEREF(__pyx_v_plot); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L19; } __pyx_L19:;
44:
45: return best
/* "vision/alearn/linear.pyx":45 * plt.savefig("{0}/scoreplot.png".format(plot)) * * return best #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def score_frame_do(workorder): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_best); __pyx_r = __pyx_v_best; 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_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("vision.alearn.linear.pick", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_svm); __Pyx_XDECREF(__pyx_v_scores); __Pyx_XDECREF(__pyx_v_prev); __Pyx_XDECREF(__pyx_v_cur); __Pyx_XDECREF(__pyx_v_lpath); __Pyx_XDECREF(__pyx_v_workorders); __Pyx_XDECREF(__pyx_v_workorder); __Pyx_XDECREF(__pyx_v_best); __Pyx_XDECREF(__pyx_v_plt); __Pyx_XDECREF(__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
46:
47: def score_frame_do(workorder):
/* "vision/alearn/linear.pyx":47 * return best * * def score_frame_do(workorder): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return score_frame(*workorder), workorder[0].frame * */ static PyObject *__pyx_pf_6vision_6alearn_6linear_1score_frame_do(PyObject *__pyx_self, PyObject *__pyx_v_workorder); /*proto*/ static char __pyx_doc_6vision_6alearn_6linear_1score_frame_do[] = "score_frame_do(workorder)"; static PyMethodDef __pyx_mdef_6vision_6alearn_6linear_1score_frame_do = {__Pyx_NAMESTR("score_frame_do"), (PyCFunction)__pyx_pf_6vision_6alearn_6linear_1score_frame_do, METH_O, __Pyx_DOCSTR(__pyx_doc_6vision_6alearn_6linear_1score_frame_do)}; static PyObject *__pyx_pf_6vision_6alearn_6linear_1score_frame_do(PyObject *__pyx_self, PyObject *__pyx_v_workorder) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("score_frame_do"); __pyx_self = __pyx_self; /* "vision/alearn/linear.pyx":47 * return best * * def score_frame_do(workorder): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return score_frame(*workorder), workorder[0].frame * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6vision_6alearn_6linear_1score_frame_do, NULL, __pyx_n_s_44); 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); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__score_frame_do, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
48: return score_frame(*workorder), workorder[0].frame
/* "vision/alearn/linear.pyx":48 * * def score_frame_do(workorder): * return score_frame(*workorder), workorder[0].frame #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * def score_frame(annotations.Box linearbox, images, svm, */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__score_frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_Tuple(__pyx_v_workorder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __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 = 48; __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; __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_workorder, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 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.alearn.linear.score_frame_do", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
49:
50: def score_frame(annotations.Box linearbox, images, svm,
/* "vision/alearn/linear.pyx":50 * return score_frame(*workorder), workorder[0].frame * * def score_frame(annotations.Box linearbox, images, svm, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* annotations.Box previous, annotations.Box current, dim, * int errortube, double sigma = 10, plot = False): */ static PyObject *__pyx_pf_6vision_6alearn_6linear_2score_frame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_6alearn_6linear_2score_frame[] = "score_frame(Box linearbox, images, svm, Box previous, Box current, dim, int errortube, double sigma=10, plot=False)\n\n Scores an individual frame to determine its usefulness. A higher score\n is more useful than a lower score from a different frame.\n "; static PyMethodDef __pyx_mdef_6vision_6alearn_6linear_2score_frame = {__Pyx_NAMESTR("score_frame"), (PyCFunction)__pyx_pf_6vision_6alearn_6linear_2score_frame, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6vision_6alearn_6linear_2score_frame)}; static PyObject *__pyx_pf_6vision_6alearn_6linear_2score_frame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_6vision_11annotations_Box *__pyx_v_linearbox = 0; PyObject *__pyx_v_images = 0; PyObject *__pyx_v_svm = 0; struct __pyx_obj_6vision_11annotations_Box *__pyx_v_previous = 0; struct __pyx_obj_6vision_11annotations_Box *__pyx_v_current = 0; PyObject *__pyx_v_dim = 0; int __pyx_v_errortube; double __pyx_v_sigma; PyObject *__pyx_v_plot = 0; double __pyx_v_wr; double __pyx_v_hr; PyObject *__pyx_v_im = NULL; int __pyx_v_w; int __pyx_v_h; PyArrayObject *__pyx_v_costim = 0; long __pyx_v_pstartx; int __pyx_v_pstopx; long __pyx_v_pstarty; int __pyx_v_pstopy; double __pyx_v_framearea; int __pyx_v_framedifference; double __pyx_v_score; double __pyx_v_normalizer; PyArrayObject *__pyx_v_dlinearim = 0; PyArrayObject *__pyx_v_dprobim = 0; PyArrayObject *__pyx_v_dscoreim = 0; double __pyx_v_lineardiffy; double __pyx_v_lineardiffx; double __pyx_v_lineardiff; int __pyx_v_i; int __pyx_v_j; float __pyx_v_matchscore; double __pyx_v_localscore; PyObject *__pyx_v_plt = NULL; Py_buffer __pyx_bstruct_dlinearim; Py_ssize_t __pyx_bstride_0_dlinearim = 0; Py_ssize_t __pyx_bstride_1_dlinearim = 0; Py_ssize_t __pyx_bshape_0_dlinearim = 0; Py_ssize_t __pyx_bshape_1_dlinearim = 0; Py_buffer __pyx_bstruct_dscoreim; Py_ssize_t __pyx_bstride_0_dscoreim = 0; Py_ssize_t __pyx_bstride_1_dscoreim = 0; Py_ssize_t __pyx_bshape_0_dscoreim = 0; Py_ssize_t __pyx_bshape_1_dscoreim = 0; Py_buffer __pyx_bstruct_costim; Py_ssize_t __pyx_bstride_0_costim = 0; Py_ssize_t __pyx_bstride_1_costim = 0; Py_ssize_t __pyx_bshape_0_costim = 0; Py_ssize_t __pyx_bshape_1_costim = 0; Py_buffer __pyx_bstruct_dprobim; Py_ssize_t __pyx_bstride_0_dprobim = 0; Py_ssize_t __pyx_bstride_1_dprobim = 0; Py_ssize_t __pyx_bshape_0_dprobim = 0; Py_ssize_t __pyx_bshape_1_dprobim = 0; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__linearbox,&__pyx_n_s__images,&__pyx_n_s__svm,&__pyx_n_s__previous,&__pyx_n_s__current,&__pyx_n_s__dim,&__pyx_n_s__errortube,&__pyx_n_s__sigma,&__pyx_n_s__plot,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("score_frame"); __pyx_self = __pyx_self; { PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[8] = __pyx_k_13; 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__linearbox); 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("score_frame", 0, 7, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__svm); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__previous); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__current); if (likely(values[4])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); if (likely(values[5])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errortube); if (likely(values[6])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma); if (value) { values[7] = value; kw_args--; } } case 8: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__plot); 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), "score_frame")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[3] = PyTuple_GET_ITEM(__pyx_args, 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_linearbox = ((struct __pyx_obj_6vision_11annotations_Box *)values[0]); __pyx_v_images = values[1]; __pyx_v_svm = values[2]; __pyx_v_previous = ((struct __pyx_obj_6vision_11annotations_Box *)values[3]); __pyx_v_current = ((struct __pyx_obj_6vision_11annotations_Box *)values[4]); __pyx_v_dim = values[5]; __pyx_v_errortube = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_errortube == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[7]) { __pyx_v_sigma = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_sigma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { /* "vision/alearn/linear.pyx":50 * return score_frame(*workorder), workorder[0].frame * * def score_frame(annotations.Box linearbox, images, svm, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* annotations.Box previous, annotations.Box current, dim, * int errortube, double sigma = 10, plot = False): */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6vision_6alearn_6linear_2score_frame, NULL, __pyx_n_s_44); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__score_frame, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
51: annotations.Box previous, annotations.Box current, dim,
52: int errortube, double sigma = 10, plot = False):
/* "vision/alearn/linear.pyx":52 * def score_frame(annotations.Box linearbox, images, svm, * annotations.Box previous, annotations.Box current, dim, * int errortube, double sigma = 10, plot = False): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Scores an individual frame to determine its usefulness. A higher score */ __pyx_v_sigma = ((double)10.0); } __pyx_v_plot = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("score_frame", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.alearn.linear.score_frame", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_costim.buf = NULL; __pyx_bstruct_dlinearim.buf = NULL; __pyx_bstruct_dprobim.buf = NULL; __pyx_bstruct_dscoreim.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_linearbox), __pyx_ptype_6vision_11annotations_Box, 1, "linearbox", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_previous), __pyx_ptype_6vision_11annotations_Box, 1, "previous", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_current), __pyx_ptype_6vision_11annotations_Box, 1, "current", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "vision/alearn/linear.pyx":52 * def score_frame(annotations.Box linearbox, images, svm, * annotations.Box previous, annotations.Box current, dim, * int errortube, double sigma = 10, plot = False): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Scores an individual frame to determine its usefulness. A higher score */ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_13 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
53: """
54: Scores an individual frame to determine its usefulness. A higher score
55: is more useful than a lower score from a different frame.
56: """
57: log.info("Scoring frame {0}".format(linearbox.frame))
/* "vision/alearn/linear.pyx":57 * is more useful than a lower score from a different frame. * """ * log.info("Scoring frame {0}".format(linearbox.frame)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef double wr = (<
float>dim[0]) / linearbox.width */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __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 = 57; __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(((PyObject *)__pyx_kp_s_14), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_linearbox->frame); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __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_4)); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
58:
59: cdef double wr = (<float>dim[0]) / linearbox.width
/* "vision/alearn/linear.pyx":59 * log.info("Scoring frame {0}".format(linearbox.frame)) * * cdef double wr = (<
float>dim[0]) / linearbox.width #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef double hr = (<
float>dim[1]) / linearbox.height * */ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dim, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(((float)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_linearbox), __pyx_n_s__width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_wr = __pyx_t_6;
60: cdef double hr = (<float>dim[1]) / linearbox.height
/* "vision/alearn/linear.pyx":60 * * cdef double wr = (<
float>dim[0]) / linearbox.width * cdef double hr = (<
float>dim[1]) / linearbox.height #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * im = images[linearbox.frame] */ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_dim, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(((float)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_linearbox), __pyx_n_s__height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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_4); __pyx_t_4 = 0; __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_hr = __pyx_t_6;
61:
62: im = images[linearbox.frame]
/* "vision/alearn/linear.pyx":62 * cdef double hr = (<
float>dim[1]) / linearbox.height * * im = images[linearbox.frame] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* im = im.resize((int(im.size[0] * wr), int(im.size[1] * hr))) * */ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_images, __pyx_v_linearbox->frame, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_im = __pyx_t_3; __pyx_t_3 = 0;
63: im = im.resize((int(im.size[0] * wr), int(im.size[1] * hr)))
/* "vision/alearn/linear.pyx":63 * * im = images[linearbox.frame] * im = im.resize((int(im.size[0] * wr), int(im.size[1] * hr))) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef int w = im.size[0] - dim[0] */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__resize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyFloat_FromDouble(__pyx_v_wr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __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_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __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 = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyFloat_FromDouble(__pyx_v_hr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__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 = 63; __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); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__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 = 63; __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); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_1 = 0; __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __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 = 63; __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_DECREF(__pyx_v_im); __pyx_v_im = __pyx_t_4; __pyx_t_4 = 0;
64:
65: cdef int w = im.size[0] - dim[0]
/* "vision/alearn/linear.pyx":65 * im = im.resize((int(im.size[0] * wr), int(im.size[1] * hr))) * * cdef int w = im.size[0] - dim[0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef int h = im.size[1] - dim[1] * */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_dim, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Subtract(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_w = __pyx_t_8;
66: cdef int h = im.size[1] - dim[1]
/* "vision/alearn/linear.pyx":66 * * cdef int w = im.size[0] - dim[0] * cdef int h = im.size[1] - dim[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef numpy.ndarray[numpy.double_t, ndim=2] costim */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dim, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); 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_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_h = __pyx_t_8;
67:
68: cdef numpy.ndarray[numpy.double_t, ndim=2] costim
69: costim = convolution.hogrgb(im, dim, svm.hogweights(), svm.rgbweights())
/* "vision/alearn/linear.pyx":69 * * cdef numpy.ndarray[numpy.double_t, ndim=2] costim * costim = convolution.hogrgb(im, dim, svm.hogweights(), svm.rgbweights()) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * pstartx = linearbox.xtl - errortube */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__convolution); 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_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__hogrgb); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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(__pyx_v_svm, __pyx_n_s__hogweights); 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_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_GetAttr(__pyx_v_svm, __pyx_n_s__rgbweights); 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_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); __Pyx_INCREF(__pyx_v_dim); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_dim); __Pyx_GIVEREF(__pyx_v_dim); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_costim); __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_costim, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8<
0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_costim, (PyObject*)__pyx_v_costim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); } } __pyx_bstride_0_costim = __pyx_bstruct_costim.strides[0]; __pyx_bstride_1_costim = __pyx_bstruct_costim.strides[1]; __pyx_bshape_0_costim = __pyx_bstruct_costim.shape[0]; __pyx_bshape_1_costim = __pyx_bstruct_costim.shape[1]; if (unlikely(__pyx_t_8<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __pyx_v_costim = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
70:
71: pstartx = linearbox.xtl - errortube
/* "vision/alearn/linear.pyx":71 * costim = convolution.hogrgb(im, dim, svm.hogweights(), svm.rgbweights()) * * pstartx = linearbox.xtl - errortube #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstopx = linearbox.xtl + errortube * pstarty = linearbox.ytl - errortube */ __pyx_v_pstartx = (__pyx_v_linearbox->xtl - __pyx_v_errortube);
72: pstopx = linearbox.xtl + errortube
/* "vision/alearn/linear.pyx":72 * * pstartx = linearbox.xtl - errortube * pstopx = linearbox.xtl + errortube #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstarty = linearbox.ytl - errortube * pstopy = linearbox.ytl + errortube */ __pyx_v_pstopx = (__pyx_v_linearbox->xtl + __pyx_v_errortube);
73: pstarty = linearbox.ytl - errortube
/* "vision/alearn/linear.pyx":73 * pstartx = linearbox.xtl - errortube * pstopx = linearbox.xtl + errortube * pstarty = linearbox.ytl - errortube #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstopy = linearbox.ytl + errortube * */ __pyx_v_pstarty = (__pyx_v_linearbox->ytl - __pyx_v_errortube);
74: pstopy = linearbox.ytl + errortube
/* "vision/alearn/linear.pyx":74 * pstopx = linearbox.xtl + errortube * pstarty = linearbox.ytl - errortube * pstopy = linearbox.ytl + errortube #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * if pstartx<
0: */ __pyx_v_pstopy = (__pyx_v_linearbox->ytl + __pyx_v_errortube);
75:
76: if pstartx < 0:
/* "vision/alearn/linear.pyx":76 * pstopy = linearbox.ytl + errortube * * if pstartx<
0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstartx = 0 * if pstopx > w: */ __pyx_t_13 = (__pyx_v_pstartx<
0); if (__pyx_t_13) {
77: pstartx = 0
/* "vision/alearn/linear.pyx":77 * * if pstartx<
0: * pstartx = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if pstopx > w: * pstopx = w */ __pyx_v_pstartx = 0; goto __pyx_L6; } __pyx_L6:;
78: if pstopx > w:
/* "vision/alearn/linear.pyx":78 * if pstartx<
0: * pstartx = 0 * if pstopx > w: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstopx = w * if pstarty<
0: */ __pyx_t_13 = (__pyx_v_pstopx > __pyx_v_w); if (__pyx_t_13) {
79: pstopx = w
/* "vision/alearn/linear.pyx":79 * pstartx = 0 * if pstopx > w: * pstopx = w #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if pstarty<
0: * pstarty = 0 */ __pyx_v_pstopx = __pyx_v_w; goto __pyx_L7; } __pyx_L7:;
80: if pstarty < 0:
/* "vision/alearn/linear.pyx":80 * if pstopx > w: * pstopx = w * if pstarty<
0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstarty = 0 * if pstopy > h: */ __pyx_t_13 = (__pyx_v_pstarty<
0); if (__pyx_t_13) {
81: pstarty = 0
/* "vision/alearn/linear.pyx":81 * pstopx = w * if pstarty<
0: * pstarty = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if pstopy > h: * pstopy = h */ __pyx_v_pstarty = 0; goto __pyx_L8; } __pyx_L8:;
82: if pstopy > h:
/* "vision/alearn/linear.pyx":82 * if pstarty<
0: * pstarty = 0 * if pstopy > h: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pstopy = h * */ __pyx_t_13 = (__pyx_v_pstopy > __pyx_v_h); if (__pyx_t_13) {
83: pstopy = h
/* "vision/alearn/linear.pyx":83 * pstarty = 0 * if pstopy > h: * pstopy = h #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef double framearea = (w/wr) * (h/hr) */ __pyx_v_pstopy = __pyx_v_h; goto __pyx_L9; } __pyx_L9:;
84:
85: cdef double framearea = (w/wr) * (h/hr)
/* "vision/alearn/linear.pyx":85 * pstopy = h * * cdef double framearea = (w/wr) * (h/hr) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef int framedifference = current.frame - previous.frame * score = 0 */ __pyx_v_framearea = ((__pyx_v_w / __pyx_v_wr) * (__pyx_v_h / __pyx_v_hr));
86: cdef int framedifference = current.frame - previous.frame
/* "vision/alearn/linear.pyx":86 * * cdef double framearea = (w/wr) * (h/hr) * cdef int framedifference = current.frame - previous.frame #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* score = 0 * normalizer = 0 */ __pyx_v_framedifference = (__pyx_v_current->frame - __pyx_v_previous->frame);
87: score = 0
/* "vision/alearn/linear.pyx":87 * cdef double framearea = (w/wr) * (h/hr) * cdef int framedifference = current.frame - previous.frame * score = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* normalizer = 0 * */ __pyx_v_score = 0.0;
88: normalizer = 0
/* "vision/alearn/linear.pyx":88 * cdef int framedifference = current.frame - previous.frame * score = 0 * normalizer = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef numpy.ndarray[numpy.double_t, ndim=2] dlinearim = numpy.zeros((w, h)) */ __pyx_v_normalizer = 0.0;
89:
90: cdef numpy.ndarray[numpy.double_t, ndim=2] dlinearim = numpy.zeros((w, h))
/* "vision/alearn/linear.pyx":90 * normalizer = 0 * * cdef numpy.ndarray[numpy.double_t, ndim=2] dlinearim = numpy.zeros((w, h)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef numpy.ndarray[numpy.double_t, ndim=2] dprobim = numpy.zeros((w, h)) * cdef numpy.ndarray[numpy.double_t, ndim=2] dscoreim = numpy.zeros((w, h)) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dlinearim, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_dlinearim = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dlinearim.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_dlinearim = __pyx_bstruct_dlinearim.strides[0]; __pyx_bstride_1_dlinearim = __pyx_bstruct_dlinearim.strides[1]; __pyx_bshape_0_dlinearim = __pyx_bstruct_dlinearim.shape[0]; __pyx_bshape_1_dlinearim = __pyx_bstruct_dlinearim.shape[1]; } } __pyx_t_14 = 0; __pyx_v_dlinearim = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
91: cdef numpy.ndarray[numpy.double_t, ndim=2] dprobim = numpy.zeros((w, h))
/* "vision/alearn/linear.pyx":91 * * cdef numpy.ndarray[numpy.double_t, ndim=2] dlinearim = numpy.zeros((w, h)) * cdef numpy.ndarray[numpy.double_t, ndim=2] dprobim = numpy.zeros((w, h)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef numpy.ndarray[numpy.double_t, ndim=2] dscoreim = numpy.zeros((w, h)) * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_w); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dprobim, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_dprobim = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dprobim.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_dprobim = __pyx_bstruct_dprobim.strides[0]; __pyx_bstride_1_dprobim = __pyx_bstruct_dprobim.strides[1]; __pyx_bshape_0_dprobim = __pyx_bstruct_dprobim.shape[0]; __pyx_bshape_1_dprobim = __pyx_bstruct_dprobim.shape[1]; } } __pyx_t_15 = 0; __pyx_v_dprobim = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
92: cdef numpy.ndarray[numpy.double_t, ndim=2] dscoreim = numpy.zeros((w, h))
/* "vision/alearn/linear.pyx":92 * cdef numpy.ndarray[numpy.double_t, ndim=2] dlinearim = numpy.zeros((w, h)) * cdef numpy.ndarray[numpy.double_t, ndim=2] dprobim = numpy.zeros((w, h)) * cdef numpy.ndarray[numpy.double_t, ndim=2] dscoreim = numpy.zeros((w, h)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef double lineardiffy, lineardiffx, lineardiff */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dscoreim, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_dscoreim = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dscoreim.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_dscoreim = __pyx_bstruct_dscoreim.strides[0]; __pyx_bstride_1_dscoreim = __pyx_bstruct_dscoreim.strides[1]; __pyx_bshape_0_dscoreim = __pyx_bstruct_dscoreim.shape[0]; __pyx_bshape_1_dscoreim = __pyx_bstruct_dscoreim.shape[1]; } } __pyx_t_16 = 0; __pyx_v_dscoreim = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
93:
94: cdef double lineardiffy, lineardiffx, lineardiff
95: cdef int i, j
96: for i in range(pstartx, pstopx):
/* "vision/alearn/linear.pyx":96 * cdef double lineardiffy, lineardiffx, lineardiff * cdef int i, j * for i in range(pstartx, pstopx): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for j in range(pstarty, pstopy): * # calculate area difference through cross product */ __pyx_t_8 = __pyx_v_pstopx; for (__pyx_t_17 = __pyx_v_pstartx; __pyx_t_17<
__pyx_t_8; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17;
97: for j in range(pstarty, pstopy):
/* "vision/alearn/linear.pyx":97 * cdef int i, j * for i in range(pstartx, pstopx): * for j in range(pstarty, pstopy): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* # calculate area difference through cross product * lineardiffy = current.xtl - previous.xtl */ __pyx_t_18 = __pyx_v_pstopy; for (__pyx_t_19 = __pyx_v_pstarty; __pyx_t_19<
__pyx_t_18; __pyx_t_19+=1) { __pyx_v_j = __pyx_t_19;
98: # calculate area difference through cross product
99: lineardiffy = current.xtl - previous.xtl
/* "vision/alearn/linear.pyx":99 * for j in range(pstarty, pstopy): * # calculate area difference through cross product * lineardiffy = current.xtl - previous.xtl #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lineardiffy *= linearbox.frame - previous.frame * lineardiffy -= (i / wr - previous.xtl) * framedifference */ __pyx_v_lineardiffy = (__pyx_v_current->xtl - __pyx_v_previous->xtl);
100: lineardiffy *= linearbox.frame - previous.frame
/* "vision/alearn/linear.pyx":100 * # calculate area difference through cross product * lineardiffy = current.xtl - previous.xtl * lineardiffy *= linearbox.frame - previous.frame #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lineardiffy -= (i / wr - previous.xtl) * framedifference * */ __pyx_v_lineardiffy = (__pyx_v_lineardiffy * (__pyx_v_linearbox->frame - __pyx_v_previous->frame));
101: lineardiffy -= (i / wr - previous.xtl) * framedifference
/* "vision/alearn/linear.pyx":101 * lineardiffy = current.xtl - previous.xtl * lineardiffy *= linearbox.frame - previous.frame * lineardiffy -= (i / wr - previous.xtl) * framedifference #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * lineardiffx = current.ytl - previous.ytl */ __pyx_v_lineardiffy = (__pyx_v_lineardiffy - (((__pyx_v_i / __pyx_v_wr) - __pyx_v_previous->xtl) * __pyx_v_framedifference));
102:
103: lineardiffx = current.ytl - previous.ytl
/* "vision/alearn/linear.pyx":103 * lineardiffy -= (i / wr - previous.xtl) * framedifference * * lineardiffx = current.ytl - previous.ytl #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lineardiffx *= linearbox.frame - previous.frame * lineardiffx -= (j / hr - previous.ytl) * framedifference */ __pyx_v_lineardiffx = (__pyx_v_current->ytl - __pyx_v_previous->ytl);
104: lineardiffx *= linearbox.frame - previous.frame
/* "vision/alearn/linear.pyx":104 * * lineardiffx = current.ytl - previous.ytl * lineardiffx *= linearbox.frame - previous.frame #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lineardiffx -= (j / hr - previous.ytl) * framedifference * */ __pyx_v_lineardiffx = (__pyx_v_lineardiffx * (__pyx_v_linearbox->frame - __pyx_v_previous->frame));
105: lineardiffx -= (j / hr - previous.ytl) * framedifference
/* "vision/alearn/linear.pyx":105 * lineardiffx = current.ytl - previous.ytl * lineardiffx *= linearbox.frame - previous.frame * lineardiffx -= (j / hr - previous.ytl) * framedifference #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * lineardiff = lineardiffx * lineardiffx */ __pyx_v_lineardiffx = (__pyx_v_lineardiffx - (((__pyx_v_j / __pyx_v_hr) - __pyx_v_previous->ytl) * __pyx_v_framedifference));
106:
107: lineardiff = lineardiffx * lineardiffx
/* "vision/alearn/linear.pyx":107 * lineardiffx -= (j / hr - previous.ytl) * framedifference * * lineardiff = lineardiffx * lineardiffx #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* lineardiff += lineardiffy * lineardiffy * */ __pyx_v_lineardiff = (__pyx_v_lineardiffx * __pyx_v_lineardiffx);
108: lineardiff += lineardiffy * lineardiffy
/* "vision/alearn/linear.pyx":108 * * lineardiff = lineardiffx * lineardiffx * lineardiff += lineardiffy * lineardiffy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # compute local score */ __pyx_v_lineardiff = (__pyx_v_lineardiff + (__pyx_v_lineardiffy * __pyx_v_lineardiffy));
109:
110: # compute local score
111: matchscore = exp(-costim[i,j] / sigma)
/* "vision/alearn/linear.pyx":111 * * # compute local score * matchscore = exp(-costim[i,j] / sigma) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* localscore = matchscore * lineardiff * # store for total score */ __pyx_t_20 = __pyx_v_i; __pyx_t_21 = __pyx_v_j; if (__pyx_t_20<
0) __pyx_t_20 += __pyx_bshape_0_costim; if (__pyx_t_21<
0) __pyx_t_21 += __pyx_bshape_1_costim; __pyx_v_matchscore = exp(((-(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_costim.buf, __pyx_t_20, __pyx_bstride_0_costim, __pyx_t_21, __pyx_bstride_1_costim))) / __pyx_v_sigma));
112: localscore = matchscore * lineardiff
/* "vision/alearn/linear.pyx":112 * # compute local score * matchscore = exp(-costim[i,j] / sigma) * localscore = matchscore * lineardiff #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* # store for total score * score += localscore */ __pyx_v_localscore = (__pyx_v_matchscore * __pyx_v_lineardiff);
113: # store for total score
114: score += localscore
/* "vision/alearn/linear.pyx":114 * localscore = matchscore * lineardiff * # store for total score * score += localscore #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* normalizer += matchscore * */ __pyx_v_score = (__pyx_v_score + __pyx_v_localscore);
115: normalizer += matchscore
/* "vision/alearn/linear.pyx":115 * # store for total score * score += localscore * normalizer += matchscore #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * dlinearim[i,j] = lineardiff */ __pyx_v_normalizer = (__pyx_v_normalizer + __pyx_v_matchscore);
116:
117: dlinearim[i,j] = lineardiff
/* "vision/alearn/linear.pyx":117 * normalizer += matchscore * * dlinearim[i,j] = lineardiff #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dprobim[i,j] = matchscore * dscoreim[i,j] = localscore */ __pyx_t_22 = __pyx_v_i; __pyx_t_23 = __pyx_v_j; if (__pyx_t_22<
0) __pyx_t_22 += __pyx_bshape_0_dlinearim; if (__pyx_t_23<
0) __pyx_t_23 += __pyx_bshape_1_dlinearim; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_dlinearim.buf, __pyx_t_22, __pyx_bstride_0_dlinearim, __pyx_t_23, __pyx_bstride_1_dlinearim) = __pyx_v_lineardiff;
118: dprobim[i,j] = matchscore
/* "vision/alearn/linear.pyx":118 * * dlinearim[i,j] = lineardiff * dprobim[i,j] = matchscore #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dscoreim[i,j] = localscore * */ __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_j; if (__pyx_t_24<
0) __pyx_t_24 += __pyx_bshape_0_dprobim; if (__pyx_t_25<
0) __pyx_t_25 += __pyx_bshape_1_dprobim; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_dprobim.buf, __pyx_t_24, __pyx_bstride_0_dprobim, __pyx_t_25, __pyx_bstride_1_dprobim) = __pyx_v_matchscore;
119: dscoreim[i,j] = localscore
/* "vision/alearn/linear.pyx":119 * dlinearim[i,j] = lineardiff * dprobim[i,j] = matchscore * dscoreim[i,j] = localscore #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * if plot: */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_j; if (__pyx_t_26<
0) __pyx_t_26 += __pyx_bshape_0_dscoreim; if (__pyx_t_27<
0) __pyx_t_27 += __pyx_bshape_1_dscoreim; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_dscoreim.buf, __pyx_t_26, __pyx_bstride_0_dscoreim, __pyx_t_27, __pyx_bstride_1_dscoreim) = __pyx_v_localscore; } }
120:
121: if plot:
/* "vision/alearn/linear.pyx":121 * dscoreim[i,j] = localscore * * if plot: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import matplotlib.pyplot as plt * plt.subplot(221) */ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_plot); if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_13) {
122: import matplotlib.pyplot as plt
/* "vision/alearn/linear.pyx":122 * * if plot: * import matplotlib.pyplot as plt #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.subplot(221) * plt.set_cmap("gray") */ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(((PyObject *)__pyx_n_s_9)); PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_9)); __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_8), ((PyObject *)__pyx_t_4), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_plt = __pyx_t_3; __pyx_t_3 = 0;
123: plt.subplot(221)
/* "vision/alearn/linear.pyx":123 * if plot: * import matplotlib.pyplot as plt * plt.subplot(221) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dprobim.transpose() / normalizer) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__subplot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "vision/alearn/linear.pyx":123 * if plot: * import matplotlib.pyplot as plt * plt.subplot(221) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dprobim.transpose() / normalizer) */ __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); __Pyx_INCREF(__pyx_int_221); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_int_221); __Pyx_GIVEREF(__pyx_int_221); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
124: plt.set_cmap("gray")
/* "vision/alearn/linear.pyx":124 * import matplotlib.pyplot as plt * plt.subplot(221) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dprobim.transpose() / normalizer) * plt.title("probability") */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__set_cmap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "vision/alearn/linear.pyx":124 * import matplotlib.pyplot as plt * plt.subplot(221) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dprobim.transpose() / normalizer) * plt.title("probability") */ __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(((PyObject *)__pyx_n_s__gray)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
125: plt.imshow(dprobim.transpose() / normalizer)
/* "vision/alearn/linear.pyx":125 * plt.subplot(221) * plt.set_cmap("gray") * plt.imshow(dprobim.transpose() / normalizer) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.title("probability") * */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__imshow); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_dprobim), __pyx_n_s__transpose); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyFloat_FromDouble(__pyx_v_normalizer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__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 = 125; __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 = 125; __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;
126: plt.title("probability")
/* "vision/alearn/linear.pyx":126 * plt.set_cmap("gray") * plt.imshow(dprobim.transpose() / normalizer) * plt.title("probability") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(222) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__title); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "vision/alearn/linear.pyx":126 * plt.set_cmap("gray") * plt.imshow(dprobim.transpose() / normalizer) * plt.title("probability") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(222) */ __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); __Pyx_INCREF(((PyObject *)__pyx_n_s__probability)); PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__probability)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__probability)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
127:
128: plt.subplot(222)
/* "vision/alearn/linear.pyx":128 * plt.title("probability") * * plt.subplot(222) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dlinearim.transpose() / normalizer) */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__subplot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "vision/alearn/linear.pyx":128 * plt.title("probability") * * plt.subplot(222) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dlinearim.transpose() / normalizer) */ __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); __Pyx_INCREF(__pyx_int_222); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, __pyx_int_222); __Pyx_GIVEREF(__pyx_int_222); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
129: plt.set_cmap("gray")
/* "vision/alearn/linear.pyx":129 * * plt.subplot(222) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dlinearim.transpose() / normalizer) * plt.title("linear diff") */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__set_cmap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "vision/alearn/linear.pyx":129 * * plt.subplot(222) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dlinearim.transpose() / normalizer) * plt.title("linear diff") */ __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); __Pyx_INCREF(((PyObject *)__pyx_n_s__gray)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
130: plt.imshow(dlinearim.transpose() / normalizer)
/* "vision/alearn/linear.pyx":130 * plt.subplot(222) * plt.set_cmap("gray") * plt.imshow(dlinearim.transpose() / normalizer) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.title("linear diff") * */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__imshow); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_dlinearim), __pyx_n_s__transpose); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(__pyx_v_normalizer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); 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_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), 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_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
131: plt.title("linear diff")
/* "vision/alearn/linear.pyx":131 * plt.set_cmap("gray") * plt.imshow(dlinearim.transpose() / normalizer) * plt.title("linear diff") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(223) */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__title); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "vision/alearn/linear.pyx":131 * plt.set_cmap("gray") * plt.imshow(dlinearim.transpose() / normalizer) * plt.title("linear diff") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(223) */ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
132:
133: plt.subplot(223)
/* "vision/alearn/linear.pyx":133 * plt.title("linear diff") * * plt.subplot(223) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dscoreim.transpose() / normalizer) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__subplot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "vision/alearn/linear.pyx":133 * plt.title("linear diff") * * plt.subplot(223) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.set_cmap("gray") * plt.imshow(dscoreim.transpose() / normalizer) */ __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); __Pyx_INCREF(__pyx_int_223); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, __pyx_int_223); __Pyx_GIVEREF(__pyx_int_223); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
134: plt.set_cmap("gray")
/* "vision/alearn/linear.pyx":134 * * plt.subplot(223) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dscoreim.transpose() / normalizer) * plt.title("expected reduction") */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__set_cmap); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "vision/alearn/linear.pyx":134 * * plt.subplot(223) * plt.set_cmap("gray") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(dscoreim.transpose() / normalizer) * plt.title("expected reduction") */ __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); __Pyx_INCREF(((PyObject *)__pyx_n_s__gray)); PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gray)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
135: plt.imshow(dscoreim.transpose() / normalizer)
/* "vision/alearn/linear.pyx":135 * plt.subplot(223) * plt.set_cmap("gray") * plt.imshow(dscoreim.transpose() / normalizer) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.title("expected reduction") * */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__imshow); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_dscoreim), __pyx_n_s__transpose); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyFloat_FromDouble(__pyx_v_normalizer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
136: plt.title("expected reduction")
/* "vision/alearn/linear.pyx":136 * plt.set_cmap("gray") * plt.imshow(dscoreim.transpose() / normalizer) * plt.title("expected reduction") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(224) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__title); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "vision/alearn/linear.pyx":136 * plt.set_cmap("gray") * plt.imshow(dscoreim.transpose() / normalizer) * plt.title("expected reduction") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * plt.subplot(224) */ __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
137:
138: plt.subplot(224)
/* "vision/alearn/linear.pyx":138 * plt.title("expected reduction") * * plt.subplot(224) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(numpy.asarray(im)) * plt.title("data") */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__subplot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_26), NULL); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "vision/alearn/linear.pyx":138 * plt.title("expected reduction") * * plt.subplot(224) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.imshow(numpy.asarray(im)) * plt.title("data") */ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); __Pyx_INCREF(__pyx_int_224); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, __pyx_int_224); __Pyx_GIVEREF(__pyx_int_224); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
139: plt.imshow(numpy.asarray(im))
/* "vision/alearn/linear.pyx":139 * * plt.subplot(224) * plt.imshow(numpy.asarray(im)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.title("data") * plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame)) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__imshow); 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_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__asarray); 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_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); __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 = 139; __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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
140: plt.title("data")
/* "vision/alearn/linear.pyx":140 * plt.subplot(224) * plt.imshow(numpy.asarray(im)) * plt.title("data") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame)) * plt.clf() */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__title); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "vision/alearn/linear.pyx":140 * plt.subplot(224) * plt.imshow(numpy.asarray(im)) * plt.title("data") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame)) * plt.clf() */ __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
141: plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame))
/* "vision/alearn/linear.pyx":141 * plt.imshow(numpy.asarray(im)) * plt.title("data") * plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* plt.clf() * */ __pyx_t_7 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__savefig); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_28), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_linearbox->frame); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_plot); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_plot); __Pyx_GIVEREF(__pyx_v_plot); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
142: plt.clf()
/* "vision/alearn/linear.pyx":142 * plt.title("data") * plt.savefig("{0}/prob{1}.png".format(plot, linearbox.frame)) * plt.clf() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * return score / (normalizer * framearea) */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_plt, __pyx_n_s__clf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L14; } __pyx_L14:;
143:
144: return score / (normalizer * framearea)
/* "vision/alearn/linear.pyx":144 * plt.clf() * * return score / (normalizer * framearea) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
*/ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble((__pyx_v_score / (__pyx_v_normalizer * __pyx_v_framearea))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dlinearim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dscoreim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_costim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dprobim); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.alearn.linear.score_frame", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dlinearim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dscoreim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_costim); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dprobim); __pyx_L2:; __Pyx_XDECREF(__pyx_v_im); __Pyx_XDECREF((PyObject *)__pyx_v_costim); __Pyx_XDECREF((PyObject *)__pyx_v_dlinearim); __Pyx_XDECREF((PyObject *)__pyx_v_dprobim); __Pyx_XDECREF((PyObject *)__pyx_v_dscoreim); __Pyx_XDECREF(__pyx_v_plt); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }