From 09f06cb632241cf444fe5aebfb7d0ca887f829a8 Mon Sep 17 00:00:00 2001 From: foefl Date: Thu, 23 Oct 2025 11:49:09 +0200 Subject: [PATCH] remove setuptools hook, closes #5 --- pdm_build.py | 12 - src/dopt_sensor_anomalies/detection.c | 2929 ++++++++++++------------- 2 files changed, 1441 insertions(+), 1500 deletions(-) diff --git a/pdm_build.py b/pdm_build.py index 76be076..3a56586 100644 --- a/pdm_build.py +++ b/pdm_build.py @@ -2,24 +2,12 @@ import re import zipfile from pathlib import Path -from Cython.Build import cythonize - -ext_modules = cythonize(["src/dopt_sensor_anomalies/detection.py"]) - def pdm_build_initialize(context): context.ensure_build_dir() -def pdm_build_update_setup_kwargs(context, setup_kwargs): - setup_kwargs.update( - ext_modules=ext_modules, - ) - - def pdm_build_finalize(context, artifact): - print(">>>>>> Context: ", context) - print(">>>>>> Artifact: ", artifact) pth_artifact = Path(artifact) if pth_artifact.suffix == ".whl": diff --git a/src/dopt_sensor_anomalies/detection.c b/src/dopt_sensor_anomalies/detection.c index 3a2666b..7ffbcf8 100644 --- a/src/dopt_sensor_anomalies/detection.c +++ b/src/dopt_sensor_anomalies/detection.c @@ -1523,7 +1523,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr struct __pyx_ctuple_double__and_double; typedef struct __pyx_ctuple_double__and_double __pyx_ctuple_double__and_double; -/* "dopt_sensor_anomalies/detection.py":41 +/* "dopt_sensor_anomalies/detection.py":35 * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: # <<<<<<<<<<<<<< @@ -1535,9 +1535,9 @@ struct __pyx_ctuple_double__and_double { double f1; }; -/* "dopt_sensor_anomalies/detection.py":65 +/* "dopt_sensor_anomalies/detection.py":55 + * * - * # ** main function * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, @@ -1548,9 +1548,9 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_ }; -/* "dopt_sensor_anomalies/detection.py":97 +/* "dopt_sensor_anomalies/detection.py":84 + * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] - * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< * if not is_sorted: * raise errors.ContourCalculationError( @@ -1566,8 +1566,8 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr }; -/* "dopt_sensor_anomalies/detection.py":137 - * # check for redundancy +/* "dopt_sensor_anomalies/detection.py":112 + * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) @@ -1581,9 +1581,9 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr }; -/* "dopt_sensor_anomalies/detection.py":172 +/* "dopt_sensor_anomalies/detection.py":143 + * ) * - * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -1597,8 +1597,8 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr }; -/* "dopt_sensor_anomalies/detection.py":173 - * # identify left and right sensor areas +/* "dopt_sensor_anomalies/detection.py":144 + * * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -1613,7 +1613,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr }; -/* "dopt_sensor_anomalies/detection.py":174 +/* "dopt_sensor_anomalies/detection.py":145 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -1629,7 +1629,7 @@ struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr }; -/* "dopt_sensor_anomalies/detection.py":175 +/* "dopt_sensor_anomalies/detection.py":146 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -3032,13 +3032,12 @@ static const char __pyx_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a[] = "\200\001\340\023\024\3 static const char __pyx_k_Image_could_not_be_read_from[] = "Image could not be read from: >"; static const char __pyx_k_measure_length_locals_genexpr[] = "measure_length..genexpr"; static const char __pyx_k_tuple_t_CsvData_t_SensorImages[] = "tuple[t.CsvData, t.SensorImages]"; -static const char __pyx_k_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX[] = "\200\001\330\013\014\330\013\014\330\005\006\330\004\023\2205\230\007\230q\240\n\250%\250u\260M\300\030\310\021\330\004\t\210\023\210A\210Q\340\004\020\220\003\2209\230A\230W\240C\240q\330\004\020\220\005\220Z\230q\240\001\330\004\020\220\t\230\030\240\021\240!\330\004\017\210r\220\026\220q\230\n\240'\250\021\250\"\250J\260b\270\001\330\004\023\2205\230\013\2401\240I\250X\260Q\260c\270\023\270A\340\004\023\220<\230z\250\021\250!\330\004\023\220<\230s\240!\2401\340\004\t\210\025\210a\330\t\016\210h\220a\330\010\021\220\025\220a\220q\340\004\024\220F\230+\240U\250!\330\004\024\220F\230+\240U\250!\330\004\022\220&\230\014\240H\250B\250d\260\"\260F\270!\360\006\000\005\016\210R\210v\220Q\220a\330\004\032\230#\230W\240A\240^\2606\270\026\270q\300\004\300F\310&\320PQ\320QR\340\004\013\2101\320\014\034\230A\330\010\014\210A\330\010\034\230A\330\010\026\220a\330\010\026\220a"; -static const char __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7[] = "\200\001\330\016\017\330\031\032\330\031\032\330\005\006\330\004 \240\001\330\004\014\210C\210w\220a\220s\230!\2301\330\004\007\200v\210S\220\001\330\010\016\210f\320\024&\240a\240r\320)L\310A\340\004\016\210e\2201\220D\230\006\230f\240E\250\026\250q\260\003\2602\260Q\330\004\013\2107\220%\220q\340\004\013\2103\210i\220q\230\t\240\023\240A\330\004\007\200y\220\003\220:\230Q\230f\240E\250\037\270\005\270S\300\001\340\004\r\210S\320\020&\240a\240s\250.\270\003\2701\330\004\r\210S\220\r\230Q\230h\240c\250\036\260q\330\004\014\210C\210v\220Q\220h\230d\240!\340\004\013\2103\210m\2301\230E\240\025\240d\250#\250\\\270\023\270A\330\004\013\2107\220.\240\001\240\021\330\004\007\200u\210C\210q\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\013\210$\210h\220n\240A\240Q\360\006\000\005\020\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\340\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\010\000\005#\240!\330\004\037\230q\360\006\000\005\t\210\005\210Q\340\010\017\210t\2201\220A\220V\2303\230l\250!\2501\360\006\000\t\017\210c\220\032\2301\230A\330\010\016\210b\220\006\220a\220u\230F\240\"\240A\340\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\360\006\000\n\016\210T\220\024\220V\2301\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\340\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\360\006\000\t\016\210T\220\032\2302\230W\240I\250W\260A\330\010\r\210T\220\032\2302\230W\240I\250W\260A\360\006\000\t\014\2103\210b\220\004\220C\220s\230\"\230A\330\014\r\360\006\000\t\033\230!\330 !\340\010\013\2101\330\014\r\360\006\000\t\027\220g\230Q\230a\330\010\025\220W\230A\230Q\360\006\000\t\020\210s\220\"\220A\330\010\017\210s\220\"\220A\340\010\020\220\007\220q\330\014\r\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220e\2302\230W\240H\250A\250U\260!\360\010\000\005\010\200t\2101\330\010\016""\210f\320\024,\250A\330\014\r\360\010\000\005\024\2203\220a\220q\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\016\210a\330\016*\320*E\300U\310!\360\010\000\005\r\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\340\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\017\320\017!\240\022\2403\240b\320(:\270\"\320\270f\300A"; -static const char __pyx_k_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9[] = "\200\001\330\016\017\330\026\027\330\016\017\330\023\024\330\005\006\330\004\020\220\010\230\001\330\004\022\220(\230!\360\006\000\005\r\210I\220Q\330\010\021\220\025\220k\240\027\250\005\250Y\3206M\310U\320RS\360\006\000\005\010\200w\210c\220\031\230!\2303\230c\240\031\250$\250a\340\004\010\210\004\210F\220*\230I\240Q\240m\2606\270\021\340\010\020\220\004\220A\220S\230\010\240\001\240\022\2409\250A\330\010\025\220U\230%\230q\320 0\260\001\260\021\330\010\r\320\r\035\230Q\230j\250\001\250\021\340\010\021\220\033\230A\230W\240A\330\010\020\220\007\220q\230\001\230\023\230A\230V\2401\340\010\r\210T\220\021\220!\330\010\n\210%\210q\220\001\330\010\n\210'\220\021\220'\230\026\230q\330\010\n\210'\220\021\220&\320\030.\250e\2607\270&\300\001\340\004\007\320\007\027\220q\230\007\230s\240'\250\021\330\004\007\200x\210q\330\t\025\220R\220r\230\024\230[\250\005\250Q\330\010\024\220A\330\010\023\2201\340\004\007\200v\210Q\340\004\t\210\031\220!\2201\220A\330\004\006\200g\210Q\330\t\025\220R\220r\230\024\230Q\330\010\r\210Q\330\010\016\210a\330\010\017\210q\330\010\020\220\003\2201\330\010\014\210A"; +static const char __pyx_k_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX[] = "\200\001\330\013\014\330\013\014\330\005\006\330\004\023\2205\230\007\230q\240\n\250%\250u\260M\300\030\310\021\330\004\t\210\023\210A\210Q\340\004\020\220\003\2209\230A\230W\240C\240q\330\004\020\220\005\220Z\230q\240\001\330\004\020\220\t\230\030\240\021\240!\330\004\017\210r\220\026\220q\230\n\240'\250\021\250\"\250J\260b\270\001\330\004\023\2205\230\013\2401\240I\250X\260Q\260c\270\023\270A\340\004\023\220<\230z\250\021\250!\330\004\023\220<\230s\240!\2401\340\004\t\210\025\210a\330\t\016\210h\220a\330\010\021\220\025\220a\220q\340\004\024\220F\230+\240U\250!\330\004\024\220F\230+\240U\250!\330\004\022\220&\230\014\240H\250B\250d\260\"\260F\270!\340\004\r\210R\210v\220Q\220a\330\004\032\230#\230W\240A\240^\2606\270\026\270q\300\004\300F\310&\320PQ\320QR\340\004\013\2101\320\014\034\230A\330\010\014\210A\330\010\034\230A\330\010\026\220a\330\010\026\220a"; +static const char __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7[] = "\200\001\330\016\017\330\031\032\330\031\032\330\005\006\330\004 \240\001\330\004\014\210C\210w\220a\220s\230!\2301\330\004\007\200v\210S\220\001\330\010\016\210f\320\024&\240a\240r\320)L\310A\340\004\016\210e\2201\220D\230\006\230f\240E\250\026\250q\260\003\2602\260Q\330\004\013\2107\220%\220q\340\004\013\2103\210i\220q\230\t\240\023\240A\330\004\007\200y\220\003\220:\230Q\230f\240E\250\037\270\005\270S\300\001\340\004\r\210S\320\020&\240a\240s\250.\270\003\2701\330\004\r\210S\220\r\230Q\230h\240c\250\036\260q\330\004\014\210C\210v\220Q\220h\230d\240!\340\004\013\2103\210m\2301\230E\240\025\240d\250#\250\\\270\023\270A\330\004\013\2107\220.\240\001\240\021\330\004\007\200u\210C\210q\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\013\210$\210h\220n\240A\240Q\330\004\017\210q\220\003\220=\240\001\240\022\2401\240C\240t\2505\260\001\330\004\020\220\002\220$\220d\230!\330\004\007\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005#\240!\330\004\037\230q\340\004\010\210\005\210Q\330\010\017\210t\2201\220A\220V\2303\230l\250!\2501\330\010\016\210c\220\032\2301\230A\330\010\016\210b\220\006\220a\220u\230F\240\"\240A\330\010\016\210d\220!\2203\220h\230a\230r\240\033\250K\260}\300A\300Q\340\t\r\210T\220\024\220V\2301\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\330\t\020\220\t\230\030\240\021\240$\240a\340\010\r\210T\220\032\2302\230W\240I\250W\260A\330\010\r\210T\220\032\2302\230W\240I\250W\260A\340\010\013\2103\210b\220\004\220C\220s\230\"\230A\330\014\r\340\010\032\230!\330 !\340\010\013\2101\330\014\r\340\010\026\220g\230Q\230a\330\010\025\220W\230A\230Q\340\010\017\210s\220\"\220A\330\010\017\210s\220\"\220A\340\010\020\220\007\220q\330\014\r\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220g\230X\240Q\240e\2501\330\022\026\220e\2302\230W\240H\250A\250U\260!\360\010\000\005\010\200t\2101\330\010\016\210f\320\024,\250A\330\014\r\360\006\000\005\024\2203\220a\220q""\330\004\007\200}\220C\220u\230A\330\010\016\210f\320\024*\250!\330\014\016\210a\330\016*\320*E\300U\310!\360\006\000\005\r\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\330\004\014\210C\210w\320\026;\2702\270Q\340\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\030\230\003\2301\230M\250\021\250\"\250D\260\003\2601\330\004\017\320\017!\240\022\2403\240b\320(:\270\"\320\270f\300A"; +static const char __pyx_k_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9[] = "\200\001\330\016\017\330\026\027\330\016\017\330\023\024\330\005\006\330\004\020\220\010\230\001\330\004\022\220(\230!\340\004\014\210I\220Q\330\010\021\220\025\220k\240\027\250\005\250Y\3206M\310U\320RS\340\004\007\200w\210c\220\031\230!\2303\230c\240\031\250$\250a\340\004\010\210\004\210F\220*\230I\240Q\240m\2606\270\021\330\010\020\220\004\220A\220S\230\010\240\001\240\022\2409\250A\330\010\025\220U\230%\230q\320 0\260\001\260\021\330\010\r\320\r\035\230Q\230j\250\001\250\021\340\010\021\220\033\230A\230W\240A\330\010\020\220\007\220q\230\001\230\023\230A\230V\2401\340\010\r\210T\220\021\220!\330\010\n\210%\210q\220\001\330\010\n\210'\220\021\220'\230\026\230q\330\010\n\210'\220\021\220&\320\030.\250e\2607\270&\300\001\340\004\007\320\007\027\220q\230\007\230s\240'\250\021\330\004\007\200x\210q\330\t\025\220R\220r\230\024\230[\250\005\250Q\330\010\024\220A\330\010\023\2201\340\004\007\200v\210Q\340\004\t\210\031\220!\2201\220A\330\004\006\200g\210Q\330\t\025\220R\220r\230\024\230Q\330\010\r\210Q\330\010\016\210a\330\010\017\210q\330\010\020\220\003\2201\330\010\014\210A"; static const char __pyx_k_dopt_sensor_anomalies_detection[] = "dopt_sensor_anomalies.detection"; static const char __pyx_k_huggingface_hub_cache_system_us[] = ".*huggingface_hub.*cache-system uses symlinks.*"; -static const char __pyx_k_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU[] = "\200\001\330\013\014\330\013\014\330\004\017\210q\330\005\006\340\004\010\210\004\210D\220\001\330\004\010\210\004\210D\220\001\360\006\000\005\020\210q\220\001\330\004\017\210q\220\001\340\004\022\220$\220a\220w\230b\240\007\240u\250A\250R\250v\260Q\260d\270\"\270B\270f\300A\300Q\330\004\020\220\004\220A\220W\230B\230g\240U\250!\2502\250V\2601\260D\270\002\270\"\270F\300!\3001\340\004\013\2104\210q\220\014\230B\230j\250\004\250J\260b\270\001"; -static const char __pyx_k_C_Users_demon_Documents_EKF_Anal[] = "C:\\Users\\demon\\Documents\\EKF\\Analyse_fuer_Florian\\bild2.bmp"; +static const char __pyx_k_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU[] = "\200\001\330\013\014\330\013\014\330\004\017\210q\330\005\006\330\004\010\210\004\210D\220\001\330\004\010\210\004\210D\220\001\330\004\017\210q\220\001\330\004\017\210q\220\001\340\004\022\220$\220a\220w\230b\240\007\240u\250A\250R\250v\260Q\260d\270\"\270B\270f\300A\300Q\330\004\020\220\004\220A\220W\230B\230g\240U\250!\2502\250V\2601\260D\270\002\270\"\270F\300!\3001\340\004\013\2104\210q\220\014\230B\230j\250\004\250J\260b\270\001"; static const char __pyx_k_Contour_detection_not_valid_cont[] = "Contour detection not valid: contours are not properly sorted from left to right."; static const char __pyx_k_Contour_detection_not_valid_no_c[] = "Contour detection not valid: no contours recognized"; static const char __pyx_k_No_contours_were_found_in_the_pr[] = "No contours were found in the provided image. Can not continue analysis."; @@ -3123,11 +3122,10 @@ typedef struct { PyObject *__pyx_slice[2]; PyObject *__pyx_tuple[10]; PyObject *__pyx_codeobj_tab[12]; - PyObject *__pyx_string_tab[311]; + PyObject *__pyx_string_tab[310]; PyObject *__pyx_float_0_5; PyObject *__pyx_float_0_8; PyObject *__pyx_float_2_0; - PyObject *__pyx_float_0_251; PyObject *__pyx_float_255_0; PyObject *__pyx_int_0; PyObject *__pyx_int_1; @@ -3227,308 +3225,307 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_n_u_CHAIN_APPROX_SIMPLE __pyx_string_tab[6] #define __pyx_n_u_COLOR_BGR2GRAY __pyx_string_tab[7] #define __pyx_n_u_COLOR_BGR2RGB __pyx_string_tab[8] -#define __pyx_kp_u_C_Users_demon_Documents_EKF_Anal __pyx_string_tab[9] -#define __pyx_n_u_Canny __pyx_string_tab[10] -#define __pyx_n_u_ContourCalculationError __pyx_string_tab[11] -#define __pyx_kp_u_Contour_detection_not_valid_cont __pyx_string_tab[12] -#define __pyx_kp_u_Contour_detection_not_valid_no_c __pyx_string_tab[13] -#define __pyx_n_u_DETECTION_MODELS __pyx_string_tab[14] -#define __pyx_n_u_DataFrame __pyx_string_tab[15] -#define __pyx_n_u_FileNotFoundError __pyx_string_tab[16] -#define __pyx_n_u_Final __pyx_string_tab[17] -#define __pyx_n_u_HEATMAP_FILENAME_SUFFIX __pyx_string_tab[18] -#define __pyx_n_u_Image __pyx_string_tab[19] -#define __pyx_n_u_ImageNotReadError __pyx_string_tab[20] -#define __pyx_kp_u_Image_could_not_be_read_from __pyx_string_tab[21] -#define __pyx_n_u_InferenceResult __pyx_string_tab[22] -#define __pyx_n_u_InvalidElectrodeCount __pyx_string_tab[23] -#define __pyx_n_u_LAYERS __pyx_string_tab[24] -#define __pyx_n_u_MODEL_FOLDER __pyx_string_tab[25] -#define __pyx_n_u_MORPH_CLOSE __pyx_string_tab[26] -#define __pyx_n_u_MORPH_RECT __pyx_string_tab[27] -#define __pyx_n_u_NDArray __pyx_string_tab[28] -#define __pyx_n_u_NUM_VALID_ELECTRODES __pyx_string_tab[29] -#define __pyx_kp_u_No_contours_were_found_in_the_pr __pyx_string_tab[30] -#define __pyx_n_u_None __pyx_string_tab[31] -#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[32] -#define __pyx_kp_u_Number_of_counted_electrodes_doe __pyx_string_tab[33] -#define __pyx_n_u_PIL __pyx_string_tab[34] -#define __pyx_n_u_Patchcore __pyx_string_tab[35] -#define __pyx_n_u_Path __pyx_string_tab[36] -#define __pyx_n_u_QUOTE_NONE __pyx_string_tab[37] -#define __pyx_n_u_RATIO __pyx_string_tab[38] -#define __pyx_n_u_RETR_TREE __pyx_string_tab[39] -#define __pyx_n_u_RGB __pyx_string_tab[40] -#define __pyx_n_u_SensorImages __pyx_string_tab[41] -#define __pyx_n_u_THRESHOLD_BW __pyx_string_tab[42] -#define __pyx_n_u_THRESH_BINARY __pyx_string_tab[43] -#define __pyx_kp_u_The_provided_path_seems_not_to_e __pyx_string_tab[44] -#define __pyx_n_u_UserWarning __pyx_string_tab[45] -#define __pyx_kp_u__2 __pyx_string_tab[46] -#define __pyx_kp_u__3 __pyx_string_tab[47] -#define __pyx_kp_u__4 __pyx_string_tab[48] -#define __pyx_kp_u__5 __pyx_string_tab[49] -#define __pyx_n_u__8 __pyx_string_tab[50] -#define __pyx_n_u_accepted_boxes __pyx_string_tab[51] -#define __pyx_kp_u_add_note __pyx_string_tab[52] -#define __pyx_n_u_all __pyx_string_tab[53] -#define __pyx_n_u_alpha __pyx_string_tab[54] -#define __pyx_n_u_anomalib_models __pyx_string_tab[55] -#define __pyx_n_u_anomaly_detection __pyx_string_tab[56] -#define __pyx_n_u_anomaly_label __pyx_string_tab[57] -#define __pyx_n_u_anomaly_map __pyx_string_tab[58] -#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[59] -#define __pyx_n_u_anomaly_score __pyx_string_tab[60] -#define __pyx_n_u_array __pyx_string_tab[61] -#define __pyx_n_u_astype __pyx_string_tab[62] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[63] -#define __pyx_n_u_ax __pyx_string_tab[64] -#define __pyx_n_u_axes __pyx_string_tab[65] -#define __pyx_n_u_axis __pyx_string_tab[66] -#define __pyx_n_u_backbone __pyx_string_tab[67] -#define __pyx_n_u_bbox_inches __pyx_string_tab[68] -#define __pyx_n_u_binary __pyx_string_tab[69] -#define __pyx_n_u_bl __pyx_string_tab[70] -#define __pyx_n_u_blbrX __pyx_string_tab[71] -#define __pyx_n_u_blbrY __pyx_string_tab[72] -#define __pyx_n_u_bool __pyx_string_tab[73] -#define __pyx_n_u_boundingRect __pyx_string_tab[74] -#define __pyx_n_u_box __pyx_string_tab[75] -#define __pyx_n_u_boxPoints __pyx_string_tab[76] -#define __pyx_n_u_box_1 __pyx_string_tab[77] -#define __pyx_n_u_box_2 __pyx_string_tab[78] -#define __pyx_n_u_br __pyx_string_tab[79] -#define __pyx_n_u_c __pyx_string_tab[80] -#define __pyx_n_u_c1 __pyx_string_tab[81] -#define __pyx_n_u_c2 __pyx_string_tab[82] -#define __pyx_n_u_cast __pyx_string_tab[83] -#define __pyx_n_u_category __pyx_string_tab[84] -#define __pyx_n_u_center_dist __pyx_string_tab[85] -#define __pyx_n_u_check_box_redundancy __pyx_string_tab[86] -#define __pyx_n_u_checkpoint __pyx_string_tab[87] -#define __pyx_n_u_class_getitem __pyx_string_tab[88] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[89] -#define __pyx_n_u_close __pyx_string_tab[90] -#define __pyx_n_u_closed __pyx_string_tab[91] -#define __pyx_n_u_cmap __pyx_string_tab[92] -#define __pyx_n_u_cnts __pyx_string_tab[93] -#define __pyx_n_u_const __pyx_string_tab[94] -#define __pyx_n_u_constants __pyx_string_tab[95] -#define __pyx_n_u_contours __pyx_string_tab[96] -#define __pyx_n_u_convert __pyx_string_tab[97] -#define __pyx_n_u_copy __pyx_string_tab[98] -#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[99] -#define __pyx_n_u_cpu __pyx_string_tab[100] -#define __pyx_n_u_cropped __pyx_string_tab[101] -#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[102] -#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[103] -#define __pyx_kp_u_csv __pyx_string_tab[104] -#define __pyx_n_u_csv_2 __pyx_string_tab[105] -#define __pyx_n_u_cuda __pyx_string_tab[106] -#define __pyx_n_u_cv2 __pyx_string_tab[107] -#define __pyx_n_u_cvtColor __pyx_string_tab[108] -#define __pyx_n_u_dA __pyx_string_tab[109] -#define __pyx_n_u_dB __pyx_string_tab[110] -#define __pyx_n_u_data_csv __pyx_string_tab[111] -#define __pyx_n_u_detection_models __pyx_string_tab[112] -#define __pyx_n_u_device __pyx_string_tab[113] -#define __pyx_n_u_df __pyx_string_tab[114] -#define __pyx_n_u_dimA __pyx_string_tab[115] -#define __pyx_n_u_dimB __pyx_string_tab[116] -#define __pyx_kp_u_disable __pyx_string_tab[117] -#define __pyx_n_u_dist __pyx_string_tab[118] -#define __pyx_n_u_distance __pyx_string_tab[119] -#define __pyx_n_u_dopt_basics __pyx_string_tab[120] -#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[121] -#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[122] -#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[123] -#define __pyx_n_u_dtype __pyx_string_tab[124] -#define __pyx_n_u_edged __pyx_string_tab[125] -#define __pyx_kp_u_enable __pyx_string_tab[126] -#define __pyx_n_u_enter __pyx_string_tab[127] -#define __pyx_n_u_enumerate __pyx_string_tab[128] -#define __pyx_n_u_errors __pyx_string_tab[129] -#define __pyx_n_u_euclidean __pyx_string_tab[130] -#define __pyx_n_u_eval __pyx_string_tab[131] -#define __pyx_n_u_existing __pyx_string_tab[132] -#define __pyx_n_u_exists __pyx_string_tab[133] -#define __pyx_n_u_exit __pyx_string_tab[134] -#define __pyx_kp_u_expected __pyx_string_tab[135] -#define __pyx_n_u_extend __pyx_string_tab[136] -#define __pyx_n_u_figsize __pyx_string_tab[137] -#define __pyx_n_u_file_path __pyx_string_tab[138] -#define __pyx_n_u_file_stem __pyx_string_tab[139] -#define __pyx_n_u_filtered_cnts __pyx_string_tab[140] -#define __pyx_n_u_filterwarnings __pyx_string_tab[141] -#define __pyx_n_u_findContours __pyx_string_tab[142] -#define __pyx_n_u_find_paths __pyx_string_tab[143] -#define __pyx_n_u_float __pyx_string_tab[144] -#define __pyx_n_u_float32 __pyx_string_tab[145] -#define __pyx_n_u_folder_path __pyx_string_tab[146] -#define __pyx_n_u_from_numpy __pyx_string_tab[147] -#define __pyx_n_u_fromarray __pyx_string_tab[148] -#define __pyx_n_u_func __pyx_string_tab[149] -#define __pyx_kp_u_gc __pyx_string_tab[150] -#define __pyx_n_u_genexpr __pyx_string_tab[151] -#define __pyx_n_u_getStructuringElement __pyx_string_tab[152] -#define __pyx_n_u_get_detection_models __pyx_string_tab[153] -#define __pyx_n_u_get_model_folder __pyx_string_tab[154] -#define __pyx_n_u_grab_contours __pyx_string_tab[155] -#define __pyx_n_u_gray __pyx_string_tab[156] -#define __pyx_n_u_header __pyx_string_tab[157] -#define __pyx_n_u_hspace __pyx_string_tab[158] -#define __pyx_kp_u_huggingface_hub_cache_system_us __pyx_string_tab[159] -#define __pyx_n_u_i __pyx_string_tab[160] -#define __pyx_n_u_ignore __pyx_string_tab[161] -#define __pyx_n_u_image __pyx_string_tab[162] -#define __pyx_n_u_image_np __pyx_string_tab[163] -#define __pyx_n_u_image_rgb __pyx_string_tab[164] -#define __pyx_n_u_img __pyx_string_tab[165] -#define __pyx_n_u_img_np __pyx_string_tab[166] -#define __pyx_n_u_img_path __pyx_string_tab[167] -#define __pyx_n_u_imread __pyx_string_tab[168] -#define __pyx_n_u_imshow __pyx_string_tab[169] -#define __pyx_n_u_imutils __pyx_string_tab[170] -#define __pyx_n_u_index __pyx_string_tab[171] -#define __pyx_n_u_infer_image __pyx_string_tab[172] -#define __pyx_n_u_initializing __pyx_string_tab[173] -#define __pyx_n_u_input_tensor __pyx_string_tab[174] -#define __pyx_n_u_int32 __pyx_string_tab[175] -#define __pyx_n_u_is_available __pyx_string_tab[176] -#define __pyx_n_u_is_coroutine __pyx_string_tab[177] -#define __pyx_n_u_is_duplicate __pyx_string_tab[178] -#define __pyx_n_u_is_sorted __pyx_string_tab[179] -#define __pyx_kp_u_isenabled __pyx_string_tab[180] -#define __pyx_n_u_item __pyx_string_tab[181] -#define __pyx_n_u_items __pyx_string_tab[182] -#define __pyx_n_u_jet __pyx_string_tab[183] -#define __pyx_n_u_kernel __pyx_string_tab[184] -#define __pyx_n_u_layers __pyx_string_tab[185] -#define __pyx_n_u_left __pyx_string_tab[186] -#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[187] -#define __pyx_n_u_linalg __pyx_string_tab[188] -#define __pyx_n_u_load __pyx_string_tab[189] -#define __pyx_n_u_load_state_dict __pyx_string_tab[190] -#define __pyx_n_u_main __pyx_string_tab[191] -#define __pyx_n_u_matplotlib __pyx_string_tab[192] -#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[193] -#define __pyx_n_u_max __pyx_string_tab[194] -#define __pyx_n_u_measure_length __pyx_string_tab[195] -#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[196] -#define __pyx_n_u_message __pyx_string_tab[197] -#define __pyx_n_u_midpoint __pyx_string_tab[198] -#define __pyx_n_u_min __pyx_string_tab[199] -#define __pyx_n_u_minAreaRect __pyx_string_tab[200] -#define __pyx_n_u_mode __pyx_string_tab[201] -#define __pyx_n_u_model __pyx_string_tab[202] -#define __pyx_n_u_model_state_dict __pyx_string_tab[203] -#define __pyx_n_u_module __pyx_string_tab[204] -#define __pyx_n_u_morphologyEx __pyx_string_tab[205] -#define __pyx_n_u_name __pyx_string_tab[206] -#define __pyx_n_u_next __pyx_string_tab[207] -#define __pyx_n_u_no_grad __pyx_string_tab[208] -#define __pyx_n_u_norm __pyx_string_tab[209] -#define __pyx_n_u_np __pyx_string_tab[210] -#define __pyx_n_u_npt __pyx_string_tab[211] -#define __pyx_kp_u_npt_NDArray_np_floating __pyx_string_tab[212] -#define __pyx_kp_u_npt_NDArray_np_uint8 __pyx_string_tab[213] -#define __pyx_n_u_num_contours __pyx_string_tab[214] -#define __pyx_n_u_numpy __pyx_string_tab[215] -#define __pyx_n_u_numpy_typing __pyx_string_tab[216] -#define __pyx_n_u_off __pyx_string_tab[217] -#define __pyx_n_u_order_points __pyx_string_tab[218] -#define __pyx_n_u_orig __pyx_string_tab[219] -#define __pyx_n_u_output __pyx_string_tab[220] -#define __pyx_n_u_pad_inches __pyx_string_tab[221] -#define __pyx_n_u_pandas __pyx_string_tab[222] -#define __pyx_n_u_parent __pyx_string_tab[223] -#define __pyx_n_u_pathlib __pyx_string_tab[224] -#define __pyx_n_u_permute __pyx_string_tab[225] -#define __pyx_n_u_perspective __pyx_string_tab[226] -#define __pyx_n_u_pil_image __pyx_string_tab[227] -#define __pyx_n_u_pipeline __pyx_string_tab[228] -#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[229] -#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[230] -#define __pyx_n_u_plt __pyx_string_tab[231] -#define __pyx_kp_u_png __pyx_string_tab[232] -#define __pyx_n_u_pop __pyx_string_tab[233] -#define __pyx_n_u_pred_label __pyx_string_tab[234] -#define __pyx_n_u_pred_score __pyx_string_tab[235] -#define __pyx_n_u_pt_A __pyx_string_tab[236] -#define __pyx_n_u_pt_B __pyx_string_tab[237] -#define __pyx_n_u_pyplot __pyx_string_tab[238] -#define __pyx_n_u_qualname __pyx_string_tab[239] -#define __pyx_n_u_quoting __pyx_string_tab[240] -#define __pyx_n_u_rbox __pyx_string_tab[241] -#define __pyx_n_u_resize __pyx_string_tab[242] -#define __pyx_n_u_result __pyx_string_tab[243] -#define __pyx_n_u_result_pattern __pyx_string_tab[244] -#define __pyx_n_u_return __pyx_string_tab[245] -#define __pyx_n_u_right __pyx_string_tab[246] -#define __pyx_n_u_rightmost_x_third __pyx_string_tab[247] -#define __pyx_n_u_s1 __pyx_string_tab[248] -#define __pyx_n_u_s2 __pyx_string_tab[249] -#define __pyx_n_u_savefig __pyx_string_tab[250] -#define __pyx_n_u_scipy_spatial __pyx_string_tab[251] -#define __pyx_n_u_send __pyx_string_tab[252] -#define __pyx_n_u_sensor_images __pyx_string_tab[253] -#define __pyx_n_u_sep __pyx_string_tab[254] -#define __pyx_n_u_set_name __pyx_string_tab[255] -#define __pyx_n_u_shape __pyx_string_tab[256] -#define __pyx_n_u_side __pyx_string_tab[257] -#define __pyx_n_u_size_diff __pyx_string_tab[258] -#define __pyx_n_u_sort_contours __pyx_string_tab[259] -#define __pyx_n_u_spec __pyx_string_tab[260] -#define __pyx_n_u_squeeze __pyx_string_tab[261] -#define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[262] -#define __pyx_n_u_stem __pyx_string_tab[263] -#define __pyx_n_u_str __pyx_string_tab[264] -#define __pyx_n_u_subplots __pyx_string_tab[265] -#define __pyx_n_u_subplots_adjust __pyx_string_tab[266] -#define __pyx_n_u_t __pyx_string_tab[267] -#define __pyx_kp_u_t_Box __pyx_string_tab[268] -#define __pyx_kp_u_t_CsvData __pyx_string_tab[269] -#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[270] -#define __pyx_kp_u_t_InferenceResult __pyx_string_tab[271] -#define __pyx_kp_u_t_SensorImages __pyx_string_tab[272] -#define __pyx_n_u_test __pyx_string_tab[273] -#define __pyx_n_u_threshold __pyx_string_tab[274] -#define __pyx_n_u_throw __pyx_string_tab[275] -#define __pyx_n_u_tight __pyx_string_tab[276] -#define __pyx_n_u_tl __pyx_string_tab[277] -#define __pyx_n_u_tlblX __pyx_string_tab[278] -#define __pyx_n_u_tlblY __pyx_string_tab[279] -#define __pyx_n_u_tltrX __pyx_string_tab[280] -#define __pyx_n_u_tltrY __pyx_string_tab[281] -#define __pyx_n_u_to __pyx_string_tab[282] -#define __pyx_n_u_to_csv __pyx_string_tab[283] -#define __pyx_n_u_tolerance __pyx_string_tab[284] -#define __pyx_n_u_torch __pyx_string_tab[285] -#define __pyx_n_u_torch_device __pyx_string_tab[286] -#define __pyx_n_u_tr __pyx_string_tab[287] -#define __pyx_n_u_trbrX __pyx_string_tab[288] -#define __pyx_n_u_trbrY __pyx_string_tab[289] -#define __pyx_kp_u_tuple_float_float __pyx_string_tab[290] -#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __pyx_string_tab[291] -#define __pyx_n_u_types __pyx_string_tab[292] -#define __pyx_n_u_typing __pyx_string_tab[293] -#define __pyx_n_u_uint8 __pyx_string_tab[294] -#define __pyx_n_u_unsqueeze __pyx_string_tab[295] -#define __pyx_n_u_user_img_path __pyx_string_tab[296] -#define __pyx_n_u_value __pyx_string_tab[297] -#define __pyx_n_u_w __pyx_string_tab[298] -#define __pyx_n_u_warnings __pyx_string_tab[299] -#define __pyx_n_u_wrap_result __pyx_string_tab[300] -#define __pyx_n_u_wspace __pyx_string_tab[301] -#define __pyx_n_u_x1 __pyx_string_tab[302] -#define __pyx_n_u_x2 __pyx_string_tab[303] -#define __pyx_n_u_x_coords __pyx_string_tab[304] -#define __pyx_n_u_x_max __pyx_string_tab[305] -#define __pyx_n_u_x_middle __pyx_string_tab[306] -#define __pyx_n_u_x_min __pyx_string_tab[307] -#define __pyx_n_u_y_max __pyx_string_tab[308] -#define __pyx_n_u_y_min __pyx_string_tab[309] -#define __pyx_n_u_zip __pyx_string_tab[310] +#define __pyx_n_u_Canny __pyx_string_tab[9] +#define __pyx_n_u_ContourCalculationError __pyx_string_tab[10] +#define __pyx_kp_u_Contour_detection_not_valid_cont __pyx_string_tab[11] +#define __pyx_kp_u_Contour_detection_not_valid_no_c __pyx_string_tab[12] +#define __pyx_n_u_DETECTION_MODELS __pyx_string_tab[13] +#define __pyx_n_u_DataFrame __pyx_string_tab[14] +#define __pyx_n_u_FileNotFoundError __pyx_string_tab[15] +#define __pyx_n_u_Final __pyx_string_tab[16] +#define __pyx_n_u_HEATMAP_FILENAME_SUFFIX __pyx_string_tab[17] +#define __pyx_n_u_Image __pyx_string_tab[18] +#define __pyx_n_u_ImageNotReadError __pyx_string_tab[19] +#define __pyx_kp_u_Image_could_not_be_read_from __pyx_string_tab[20] +#define __pyx_n_u_InferenceResult __pyx_string_tab[21] +#define __pyx_n_u_InvalidElectrodeCount __pyx_string_tab[22] +#define __pyx_n_u_LAYERS __pyx_string_tab[23] +#define __pyx_n_u_MODEL_FOLDER __pyx_string_tab[24] +#define __pyx_n_u_MORPH_CLOSE __pyx_string_tab[25] +#define __pyx_n_u_MORPH_RECT __pyx_string_tab[26] +#define __pyx_n_u_NDArray __pyx_string_tab[27] +#define __pyx_n_u_NUM_VALID_ELECTRODES __pyx_string_tab[28] +#define __pyx_kp_u_No_contours_were_found_in_the_pr __pyx_string_tab[29] +#define __pyx_n_u_None __pyx_string_tab[30] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[31] +#define __pyx_kp_u_Number_of_counted_electrodes_doe __pyx_string_tab[32] +#define __pyx_n_u_PIL __pyx_string_tab[33] +#define __pyx_n_u_Patchcore __pyx_string_tab[34] +#define __pyx_n_u_Path __pyx_string_tab[35] +#define __pyx_n_u_QUOTE_NONE __pyx_string_tab[36] +#define __pyx_n_u_RATIO __pyx_string_tab[37] +#define __pyx_n_u_RETR_TREE __pyx_string_tab[38] +#define __pyx_n_u_RGB __pyx_string_tab[39] +#define __pyx_n_u_SensorImages __pyx_string_tab[40] +#define __pyx_n_u_THRESHOLD_BW __pyx_string_tab[41] +#define __pyx_n_u_THRESH_BINARY __pyx_string_tab[42] +#define __pyx_kp_u_The_provided_path_seems_not_to_e __pyx_string_tab[43] +#define __pyx_n_u_UserWarning __pyx_string_tab[44] +#define __pyx_kp_u__2 __pyx_string_tab[45] +#define __pyx_kp_u__3 __pyx_string_tab[46] +#define __pyx_kp_u__4 __pyx_string_tab[47] +#define __pyx_kp_u__5 __pyx_string_tab[48] +#define __pyx_n_u__8 __pyx_string_tab[49] +#define __pyx_n_u_accepted_boxes __pyx_string_tab[50] +#define __pyx_kp_u_add_note __pyx_string_tab[51] +#define __pyx_n_u_all __pyx_string_tab[52] +#define __pyx_n_u_alpha __pyx_string_tab[53] +#define __pyx_n_u_anomalib_models __pyx_string_tab[54] +#define __pyx_n_u_anomaly_detection __pyx_string_tab[55] +#define __pyx_n_u_anomaly_label __pyx_string_tab[56] +#define __pyx_n_u_anomaly_map __pyx_string_tab[57] +#define __pyx_n_u_anomaly_map_resized __pyx_string_tab[58] +#define __pyx_n_u_anomaly_score __pyx_string_tab[59] +#define __pyx_n_u_array __pyx_string_tab[60] +#define __pyx_n_u_astype __pyx_string_tab[61] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[62] +#define __pyx_n_u_ax __pyx_string_tab[63] +#define __pyx_n_u_axes __pyx_string_tab[64] +#define __pyx_n_u_axis __pyx_string_tab[65] +#define __pyx_n_u_backbone __pyx_string_tab[66] +#define __pyx_n_u_bbox_inches __pyx_string_tab[67] +#define __pyx_n_u_binary __pyx_string_tab[68] +#define __pyx_n_u_bl __pyx_string_tab[69] +#define __pyx_n_u_blbrX __pyx_string_tab[70] +#define __pyx_n_u_blbrY __pyx_string_tab[71] +#define __pyx_n_u_bool __pyx_string_tab[72] +#define __pyx_n_u_boundingRect __pyx_string_tab[73] +#define __pyx_n_u_box __pyx_string_tab[74] +#define __pyx_n_u_boxPoints __pyx_string_tab[75] +#define __pyx_n_u_box_1 __pyx_string_tab[76] +#define __pyx_n_u_box_2 __pyx_string_tab[77] +#define __pyx_n_u_br __pyx_string_tab[78] +#define __pyx_n_u_c __pyx_string_tab[79] +#define __pyx_n_u_c1 __pyx_string_tab[80] +#define __pyx_n_u_c2 __pyx_string_tab[81] +#define __pyx_n_u_cast __pyx_string_tab[82] +#define __pyx_n_u_category __pyx_string_tab[83] +#define __pyx_n_u_center_dist __pyx_string_tab[84] +#define __pyx_n_u_check_box_redundancy __pyx_string_tab[85] +#define __pyx_n_u_checkpoint __pyx_string_tab[86] +#define __pyx_n_u_class_getitem __pyx_string_tab[87] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[88] +#define __pyx_n_u_close __pyx_string_tab[89] +#define __pyx_n_u_closed __pyx_string_tab[90] +#define __pyx_n_u_cmap __pyx_string_tab[91] +#define __pyx_n_u_cnts __pyx_string_tab[92] +#define __pyx_n_u_const __pyx_string_tab[93] +#define __pyx_n_u_constants __pyx_string_tab[94] +#define __pyx_n_u_contours __pyx_string_tab[95] +#define __pyx_n_u_convert __pyx_string_tab[96] +#define __pyx_n_u_copy __pyx_string_tab[97] +#define __pyx_n_u_coreset_sampling_ratio __pyx_string_tab[98] +#define __pyx_n_u_cpu __pyx_string_tab[99] +#define __pyx_n_u_cropped __pyx_string_tab[100] +#define __pyx_n_u_cropped_sensor_left __pyx_string_tab[101] +#define __pyx_n_u_cropped_sensor_right __pyx_string_tab[102] +#define __pyx_kp_u_csv __pyx_string_tab[103] +#define __pyx_n_u_csv_2 __pyx_string_tab[104] +#define __pyx_n_u_cuda __pyx_string_tab[105] +#define __pyx_n_u_cv2 __pyx_string_tab[106] +#define __pyx_n_u_cvtColor __pyx_string_tab[107] +#define __pyx_n_u_dA __pyx_string_tab[108] +#define __pyx_n_u_dB __pyx_string_tab[109] +#define __pyx_n_u_data_csv __pyx_string_tab[110] +#define __pyx_n_u_detection_models __pyx_string_tab[111] +#define __pyx_n_u_device __pyx_string_tab[112] +#define __pyx_n_u_df __pyx_string_tab[113] +#define __pyx_n_u_dimA __pyx_string_tab[114] +#define __pyx_n_u_dimB __pyx_string_tab[115] +#define __pyx_kp_u_disable __pyx_string_tab[116] +#define __pyx_n_u_dist __pyx_string_tab[117] +#define __pyx_n_u_distance __pyx_string_tab[118] +#define __pyx_n_u_dopt_basics __pyx_string_tab[119] +#define __pyx_n_u_dopt_sensor_anomalies __pyx_string_tab[120] +#define __pyx_n_u_dopt_sensor_anomalies__find_path __pyx_string_tab[121] +#define __pyx_n_u_dopt_sensor_anomalies_detection __pyx_string_tab[122] +#define __pyx_n_u_dtype __pyx_string_tab[123] +#define __pyx_n_u_edged __pyx_string_tab[124] +#define __pyx_kp_u_enable __pyx_string_tab[125] +#define __pyx_n_u_enter __pyx_string_tab[126] +#define __pyx_n_u_enumerate __pyx_string_tab[127] +#define __pyx_n_u_errors __pyx_string_tab[128] +#define __pyx_n_u_euclidean __pyx_string_tab[129] +#define __pyx_n_u_eval __pyx_string_tab[130] +#define __pyx_n_u_existing __pyx_string_tab[131] +#define __pyx_n_u_exists __pyx_string_tab[132] +#define __pyx_n_u_exit __pyx_string_tab[133] +#define __pyx_kp_u_expected __pyx_string_tab[134] +#define __pyx_n_u_extend __pyx_string_tab[135] +#define __pyx_n_u_figsize __pyx_string_tab[136] +#define __pyx_n_u_file_path __pyx_string_tab[137] +#define __pyx_n_u_file_stem __pyx_string_tab[138] +#define __pyx_n_u_filtered_cnts __pyx_string_tab[139] +#define __pyx_n_u_filterwarnings __pyx_string_tab[140] +#define __pyx_n_u_findContours __pyx_string_tab[141] +#define __pyx_n_u_find_paths __pyx_string_tab[142] +#define __pyx_n_u_float __pyx_string_tab[143] +#define __pyx_n_u_float32 __pyx_string_tab[144] +#define __pyx_n_u_folder_path __pyx_string_tab[145] +#define __pyx_n_u_from_numpy __pyx_string_tab[146] +#define __pyx_n_u_fromarray __pyx_string_tab[147] +#define __pyx_n_u_func __pyx_string_tab[148] +#define __pyx_kp_u_gc __pyx_string_tab[149] +#define __pyx_n_u_genexpr __pyx_string_tab[150] +#define __pyx_n_u_getStructuringElement __pyx_string_tab[151] +#define __pyx_n_u_get_detection_models __pyx_string_tab[152] +#define __pyx_n_u_get_model_folder __pyx_string_tab[153] +#define __pyx_n_u_grab_contours __pyx_string_tab[154] +#define __pyx_n_u_gray __pyx_string_tab[155] +#define __pyx_n_u_header __pyx_string_tab[156] +#define __pyx_n_u_hspace __pyx_string_tab[157] +#define __pyx_kp_u_huggingface_hub_cache_system_us __pyx_string_tab[158] +#define __pyx_n_u_i __pyx_string_tab[159] +#define __pyx_n_u_ignore __pyx_string_tab[160] +#define __pyx_n_u_image __pyx_string_tab[161] +#define __pyx_n_u_image_np __pyx_string_tab[162] +#define __pyx_n_u_image_rgb __pyx_string_tab[163] +#define __pyx_n_u_img __pyx_string_tab[164] +#define __pyx_n_u_img_np __pyx_string_tab[165] +#define __pyx_n_u_img_path __pyx_string_tab[166] +#define __pyx_n_u_imread __pyx_string_tab[167] +#define __pyx_n_u_imshow __pyx_string_tab[168] +#define __pyx_n_u_imutils __pyx_string_tab[169] +#define __pyx_n_u_index __pyx_string_tab[170] +#define __pyx_n_u_infer_image __pyx_string_tab[171] +#define __pyx_n_u_initializing __pyx_string_tab[172] +#define __pyx_n_u_input_tensor __pyx_string_tab[173] +#define __pyx_n_u_int32 __pyx_string_tab[174] +#define __pyx_n_u_is_available __pyx_string_tab[175] +#define __pyx_n_u_is_coroutine __pyx_string_tab[176] +#define __pyx_n_u_is_duplicate __pyx_string_tab[177] +#define __pyx_n_u_is_sorted __pyx_string_tab[178] +#define __pyx_kp_u_isenabled __pyx_string_tab[179] +#define __pyx_n_u_item __pyx_string_tab[180] +#define __pyx_n_u_items __pyx_string_tab[181] +#define __pyx_n_u_jet __pyx_string_tab[182] +#define __pyx_n_u_kernel __pyx_string_tab[183] +#define __pyx_n_u_layers __pyx_string_tab[184] +#define __pyx_n_u_left __pyx_string_tab[185] +#define __pyx_n_u_leftmost_x_fourth __pyx_string_tab[186] +#define __pyx_n_u_linalg __pyx_string_tab[187] +#define __pyx_n_u_load __pyx_string_tab[188] +#define __pyx_n_u_load_state_dict __pyx_string_tab[189] +#define __pyx_n_u_main __pyx_string_tab[190] +#define __pyx_n_u_matplotlib __pyx_string_tab[191] +#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[192] +#define __pyx_n_u_max __pyx_string_tab[193] +#define __pyx_n_u_measure_length __pyx_string_tab[194] +#define __pyx_n_u_measure_length_locals_genexpr __pyx_string_tab[195] +#define __pyx_n_u_message __pyx_string_tab[196] +#define __pyx_n_u_midpoint __pyx_string_tab[197] +#define __pyx_n_u_min __pyx_string_tab[198] +#define __pyx_n_u_minAreaRect __pyx_string_tab[199] +#define __pyx_n_u_mode __pyx_string_tab[200] +#define __pyx_n_u_model __pyx_string_tab[201] +#define __pyx_n_u_model_state_dict __pyx_string_tab[202] +#define __pyx_n_u_module __pyx_string_tab[203] +#define __pyx_n_u_morphologyEx __pyx_string_tab[204] +#define __pyx_n_u_name __pyx_string_tab[205] +#define __pyx_n_u_next __pyx_string_tab[206] +#define __pyx_n_u_no_grad __pyx_string_tab[207] +#define __pyx_n_u_norm __pyx_string_tab[208] +#define __pyx_n_u_np __pyx_string_tab[209] +#define __pyx_n_u_npt __pyx_string_tab[210] +#define __pyx_kp_u_npt_NDArray_np_floating __pyx_string_tab[211] +#define __pyx_kp_u_npt_NDArray_np_uint8 __pyx_string_tab[212] +#define __pyx_n_u_num_contours __pyx_string_tab[213] +#define __pyx_n_u_numpy __pyx_string_tab[214] +#define __pyx_n_u_numpy_typing __pyx_string_tab[215] +#define __pyx_n_u_off __pyx_string_tab[216] +#define __pyx_n_u_order_points __pyx_string_tab[217] +#define __pyx_n_u_orig __pyx_string_tab[218] +#define __pyx_n_u_output __pyx_string_tab[219] +#define __pyx_n_u_pad_inches __pyx_string_tab[220] +#define __pyx_n_u_pandas __pyx_string_tab[221] +#define __pyx_n_u_parent __pyx_string_tab[222] +#define __pyx_n_u_pathlib __pyx_string_tab[223] +#define __pyx_n_u_permute __pyx_string_tab[224] +#define __pyx_n_u_perspective __pyx_string_tab[225] +#define __pyx_n_u_pil_image __pyx_string_tab[226] +#define __pyx_n_u_pipeline __pyx_string_tab[227] +#define __pyx_n_u_pixels_per_metric_X __pyx_string_tab[228] +#define __pyx_n_u_pixels_per_metric_Y __pyx_string_tab[229] +#define __pyx_n_u_plt __pyx_string_tab[230] +#define __pyx_kp_u_png __pyx_string_tab[231] +#define __pyx_n_u_pop __pyx_string_tab[232] +#define __pyx_n_u_pred_label __pyx_string_tab[233] +#define __pyx_n_u_pred_score __pyx_string_tab[234] +#define __pyx_n_u_pt_A __pyx_string_tab[235] +#define __pyx_n_u_pt_B __pyx_string_tab[236] +#define __pyx_n_u_pyplot __pyx_string_tab[237] +#define __pyx_n_u_qualname __pyx_string_tab[238] +#define __pyx_n_u_quoting __pyx_string_tab[239] +#define __pyx_n_u_rbox __pyx_string_tab[240] +#define __pyx_n_u_resize __pyx_string_tab[241] +#define __pyx_n_u_result __pyx_string_tab[242] +#define __pyx_n_u_result_pattern __pyx_string_tab[243] +#define __pyx_n_u_return __pyx_string_tab[244] +#define __pyx_n_u_right __pyx_string_tab[245] +#define __pyx_n_u_rightmost_x_third __pyx_string_tab[246] +#define __pyx_n_u_s1 __pyx_string_tab[247] +#define __pyx_n_u_s2 __pyx_string_tab[248] +#define __pyx_n_u_savefig __pyx_string_tab[249] +#define __pyx_n_u_scipy_spatial __pyx_string_tab[250] +#define __pyx_n_u_send __pyx_string_tab[251] +#define __pyx_n_u_sensor_images __pyx_string_tab[252] +#define __pyx_n_u_sep __pyx_string_tab[253] +#define __pyx_n_u_set_name __pyx_string_tab[254] +#define __pyx_n_u_shape __pyx_string_tab[255] +#define __pyx_n_u_side __pyx_string_tab[256] +#define __pyx_n_u_size_diff __pyx_string_tab[257] +#define __pyx_n_u_sort_contours __pyx_string_tab[258] +#define __pyx_n_u_spec __pyx_string_tab[259] +#define __pyx_n_u_squeeze __pyx_string_tab[260] +#define __pyx_kp_u_src_dopt_sensor_anomalies_detect __pyx_string_tab[261] +#define __pyx_n_u_stem __pyx_string_tab[262] +#define __pyx_n_u_str __pyx_string_tab[263] +#define __pyx_n_u_subplots __pyx_string_tab[264] +#define __pyx_n_u_subplots_adjust __pyx_string_tab[265] +#define __pyx_n_u_t __pyx_string_tab[266] +#define __pyx_kp_u_t_Box __pyx_string_tab[267] +#define __pyx_kp_u_t_CsvData __pyx_string_tab[268] +#define __pyx_kp_u_t_DetectionModels __pyx_string_tab[269] +#define __pyx_kp_u_t_InferenceResult __pyx_string_tab[270] +#define __pyx_kp_u_t_SensorImages __pyx_string_tab[271] +#define __pyx_n_u_test __pyx_string_tab[272] +#define __pyx_n_u_threshold __pyx_string_tab[273] +#define __pyx_n_u_throw __pyx_string_tab[274] +#define __pyx_n_u_tight __pyx_string_tab[275] +#define __pyx_n_u_tl __pyx_string_tab[276] +#define __pyx_n_u_tlblX __pyx_string_tab[277] +#define __pyx_n_u_tlblY __pyx_string_tab[278] +#define __pyx_n_u_tltrX __pyx_string_tab[279] +#define __pyx_n_u_tltrY __pyx_string_tab[280] +#define __pyx_n_u_to __pyx_string_tab[281] +#define __pyx_n_u_to_csv __pyx_string_tab[282] +#define __pyx_n_u_tolerance __pyx_string_tab[283] +#define __pyx_n_u_torch __pyx_string_tab[284] +#define __pyx_n_u_torch_device __pyx_string_tab[285] +#define __pyx_n_u_tr __pyx_string_tab[286] +#define __pyx_n_u_trbrX __pyx_string_tab[287] +#define __pyx_n_u_trbrY __pyx_string_tab[288] +#define __pyx_kp_u_tuple_float_float __pyx_string_tab[289] +#define __pyx_kp_u_tuple_t_CsvData_t_SensorImages __pyx_string_tab[290] +#define __pyx_n_u_types __pyx_string_tab[291] +#define __pyx_n_u_typing __pyx_string_tab[292] +#define __pyx_n_u_uint8 __pyx_string_tab[293] +#define __pyx_n_u_unsqueeze __pyx_string_tab[294] +#define __pyx_n_u_user_img_path __pyx_string_tab[295] +#define __pyx_n_u_value __pyx_string_tab[296] +#define __pyx_n_u_w __pyx_string_tab[297] +#define __pyx_n_u_warnings __pyx_string_tab[298] +#define __pyx_n_u_wrap_result __pyx_string_tab[299] +#define __pyx_n_u_wspace __pyx_string_tab[300] +#define __pyx_n_u_x1 __pyx_string_tab[301] +#define __pyx_n_u_x2 __pyx_string_tab[302] +#define __pyx_n_u_x_coords __pyx_string_tab[303] +#define __pyx_n_u_x_max __pyx_string_tab[304] +#define __pyx_n_u_x_middle __pyx_string_tab[305] +#define __pyx_n_u_x_min __pyx_string_tab[306] +#define __pyx_n_u_y_max __pyx_string_tab[307] +#define __pyx_n_u_y_min __pyx_string_tab[308] +#define __pyx_n_u_zip __pyx_string_tab[309] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { @@ -3566,11 +3563,10 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } for (int i=0; i<10; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<311; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<310; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } Py_CLEAR(clear_module_state->__pyx_float_0_5); Py_CLEAR(clear_module_state->__pyx_float_0_8); Py_CLEAR(clear_module_state->__pyx_float_2_0); - Py_CLEAR(clear_module_state->__pyx_float_0_251); Py_CLEAR(clear_module_state->__pyx_float_255_0); Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_int_1); @@ -3621,11 +3617,10 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } for (int i=0; i<10; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<311; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<310; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_0_5); __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_0_8); __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_2_0); - __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_0_251); __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_255_0); __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_0); __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1); @@ -3644,9 +3639,9 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void #endif /* #### Code section: module_code ### */ -/* "dopt_sensor_anomalies/detection.py":38 +/* "dopt_sensor_anomalies/detection.py":32 + * * - * # measuring * def midpoint( # <<<<<<<<<<<<<< * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], @@ -3692,39 +3687,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt_A,&__pyx_mstate_global->__pyx_n_u_pt_B,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 38, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 32, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 32, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "midpoint", 0) < (0)) __PYX_ERR(0, 38, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "midpoint", 0) < (0)) __PYX_ERR(0, 32, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, i); __PYX_ERR(0, 38, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, i); __PYX_ERR(0, 32, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 32, __pyx_L3_error) } __pyx_v_pt_A = values[0]; __pyx_v_pt_B = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("midpoint", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 32, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3757,7 +3752,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU int __pyx_clineno = 0; __Pyx_RefNannySetupContext("midpoint", 0); - /* "dopt_sensor_anomalies/detection.py":42 + /* "dopt_sensor_anomalies/detection.py":36 * pt_B: npt.NDArray[np.floating], * ) -> tuple[float, float]: * return ((pt_A[0] + pt_B[0]) * 0.5, (pt_A[1] + pt_B[1]) * 0.5) # <<<<<<<<<<<<<< @@ -3765,43 +3760,43 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_A, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_A, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt_B, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt_B, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt_A, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt_A, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_B, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt_B, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 42, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 42, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":38 + /* "dopt_sensor_anomalies/detection.py":32 + * * - * # measuring * def midpoint( # <<<<<<<<<<<<<< * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], @@ -3821,7 +3816,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_midpoint(CYTHON_UNU return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":45 +/* "dopt_sensor_anomalies/detection.py":39 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -3870,40 +3865,40 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_box_1,&__pyx_mstate_global->__pyx_n_u_box_2,&__pyx_mstate_global->__pyx_n_u_tolerance,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 45, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 39, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check_box_redundancy", 0) < (0)) __PYX_ERR(0, 45, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check_box_redundancy", 0) < (0)) __PYX_ERR(0, 39, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 45, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, i); __PYX_ERR(0, 39, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 45, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3911,14 +3906,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __pyx_v_box_1 = values[0]; __pyx_v_box_2 = values[1]; if (values[2]) { - __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error) + __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error) } else { __pyx_v_tolerance = ((double)((double)5.0)); } } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("check_box_redundancy", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 39, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3969,12 +3964,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check_box_redundancy", 0); - /* "dopt_sensor_anomalies/detection.py":51 + /* "dopt_sensor_anomalies/detection.py":44 + * tolerance: float = 5.0, * ) -> bool: - * # unpack the boxes * c1, s1, _ = box_1 # <<<<<<<<<<<<<< * c2, s2, _ = box_2 - * # sort width and height such that (w, h) == (h, w) is treated the same + * s1 = sorted(s1) */ if ((likely(PyTuple_CheckExact(__pyx_v_box_1))) || (PyList_CheckExact(__pyx_v_box_1))) { PyObject* sequence = __pyx_v_box_1; @@ -3982,7 +3977,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 51, __pyx_L1_error) + __PYX_ERR(0, 44, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3994,26 +3989,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; @@ -4022,7 +4017,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 44, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -4030,7 +4025,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 51, __pyx_L1_error) + __PYX_ERR(0, 44, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_c1 = __pyx_t_1; @@ -4040,12 +4035,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_v__ = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":52 - * # unpack the boxes + /* "dopt_sensor_anomalies/detection.py":45 + * ) -> bool: * c1, s1, _ = box_1 * c2, s2, _ = box_2 # <<<<<<<<<<<<<< - * # sort width and height such that (w, h) == (h, w) is treated the same - * # (might have been recognized in different orders) + * s1 = sorted(s1) + * s2 = sorted(s2) */ if ((likely(PyTuple_CheckExact(__pyx_v_box_2))) || (PyList_CheckExact(__pyx_v_box_2))) { PyObject* sequence = __pyx_v_box_2; @@ -4053,7 +4048,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 52, __pyx_L1_error) + __PYX_ERR(0, 45, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4065,26 +4060,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_v_box_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; @@ -4093,7 +4088,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 52, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L6_unpacking_done; @@ -4101,7 +4096,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 52, __pyx_L1_error) + __PYX_ERR(0, 45, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_v_c2 = __pyx_t_3; @@ -4111,33 +4106,33 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_DECREF_SET(__pyx_v__, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":55 - * # sort width and height such that (w, h) == (h, w) is treated the same - * # (might have been recognized in different orders) + /* "dopt_sensor_anomalies/detection.py":46 + * c1, s1, _ = box_1 + * c2, s2, _ = box_2 * s1 = sorted(s1) # <<<<<<<<<<<<<< * s2 = sorted(s2) * */ - __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 55, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s1, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":56 - * # (might have been recognized in different orders) + /* "dopt_sensor_anomalies/detection.py":47 + * c2, s2, _ = box_2 * s1 = sorted(s1) * s2 = sorted(s2) # <<<<<<<<<<<<<< * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) */ - __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_v_s2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":58 + /* "dopt_sensor_anomalies/detection.py":49 * s2 = sorted(s2) * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) # <<<<<<<<<<<<<< @@ -4145,19 +4140,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_8; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4177,13 +4172,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_12 = 1; @@ -4203,10 +4198,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 58, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -4217,7 +4212,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_12 = 1; @@ -4238,13 +4233,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_center_dist = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":59 + /* "dopt_sensor_anomalies/detection.py":50 * * center_dist = cast(float, np.linalg.norm(np.array(c1) - np.array(c2))) * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) # <<<<<<<<<<<<<< @@ -4252,19 +4247,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * return bool(center_dist < tolerance and size_diff < tolerance) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_8 = __pyx_t_6; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4284,13 +4279,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); } __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_12 = 1; @@ -4310,10 +4305,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -4324,7 +4319,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_12 = 1; @@ -4345,13 +4340,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_size_diff = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":61 + /* "dopt_sensor_anomalies/detection.py":52 * size_diff = cast(float, np.linalg.norm(np.array(s1) - np.array(s2))) * * return bool(center_dist < tolerance and size_diff < tolerance) # <<<<<<<<<<<<<< @@ -4359,32 +4354,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_center_dist, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_center_dist, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_15) { } else { __pyx_t_14 = __pyx_t_15; goto __pyx_L7_bool_binop_done; } - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_size_diff, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_size_diff, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_15; __pyx_L7_bool_binop_done:; - __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_14))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":45 + /* "dopt_sensor_anomalies/detection.py":39 * * * def check_box_redundancy( # <<<<<<<<<<<<<< @@ -4420,9 +4415,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_2check_box_redundan return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":65 +/* "dopt_sensor_anomalies/detection.py":55 + * * - * # ** main function * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, @@ -4469,46 +4464,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_img_path,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_X,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 65, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 55, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 55, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "measure_length", 0) < (0)) __PYX_ERR(0, 65, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "measure_length", 0) < (0)) __PYX_ERR(0, 55, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 65, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, i); __PYX_ERR(0, 55, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 55, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 65, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 55, __pyx_L3_error) } __pyx_v_img_path = values[0]; - __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) - __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L3_error) + __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("measure_length", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 55, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4530,9 +4525,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":97 +/* "dopt_sensor_anomalies/detection.py":84 + * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] - * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< * if not is_sorted: * raise errors.ContourCalculationError( @@ -4550,7 +4545,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_ge if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 97, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4558,7 +4553,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_ge __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4601,17 +4596,17 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 97, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 97, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 84, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { @@ -4619,7 +4614,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4629,7 +4624,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -4640,13 +4635,13 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g #endif ++__pyx_t_2; } - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 84, __pyx_L1_error) PyErr_Clear(); } break; @@ -4659,7 +4654,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 97, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4669,22 +4664,22 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_INCREF(__pyx_t_6); } else { __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_6); } #else - __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __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_ERR(0, 97, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); @@ -4692,7 +4687,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -4700,7 +4695,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 97, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x1); @@ -4711,7 +4706,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_x2, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_x2, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_1); @@ -4730,7 +4725,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 84, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -4760,8 +4755,8 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_2g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":137 - * # check for redundancy +/* "dopt_sensor_anomalies/detection.py":112 + * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) @@ -4780,7 +4775,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 137, __pyx_L1_error) + __PYX_ERR(0, 112, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4791,7 +4786,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4830,30 +4825,30 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 137, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 137, __pyx_L1_error) } + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 112, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 112, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_existing); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_existing, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_check_box_redundancy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_check_box_redundancy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 137, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_rbox)) { __Pyx_RaiseClosureNameError("rbox"); __PYX_ERR(0, 112, __pyx_L1_error) } __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { @@ -4871,24 +4866,24 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "dopt_sensor_anomalies/detection.py":136 + /* "dopt_sensor_anomalies/detection.py":111 + * continue * - * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":137 - * # check for redundancy + /* "dopt_sensor_anomalies/detection.py":112 + * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) @@ -4903,17 +4898,17 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*else*/ { - /* "dopt_sensor_anomalies/detection.py":136 + /* "dopt_sensor_anomalies/detection.py":111 + * continue * - * # check for redundancy * is_duplicate = any( # <<<<<<<<<<<<<< * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) */ __Pyx_XDECREF(__pyx_r); - /* "dopt_sensor_anomalies/detection.py":137 - * # check for redundancy + /* "dopt_sensor_anomalies/detection.py":112 + * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) @@ -4948,9 +4943,9 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_5g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":172 +/* "dopt_sensor_anomalies/detection.py":143 + * ) * - * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -4968,7 +4963,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 172, __pyx_L1_error) + __PYX_ERR(0, 143, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -4976,7 +4971,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5018,34 +5013,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 172, __pyx_L1_error) + __PYX_ERR(0, 143, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 172, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 143, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5065,7 +5060,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5084,7 +5079,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 143, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5114,8 +5109,8 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_8g } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":173 - * # identify left and right sensor areas +/* "dopt_sensor_anomalies/detection.py":144 + * * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -5134,7 +5129,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 173, __pyx_L1_error) + __PYX_ERR(0, 144, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5142,7 +5137,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9g __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5184,34 +5179,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 173, __pyx_L1_error) + __PYX_ERR(0, 144, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 173, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 144, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 144, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5231,7 +5226,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5250,7 +5245,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 144, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5280,7 +5275,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_11 } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":174 +/* "dopt_sensor_anomalies/detection.py":145 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -5300,7 +5295,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12 if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 174, __pyx_L1_error) + __PYX_ERR(0, 145, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5308,7 +5303,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5350,34 +5345,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 174, __pyx_L1_error) + __PYX_ERR(0, 145, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 174, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 145, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 145, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5397,7 +5392,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5416,7 +5411,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 145, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5446,7 +5441,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_14 } static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "dopt_sensor_anomalies/detection.py":175 +/* "dopt_sensor_anomalies/detection.py":146 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -5466,7 +5461,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15 if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 175, __pyx_L1_error) + __PYX_ERR(0, 146, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -5474,7 +5469,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15 __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_measure_length_locals_genexpr, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection); if (unlikely(!gen)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5516,34 +5511,34 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __pyx_L3_first_run:; if (unlikely(__pyx_sent_value != Py_None)) { if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); - __PYX_ERR(0, 175, __pyx_L1_error) + __PYX_ERR(0, 146, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 175, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 146, __pyx_L1_error) } __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 146, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2); ++__pyx_t_2; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_c, __pyx_mstate_global->__pyx_tuple[1]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS @@ -5563,7 +5558,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_r = __pyx_t_3; @@ -5582,7 +5577,7 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 146, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -5611,9 +5606,9 @@ static PyObject *__pyx_gb_21dopt_sensor_anomalies_9detection_14measure_length_17 return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":65 +/* "dopt_sensor_anomalies/detection.py":55 + * * - * # ** main function * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, @@ -5702,24 +5697,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 65, __pyx_L1_error) + __PYX_ERR(0, 55, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - /* "dopt_sensor_anomalies/detection.py":70 + /* "dopt_sensor_anomalies/detection.py":60 * pixels_per_metric_Y: float, * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] # <<<<<<<<<<<<<< * image = cv2.imread(str(img_path)) * if image is None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_data_csv = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":71 + /* "dopt_sensor_anomalies/detection.py":61 * ) -> tuple[t.CsvData, t.SensorImages]: * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) # <<<<<<<<<<<<<< @@ -5727,12 +5722,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_imread); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_imread); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_img_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_img_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -5752,13 +5747,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":72 + /* "dopt_sensor_anomalies/detection.py":62 * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< @@ -5768,7 +5763,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_6 = (__pyx_v_image == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":73 + /* "dopt_sensor_anomalies/detection.py":63 * image = cv2.imread(str(img_path)) * if image is None: * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") # <<<<<<<<<<<<<< @@ -5776,18 +5771,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * cropped = image[500:1500, 100 : image.shape[1] - 100] */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ImageNotReadError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ImageNotReadError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_img_path, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_img_path, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Image_could_not_be_read_from; __pyx_t_7[1] = __pyx_t_3; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5808,14 +5803,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 73, __pyx_L1_error) + __PYX_ERR(0, 63, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":72 + /* "dopt_sensor_anomalies/detection.py":62 * data_csv: list[str | int] = [] * image = cv2.imread(str(img_path)) * if image is None: # <<<<<<<<<<<<<< @@ -5824,43 +5819,43 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":75 + /* "dopt_sensor_anomalies/detection.py":65 * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() - * # change colours in the image to black and white + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_100, 0x64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PySlice_New(__pyx_mstate_global->__pyx_int_100, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_2 = PySlice_New(__pyx_mstate_global->__pyx_int_100, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 75, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[1]) != (0)) __PYX_ERR(0, 65, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 75, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 65, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_image, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_image, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cropped = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":76 + /* "dopt_sensor_anomalies/detection.py":66 * * cropped = image[500:1500, 100 : image.shape[1] - 100] * orig = cropped.copy() # <<<<<<<<<<<<<< - * # change colours in the image to black and white + * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) */ __pyx_t_1 = __pyx_v_cropped; @@ -5870,28 +5865,28 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_orig = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":78 + /* "dopt_sensor_anomalies/detection.py":68 * orig = cropped.copy() - * # change colours in the image to black and white + * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) # <<<<<<<<<<<<<< * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) - * # perform edge detection, identify rectangular shapes + * */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2GRAY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2GRAY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -5912,33 +5907,33 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_gray = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":79 - * # change colours in the image to black and white + /* "dopt_sensor_anomalies/detection.py":69 + * * gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) # <<<<<<<<<<<<<< - * # perform edge detection, identify rectangular shapes + * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_threshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_threshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESHOLD_BW); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESHOLD_BW); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESH_BINARY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_THRESH_BINARY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -5960,7 +5955,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -5969,7 +5964,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 79, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5979,22 +5974,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_9); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); @@ -6002,7 +5997,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_9 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 79, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L5_unpacking_done; @@ -6010,7 +6005,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 79, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) __pyx_L5_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -6018,22 +6013,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_v_binary = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":81 + /* "dopt_sensor_anomalies/detection.py":71 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) - * # perform edge detection, identify rectangular shapes + * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # <<<<<<<<<<<<<< * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_getStructuringElement); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_getStructuringElement); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MORPH_RECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MORPH_RECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6054,28 +6049,28 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_kernel = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":82 - * # perform edge detection, identify rectangular shapes + /* "dopt_sensor_anomalies/detection.py":72 + * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) # <<<<<<<<<<<<<< * edged = cv2.Canny(closed, 50, 100) - * # find contours in the edge map + * */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_morphologyEx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_morphologyEx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MORPH_CLOSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MORPH_CLOSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6096,23 +6091,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_closed = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":83 + /* "dopt_sensor_anomalies/detection.py":73 * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) # <<<<<<<<<<<<<< - * # find contours in the edge map + * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Canny); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Canny); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6132,23 +6127,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_edged = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":85 + /* "dopt_sensor_anomalies/detection.py":75 * edged = cv2.Canny(closed, 50, 100) - * # find contours in the edge map + * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # <<<<<<<<<<<<<< * cnts = imutils.grab_contours(cnts) * if cnts is None: */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_findContours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_findContours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_4 = __pyx_v_edged; @@ -6158,17 +6153,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RETR_TREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RETR_TREE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CHAIN_APPROX_SIMPLE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_CHAIN_APPROX_SIMPLE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; @@ -6191,23 +6186,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_cnts = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":86 - * # find contours in the edge map + /* "dopt_sensor_anomalies/detection.py":76 + * * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) # <<<<<<<<<<<<<< * if cnts is None: * raise errors.ContourCalculationError( */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_imutils); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_grab_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_grab_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_5 = 1; @@ -6227,13 +6222,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":87 + /* "dopt_sensor_anomalies/detection.py":77 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6243,7 +6238,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_6 = (__pyx_v_cnts == Py_None); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":88 + /* "dopt_sensor_anomalies/detection.py":78 * cnts = imutils.grab_contours(cnts) * if cnts is None: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6251,9 +6246,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -6273,14 +6268,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 88, __pyx_L1_error) + __PYX_ERR(0, 78, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":87 + /* "dopt_sensor_anomalies/detection.py":77 * cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) * cnts = imutils.grab_contours(cnts) * if cnts is None: # <<<<<<<<<<<<<< @@ -6289,17 +6284,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":92 + /* "dopt_sensor_anomalies/detection.py":82 * ) - * # sort the contours from left to right (i.e., use x coordinates) + * * cnts, _ = contours.sort_contours(cnts) # <<<<<<<<<<<<<< - * # check if this sorting was correct (might not be correct if we have overlaps or misfindings) - * # get x coordinates of bounding boxes + * x_coords = [cv2.boundingRect(c)[0] for c in cnts] + * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_contours); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sort_contours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sort_contours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6319,7 +6314,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { @@ -6328,7 +6323,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 92, __pyx_L1_error) + __PYX_ERR(0, 82, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6338,22 +6333,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_11); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); @@ -6361,7 +6356,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_11 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 92, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 82, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_unpacking_done; @@ -6369,7 +6364,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 92, __pyx_L1_error) + __PYX_ERR(0, 82, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v_cnts, __pyx_t_1); @@ -6377,24 +6372,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF_SET(__pyx_v__, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":95 - * # check if this sorting was correct (might not be correct if we have overlaps or misfindings) - * # get x coordinates of bounding boxes + /* "dopt_sensor_anomalies/detection.py":83 + * + * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] # <<<<<<<<<<<<<< - * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore + * if not is_sorted: */ { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L11_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_v_cnts)) || PyTuple_CheckExact(__pyx_v_cnts)) { __pyx_t_11 = __pyx_v_cnts; __Pyx_INCREF(__pyx_t_11); __pyx_t_12 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __pyx_L11_error) + __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 95, __pyx_L11_error) + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 83, __pyx_L11_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6402,7 +6397,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 83, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6412,7 +6407,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 83, __pyx_L11_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6423,13 +6418,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L11_error) } else { __pyx_t_1 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 83, __pyx_L11_error) PyErr_Clear(); } break; @@ -6439,9 +6434,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_c, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __pyx_L11_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_boundingRect); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L11_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_boundingRect); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6461,13 +6456,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L11_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 95, __pyx_L11_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 83, __pyx_L11_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -6481,23 +6476,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_v_x_coords = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":97 + /* "dopt_sensor_anomalies/detection.py":84 + * cnts, _ = contours.sort_contours(cnts) * x_coords = [cv2.boundingRect(c)[0] for c in cnts] - * # check if x coordinates are sorted in increasing order * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore # <<<<<<<<<<<<<< * if not is_sorted: * raise errors.ContourCalculationError( */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_builtin_zip); __pyx_t_9 = __pyx_builtin_zip; - __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyList_GetSlice(__pyx_v_x_coords, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -6506,10 +6501,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } - __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_genexpr(NULL, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_genexpr(NULL, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6530,24 +6525,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_is_sorted = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":98 - * # check if x coordinates are sorted in increasing order + /* "dopt_sensor_anomalies/detection.py":85 + * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( * "Contour detection not valid: contours are not " */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_sorted); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) __pyx_t_14 = (!__pyx_t_6); if (unlikely(__pyx_t_14)) { - /* "dopt_sensor_anomalies/detection.py":99 + /* "dopt_sensor_anomalies/detection.py":86 * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -6555,9 +6550,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * "properly sorted from left to right." */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6577,15 +6572,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 99, __pyx_L1_error) + __PYX_ERR(0, 86, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":98 - * # check if x coordinates are sorted in increasing order + /* "dopt_sensor_anomalies/detection.py":85 + * x_coords = [cv2.boundingRect(c)[0] for c in cnts] * is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore * if not is_sorted: # <<<<<<<<<<<<<< * raise errors.ContourCalculationError( @@ -6593,45 +6588,45 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":104 + /* "dopt_sensor_anomalies/detection.py":90 + * "properly sorted from left to right." * ) - * # to store only electrodes contours and nothing redundant * accepted_boxes: list[t.Box] = [] # <<<<<<<<<<<<<< * filtered_cnts: list[Any] = [] * */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_accepted_boxes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":105 - * # to store only electrodes contours and nothing redundant + /* "dopt_sensor_anomalies/detection.py":91 + * ) * accepted_boxes: list[t.Box] = [] * filtered_cnts: list[Any] = [] # <<<<<<<<<<<<<< * - * # loop over the contours individually + * for c in cnts: */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_filtered_cnts = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":108 + /* "dopt_sensor_anomalies/detection.py":93 + * filtered_cnts: list[Any] = [] * - * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< - * # compute the rotated bounding box of the contour * rbox = cast(t.Box, cv2.minAreaRect(c)) + * box = cv2.boxPoints(rbox) */ if (likely(PyList_CheckExact(__pyx_v_cnts)) || PyTuple_CheckExact(__pyx_v_cnts)) { __pyx_t_2 = __pyx_v_cnts; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_cnts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 93, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { @@ -6639,7 +6634,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6649,7 +6644,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) #endif if (__pyx_t_12 >= __pyx_temp) break; } @@ -6660,13 +6655,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif ++__pyx_t_12; } - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 93, __pyx_L1_error) } else { __pyx_t_11 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_11)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 93, __pyx_L1_error) PyErr_Clear(); } break; @@ -6676,25 +6671,25 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":110 + /* "dopt_sensor_anomalies/detection.py":94 + * * for c in cnts: - * # compute the rotated bounding box of the contour * rbox = cast(t.Box, cv2.minAreaRect(c)) # <<<<<<<<<<<<<< - * # !! should only be newer OpenCV versions - * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) + * box = cv2.boxPoints(rbox) + * box = np.array(box, dtype=np.int32) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Box); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_minAreaRect); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_minAreaRect); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_5 = 1; @@ -6714,7 +6709,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_5 = 1; @@ -6736,7 +6731,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rbox); @@ -6744,17 +6739,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":113 - * # !! should only be newer OpenCV versions - * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) + /* "dopt_sensor_anomalies/detection.py":95 + * for c in cnts: + * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) # <<<<<<<<<<<<<< * box = np.array(box, dtype=np.int32) - * # order the points in the contour in top-left, top-right, bottom-right, and bottom-left + * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) */ __pyx_t_9 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_boxPoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = 1; @@ -6774,28 +6769,28 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 113, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_XDECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":114 - * # box = cv2.cv.BoxPoints(rbox) if is_cv2() else cv2.boxPoints(rbox) + /* "dopt_sensor_anomalies/detection.py":96 + * rbox = cast(t.Box, cv2.minAreaRect(c)) * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) # <<<<<<<<<<<<<< - * # order the points in the contour in top-left, top-right, bottom-right, and bottom-left * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) + * */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -6812,48 +6807,48 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_box}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 114, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_1, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 96, __pyx_L1_error) __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_DECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":116 + /* "dopt_sensor_anomalies/detection.py":97 + * box = cv2.boxPoints(rbox) * box = np.array(box, dtype=np.int32) - * # order the points in the contour in top-left, top-right, bottom-right, and bottom-left * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) # <<<<<<<<<<<<<< * - * # unpack the bounding box + * (tl, tr, br, bl) = box */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_perspective); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_order_points); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; @@ -6873,7 +6868,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 116, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } __pyx_t_5 = 1; @@ -6895,18 +6890,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } __Pyx_DECREF_SET(__pyx_v_box, __pyx_t_11); __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":119 + /* "dopt_sensor_anomalies/detection.py":99 + * box = cast(npt.NDArray[np.float32], perspective.order_points(box)) * - * # unpack the bounding box * (tl, tr, br, bl) = box # <<<<<<<<<<<<<< - * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates * (tltrX, tltrY) = midpoint(tl, tr) + * (blbrX, blbrY) = midpoint(bl, br) */ if ((likely(PyTuple_CheckExact(__pyx_v_box))) || (PyList_CheckExact(__pyx_v_box))) { PyObject* sequence = __pyx_v_box; @@ -6914,7 +6909,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 119, __pyx_L1_error) + __PYX_ERR(0, 99, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6928,16 +6923,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_1); } else { __pyx_t_11 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_11); __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 119, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 2); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 119, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 3); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); } #else @@ -6945,7 +6940,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_11,&__pyx_t_9,&__pyx_t_16,&__pyx_t_1}; for (i=0; i < 4; i++) { - PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 119, __pyx_L1_error) + PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -6954,7 +6949,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_11,&__pyx_t_9,&__pyx_t_16,&__pyx_t_1}; - __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_8 = PyObject_GetIter(__pyx_v_box); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); for (index=0; index < 4; index++) { @@ -6962,7 +6957,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 119, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 4) < (0)) __PYX_ERR(0, 99, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L20_unpacking_done; @@ -6970,7 +6965,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 119, __pyx_L1_error) + __PYX_ERR(0, 99, __pyx_L1_error) __pyx_L20_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tl, __pyx_t_11); @@ -6982,15 +6977,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_bl, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":121 + /* "dopt_sensor_anomalies/detection.py":100 + * * (tl, tr, br, bl) = box - * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates * (tltrX, tltrY) = midpoint(tl, tr) # <<<<<<<<<<<<<< * (blbrX, blbrY) = midpoint(bl, br) - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates + * (tlblX, tlblY) = midpoint(tl, bl) */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -7009,7 +7004,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -7018,7 +7013,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 121, __pyx_L1_error) + __PYX_ERR(0, 100, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7028,22 +7023,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 121, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); } #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); @@ -7051,7 +7046,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L21_unpacking_failed; __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 121, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L22_unpacking_done; @@ -7059,7 +7054,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 121, __pyx_L1_error) + __PYX_ERR(0, 100, __pyx_L1_error) __pyx_L22_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tltrX, __pyx_t_9); @@ -7067,15 +7062,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_tltrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":122 - * # compute the midpoints between the top-left and top-right as well as bottom-left and bottom-right coordinates + /* "dopt_sensor_anomalies/detection.py":101 + * (tl, tr, br, bl) = box * (tltrX, tltrY) = midpoint(tl, tr) * (blbrX, blbrY) = midpoint(bl, br) # <<<<<<<<<<<<<< - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates * (tlblX, tlblY) = midpoint(tl, bl) + * (trbrX, trbrY) = midpoint(tr, br) */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -7094,7 +7089,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -7103,7 +7098,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 122, __pyx_L1_error) + __PYX_ERR(0, 101, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7113,22 +7108,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 122, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); } #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); @@ -7136,7 +7131,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L23_unpacking_failed; __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 122, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L24_unpacking_done; @@ -7144,7 +7139,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 122, __pyx_L1_error) + __PYX_ERR(0, 101, __pyx_L1_error) __pyx_L24_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_blbrX, __pyx_t_9); @@ -7152,15 +7147,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_blbrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":124 + /* "dopt_sensor_anomalies/detection.py":102 + * (tltrX, tltrY) = midpoint(tl, tr) * (blbrX, blbrY) = midpoint(bl, br) - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates * (tlblX, tlblY) = midpoint(tl, bl) # <<<<<<<<<<<<<< * (trbrX, trbrY) = midpoint(tr, br) * */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -7179,7 +7174,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -7188,7 +7183,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 124, __pyx_L1_error) + __PYX_ERR(0, 102, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7198,22 +7193,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 124, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); } #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); @@ -7221,7 +7216,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L25_unpacking_failed; __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 124, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L26_unpacking_done; @@ -7229,7 +7224,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 124, __pyx_L1_error) + __PYX_ERR(0, 102, __pyx_L1_error) __pyx_L26_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tlblX, __pyx_t_9); @@ -7237,15 +7232,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_tlblY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":125 - * # compute the midpoints between the top-left and bottom-left as well as the top-right and bottom-right coordinates + /* "dopt_sensor_anomalies/detection.py":103 + * (blbrX, blbrY) = midpoint(bl, br) * (tlblX, tlblY) = midpoint(tl, bl) * (trbrX, trbrY) = midpoint(tr, br) # <<<<<<<<<<<<<< * - * # compute the Euclidean distance between the midpoints + * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_midpoint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -7264,7 +7259,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -7273,7 +7268,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 125, __pyx_L1_error) + __PYX_ERR(0, 103, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7283,22 +7278,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_INCREF(__pyx_t_16); } else { __pyx_t_9 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_9); __pyx_t_16 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 125, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_16); } #else - __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_16 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); @@ -7306,7 +7301,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_16 = __pyx_t_10(__pyx_t_11); if (unlikely(!__pyx_t_16)) goto __pyx_L27_unpacking_failed; __Pyx_GOTREF(__pyx_t_16); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 125, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L28_unpacking_done; @@ -7314,7 +7309,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 125, __pyx_L1_error) + __PYX_ERR(0, 103, __pyx_L1_error) __pyx_L28_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_trbrX, __pyx_t_9); @@ -7322,35 +7317,35 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF_SET(__pyx_v_trbrY, __pyx_t_16); __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":128 + /* "dopt_sensor_anomalies/detection.py":105 + * (trbrX, trbrY) = midpoint(tr, br) * - * # compute the Euclidean distance between the midpoints * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) # <<<<<<<<<<<<<< * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) * */ __pyx_t_16 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_tltrX); __Pyx_GIVEREF(__pyx_v_tltrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_tltrX) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_tltrX) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); __Pyx_INCREF(__pyx_v_tltrY); __Pyx_GIVEREF(__pyx_v_tltrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_tltrY) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_tltrY) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_blbrX); __Pyx_GIVEREF(__pyx_v_blbrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_blbrX) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_blbrX) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); __Pyx_INCREF(__pyx_v_blbrY); __Pyx_GIVEREF(__pyx_v_blbrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_blbrY) != (0)) __PYX_ERR(0, 128, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_blbrY) != (0)) __PYX_ERR(0, 105, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { @@ -7370,41 +7365,41 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_dA, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":129 - * # compute the Euclidean distance between the midpoints + /* "dopt_sensor_anomalies/detection.py":106 + * * dA = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) # <<<<<<<<<<<<<< * - * # if the contour is not sufficiently large, ignore it + * if dA < 100 or dB < 100: */ __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_dist); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_euclidean); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_tlblX); __Pyx_GIVEREF(__pyx_v_tlblX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tlblX) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tlblX) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); __Pyx_INCREF(__pyx_v_tlblY); __Pyx_GIVEREF(__pyx_v_tlblY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_tlblY) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 129, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_tlblY) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_INCREF(__pyx_v_trbrX); __Pyx_GIVEREF(__pyx_v_trbrX); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_trbrX) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_trbrX) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); __Pyx_INCREF(__pyx_v_trbrY); __Pyx_GIVEREF(__pyx_v_trbrY); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_trbrY) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_trbrY) != (0)) __PYX_ERR(0, 106, __pyx_L1_error); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_9))) { @@ -7424,87 +7419,87 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_dB, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":132 + /* "dopt_sensor_anomalies/detection.py":108 + * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) * - * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dA, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_dA, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_6) { } else { __pyx_t_14 = __pyx_t_6; goto __pyx_L30_bool_binop_done; } - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dB, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_dB, __pyx_mstate_global->__pyx_int_100, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_6; __pyx_L30_bool_binop_done:; if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":133 - * # if the contour is not sufficiently large, ignore it + /* "dopt_sensor_anomalies/detection.py":109 + * * if dA < 100 or dB < 100: * continue # <<<<<<<<<<<<<< * - * # check for redundancy + * is_duplicate = any( */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":132 + /* "dopt_sensor_anomalies/detection.py":108 + * dB = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) * - * # if the contour is not sufficiently large, ignore it * if dA < 100 or dB < 100: # <<<<<<<<<<<<<< * continue * */ } - /* "dopt_sensor_anomalies/detection.py":137 - * # check for redundancy + /* "dopt_sensor_anomalies/detection.py":112 + * * is_duplicate = any( * check_box_redundancy(rbox, existing) for existing in accepted_boxes # <<<<<<<<<<<<<< * ) * if is_duplicate: */ - __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_accepted_boxes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_accepted_boxes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_9 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_is_duplicate, __pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":139 + /* "dopt_sensor_anomalies/detection.py":114 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_is_duplicate); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) if (__pyx_t_14) { - /* "dopt_sensor_anomalies/detection.py":140 + /* "dopt_sensor_anomalies/detection.py":115 * ) * if is_duplicate: * continue # <<<<<<<<<<<<<< * - * # accept box and contour + * accepted_boxes.append(rbox) */ goto __pyx_L17_continue; - /* "dopt_sensor_anomalies/detection.py":139 + /* "dopt_sensor_anomalies/detection.py":114 * check_box_redundancy(rbox, existing) for existing in accepted_boxes * ) * if is_duplicate: # <<<<<<<<<<<<<< @@ -7513,126 +7508,126 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":143 + /* "dopt_sensor_anomalies/detection.py":117 + * continue * - * # accept box and contour * accepted_boxes.append(rbox) # <<<<<<<<<<<<<< * filtered_cnts.append(c) * */ __pyx_t_9 = __pyx_cur_scope->__pyx_v_rbox; __Pyx_INCREF(__pyx_t_9); - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_accepted_boxes, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":144 - * # accept box and contour + /* "dopt_sensor_anomalies/detection.py":118 + * * accepted_boxes.append(rbox) * filtered_cnts.append(c) # <<<<<<<<<<<<<< * - * # compute the size of the electrode object + * dimA = dA / pixels_per_metric_Y */ - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_filtered_cnts, __pyx_v_c); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 118, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":147 + /* "dopt_sensor_anomalies/detection.py":120 + * filtered_cnts.append(c) * - * # compute the size of the electrode object - * dimA = dA / pixels_per_metric_Y # y # <<<<<<<<<<<<<< - * dimB = dB / pixels_per_metric_X # x + * dimA = dA / pixels_per_metric_Y # <<<<<<<<<<<<<< + * dimB = dB / pixels_per_metric_X * */ - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_dA, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_dimA, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":148 - * # compute the size of the electrode object - * dimA = dA / pixels_per_metric_Y # y - * dimB = dB / pixels_per_metric_X # x # <<<<<<<<<<<<<< + /* "dopt_sensor_anomalies/detection.py":121 + * + * dimA = dA / pixels_per_metric_Y + * dimB = dB / pixels_per_metric_X # <<<<<<<<<<<<<< * * data_csv.extend( */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_v_dB, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_v_dB, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_dimB, __pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":152 + /* "dopt_sensor_anomalies/detection.py":125 * data_csv.extend( * [ * f"{dimB:.3f}".replace(".", ","), # <<<<<<<<<<<<<< * f"{dimA:.3f}".replace(".", ","), * f"{dimA * dimB:.1f}".replace(".", ","), */ - __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimB, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimB, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":153 + /* "dopt_sensor_anomalies/detection.py":126 * [ * f"{dimB:.3f}".replace(".", ","), * f"{dimA:.3f}".replace(".", ","), # <<<<<<<<<<<<<< * f"{dimA * dimB:.1f}".replace(".", ","), * ] */ - __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimA, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Format(__pyx_v_dimA, __pyx_mstate_global->__pyx_kp_u_3f); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_16 = PyUnicode_Replace(((PyObject*)__pyx_t_9), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":154 + /* "dopt_sensor_anomalies/detection.py":127 * f"{dimB:.3f}".replace(".", ","), * f"{dimA:.3f}".replace(".", ","), * f"{dimA * dimB:.1f}".replace(".", ","), # <<<<<<<<<<<<<< * ] * ) */ - __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_9 = PyNumber_Multiply(__pyx_v_dimA, __pyx_v_dimB); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_1f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyUnicode_Replace(((PyObject*)__pyx_t_8), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_9 = PyUnicode_Replace(((PyObject*)__pyx_t_8), __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":150 - * dimB = dB / pixels_per_metric_X # x + /* "dopt_sensor_anomalies/detection.py":123 + * dimB = dB / pixels_per_metric_X * * data_csv.extend( # <<<<<<<<<<<<<< * [ * f"{dimB:.3f}".replace(".", ","), */ - __pyx_t_17 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error) - __pyx_t_18 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_16); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_data_csv, __pyx_t_9); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_17 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_18 = __Pyx_ListComp_Append(__pyx_v_data_csv, __pyx_t_16); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_data_csv, __pyx_t_9); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (void)((__pyx_t_17 | (__pyx_t_18 | __pyx_t_19))); - /* "dopt_sensor_anomalies/detection.py":108 + /* "dopt_sensor_anomalies/detection.py":93 + * filtered_cnts: list[Any] = [] * - * # loop over the contours individually * for c in cnts: # <<<<<<<<<<<<<< - * # compute the rotated bounding box of the contour * rbox = cast(t.Box, cv2.minAreaRect(c)) + * box = cv2.boxPoints(rbox) */ __pyx_L17_continue:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":158 + /* "dopt_sensor_anomalies/detection.py":131 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7641,14 +7636,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); - if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 131, __pyx_L1_error) __pyx_t_14 = (__pyx_temp != 0); } __pyx_t_6 = (!__pyx_t_14); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":159 + /* "dopt_sensor_anomalies/detection.py":132 * * if not filtered_cnts: * raise errors.ContourCalculationError( # <<<<<<<<<<<<<< @@ -7656,9 +7651,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_ContourCalculationError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7678,14 +7673,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 159, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":158 + /* "dopt_sensor_anomalies/detection.py":131 * ) * * if not filtered_cnts: # <<<<<<<<<<<<<< @@ -7694,38 +7689,38 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":164 + /* "dopt_sensor_anomalies/detection.py":136 + * ) * - * # if incorrect number of electrodes has been identified * num_contours = len(filtered_cnts) # <<<<<<<<<<<<<< * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( */ - __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_filtered_cnts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) __pyx_v_num_contours = __pyx_t_12; - /* "dopt_sensor_anomalies/detection.py":165 - * # if incorrect number of electrodes has been identified + /* "dopt_sensor_anomalies/detection.py":137 + * * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " */ - __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_num_contours); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":166 + /* "dopt_sensor_anomalies/detection.py":138 * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( # <<<<<<<<<<<<<< @@ -7733,27 +7728,27 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidElectrodeCount); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidElectrodeCount); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":168 + /* "dopt_sensor_anomalies/detection.py":140 * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " * f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}" # <<<<<<<<<<<<<< * ) * */ - __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_num_contours, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_num_contours, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NUM_VALID_ELECTRODES); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_Number_of_counted_electrodes_doe; @@ -7761,7 +7756,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_expected; __pyx_t_20[3] = __pyx_t_8; - /* "dopt_sensor_anomalies/detection.py":167 + /* "dopt_sensor_anomalies/detection.py":139 * if num_contours != const.NUM_VALID_ELECTRODES: * raise errors.InvalidElectrodeCount( * f"Number of counted electrodes does not match the " # <<<<<<<<<<<<<< @@ -7769,7 +7764,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT * ) */ __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_20, 4, 72 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8)); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -7791,15 +7786,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 166, __pyx_L1_error) + __PYX_ERR(0, 138, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":165 - * # if incorrect number of electrodes has been identified + /* "dopt_sensor_anomalies/detection.py":137 + * * num_contours = len(filtered_cnts) * if num_contours != const.NUM_VALID_ELECTRODES: # <<<<<<<<<<<<<< * raise errors.InvalidElectrodeCount( @@ -7807,9 +7802,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ } - /* "dopt_sensor_anomalies/detection.py":172 + /* "dopt_sensor_anomalies/detection.py":143 + * ) * - * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -7817,7 +7812,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_11 = __pyx_builtin_min; - __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_1 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_6genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = 1; { @@ -7826,17 +7821,17 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } - __pyx_t_11 = __Pyx_PyLong_SubtractObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_SubtractObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_x_min = __pyx_t_11; __pyx_t_11 = 0; - /* "dopt_sensor_anomalies/detection.py":173 - * # identify left and right sensor areas + /* "dopt_sensor_anomalies/detection.py":144 + * * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 @@ -7845,7 +7840,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_1 = __pyx_builtin_max; - __pyx_t_16 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_16 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_9genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __pyx_t_5 = 1; { @@ -7854,16 +7849,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } - __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_x_max = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":174 + /* "dopt_sensor_anomalies/detection.py":145 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< @@ -7873,7 +7868,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_16 = __pyx_builtin_min; - __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_9 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_12genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 1; { @@ -7882,16 +7877,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_16 = __Pyx_PyLong_SubtractObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyLong_SubtractObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_y_min = __pyx_t_16; __pyx_t_16 = 0; - /* "dopt_sensor_anomalies/detection.py":175 + /* "dopt_sensor_anomalies/detection.py":146 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 # <<<<<<<<<<<<<< @@ -7901,7 +7896,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_1 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_9 = __pyx_builtin_max; - __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_11 = __pyx_pf_21dopt_sensor_anomalies_9detection_14measure_length_15genexpr(NULL, __pyx_v_filtered_cnts); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = 1; { @@ -7910,16 +7905,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); } - __pyx_t_9 = __Pyx_PyLong_AddObjC(__pyx_t_16, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyLong_AddObjC(__pyx_t_16, __pyx_mstate_global->__pyx_int_20, 20, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_v_y_max = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":177 + /* "dopt_sensor_anomalies/detection.py":148 * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7929,9 +7924,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_16 = NULL; __Pyx_INCREF(__pyx_builtin_max); __pyx_t_11 = __pyx_builtin_max; - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 2, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 2, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = 1; @@ -7941,13 +7936,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 177, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __pyx_v_rightmost_x_third = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":178 + /* "dopt_sensor_anomalies/detection.py":149 * * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) # <<<<<<<<<<<<<< @@ -7957,9 +7952,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __pyx_t_11 = NULL; __Pyx_INCREF(__pyx_builtin_min); __pyx_t_8 = __pyx_builtin_min; - __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 3, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_filtered_cnts, 3, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_mstate_global->__pyx_tuple[0]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_5 = 1; @@ -7969,84 +7964,84 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); } __pyx_v_leftmost_x_fourth = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":179 + /* "dopt_sensor_anomalies/detection.py":150 * rightmost_x_third = max(filtered_cnts[2][:, 0, 0]) * leftmost_x_fourth = min(filtered_cnts[3][:, 0, 0]) * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) # <<<<<<<<<<<<<< * - * # perform further cropping and separation of left and right sensor + * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] */ - __pyx_t_9 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_9 = PyNumber_Subtract(__pyx_v_leftmost_x_fourth, __pyx_v_rightmost_x_third); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_8 = PyNumber_Add(__pyx_v_rightmost_x_third, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_x_middle = __pyx_t_8; __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":182 + /* "dopt_sensor_anomalies/detection.py":152 + * x_middle = rightmost_x_third + int((leftmost_x_fourth - rightmost_x_third) / 2.0) * - * # perform further cropping and separation of left and right sensor * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] # <<<<<<<<<<<<<< * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] * */ - __pyx_t_8 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_8 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_9 = PySlice_New(__pyx_v_x_min, __pyx_v_x_middle, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_8); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 152, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 152, __pyx_L1_error); __pyx_t_8 = 0; __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cropped_sensor_left = __pyx_t_9; __pyx_t_9 = 0; - /* "dopt_sensor_anomalies/detection.py":183 - * # perform further cropping and separation of left and right sensor + /* "dopt_sensor_anomalies/detection.py":153 + * * cropped_sensor_left = orig[y_min:y_max, x_min:x_middle] * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] # <<<<<<<<<<<<<< * * return data_csv, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) */ - __pyx_t_9 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_9 = PySlice_New(__pyx_v_y_min, __pyx_v_y_max, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_1 = PySlice_New(__pyx_v_x_middle, __pyx_v_x_max, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 153, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 153, __pyx_L1_error); __pyx_t_9 = 0; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_orig, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_cropped_sensor_right = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":185 + /* "dopt_sensor_anomalies/detection.py":155 * cropped_sensor_right = orig[y_min:y_max, x_middle:x_max] * * return data_csv, t.SensorImages(left=cropped_sensor_left, right=cropped_sensor_right) # <<<<<<<<<<<<<< @@ -8055,9 +8050,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_SensorImages); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = 1; @@ -8074,32 +8069,32 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL}; - __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_left, __pyx_v_cropped_sensor_left, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_right, __pyx_v_cropped_sensor_right, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_left, __pyx_v_cropped_sensor_left, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_right, __pyx_v_cropped_sensor_right, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_11, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_data_csv); __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 185, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 155, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 185, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 155, __pyx_L1_error); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":65 + /* "dopt_sensor_anomalies/detection.py":55 + * * - * # ** main function * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, @@ -8175,9 +8170,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_4measure_length(CYT return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":190 - * # helper function - * # anomaly detection +/* "dopt_sensor_anomalies/detection.py":158 + * + * * def infer_image( # <<<<<<<<<<<<<< * image: npt.NDArray[np.uint8], * model: Patchcore, @@ -8223,39 +8218,39 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_image,&__pyx_mstate_global->__pyx_n_u_model,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 190, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 158, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 190, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 158, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 190, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "infer_image", 0) < (0)) __PYX_ERR(0, 190, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "infer_image", 0) < (0)) __PYX_ERR(0, 158, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, i); __PYX_ERR(0, 190, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, i); __PYX_ERR(0, 158, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 190, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 190, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 158, __pyx_L3_error) } __pyx_v_image = values[0]; __pyx_v_model = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 190, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("infer_image", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 158, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8311,7 +8306,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON int __pyx_clineno = 0; __Pyx_RefNannySetupContext("infer_image", 0); - /* "dopt_sensor_anomalies/detection.py":194 + /* "dopt_sensor_anomalies/detection.py":162 * model: Patchcore, * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # <<<<<<<<<<<<<< @@ -8319,14 +8314,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_cuda); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_cuda); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_8; @@ -8337,10 +8332,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_available, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_10) { __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cuda); @@ -8367,13 +8362,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_torch_device = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":195 + /* "dopt_sensor_anomalies/detection.py":163 * ) -> t.InferenceResult: * torch_device = torch.device("cuda" if torch.cuda.is_available() else "cpu") * model.to(torch_device) # <<<<<<<<<<<<<< @@ -8387,12 +8382,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_torch_device}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":197 + /* "dopt_sensor_anomalies/detection.py":165 * model.to(torch_device) * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # <<<<<<<<<<<<<< @@ -8400,14 +8395,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * pil_image = pil_image.convert("RGB") */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cvtColor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2RGB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_COLOR_BGR2RGB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -8428,13 +8423,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_image_rgb = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":198 + /* "dopt_sensor_anomalies/detection.py":166 * * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) # <<<<<<<<<<<<<< @@ -8442,9 +8437,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * image_np = np.array(pil_image).astype(np.float32) / 255.0 */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Image); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_fromarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_fromarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -8464,13 +8459,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_pil_image = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":199 + /* "dopt_sensor_anomalies/detection.py":167 * image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") # <<<<<<<<<<<<<< @@ -8484,13 +8479,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RGB}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_convert, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF_SET(__pyx_v_pil_image, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":200 + /* "dopt_sensor_anomalies/detection.py":168 * pil_image = Image.fromarray(image_rgb) * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 # <<<<<<<<<<<<<< @@ -8498,9 +8493,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; @@ -8520,14 +8515,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = 0; @@ -8537,16 +8532,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_255_0, 255.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_255_0, 255.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_image_np = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":201 + /* "dopt_sensor_anomalies/detection.py":169 * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) # <<<<<<<<<<<<<< @@ -8554,9 +8549,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON * input_tensor = input_tensor.unsqueeze(0) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = 1; @@ -8576,19 +8571,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_permute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_permute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_input_tensor = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":203 + /* "dopt_sensor_anomalies/detection.py":171 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) * * input_tensor = input_tensor.unsqueeze(0) # <<<<<<<<<<<<<< @@ -8602,13 +8597,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_0}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_unsqueeze, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":204 + /* "dopt_sensor_anomalies/detection.py":172 * * input_tensor = input_tensor.unsqueeze(0) * input_tensor = input_tensor.to(torch_device) # <<<<<<<<<<<<<< @@ -8622,13 +8617,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_torch_device}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF_SET(__pyx_v_input_tensor, __pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":206 + /* "dopt_sensor_anomalies/detection.py":174 * input_tensor = input_tensor.to(torch_device) * * model.eval() # <<<<<<<<<<<<<< @@ -8642,12 +8637,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":207 + /* "dopt_sensor_anomalies/detection.py":175 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8656,9 +8651,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ /*with:*/ { __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_no_grad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_no_grad); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; @@ -8678,13 +8673,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_4 = NULL; - __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS @@ -8703,7 +8698,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L3_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -8718,7 +8713,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { - /* "dopt_sensor_anomalies/detection.py":208 + /* "dopt_sensor_anomalies/detection.py":176 * model.eval() * with torch.no_grad(): * output = model(input_tensor) # <<<<<<<<<<<<<< @@ -8745,13 +8740,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L7_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_output = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":207 + /* "dopt_sensor_anomalies/detection.py":175 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< @@ -8774,20 +8769,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { __Pyx_AddTraceback("dopt_sensor_anomalies.detection.infer_image", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 207, __pyx_L9_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 175, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L9_except_error) + __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 207, __pyx_L9_except_error) + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 175, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_10 < (0)) __PYX_ERR(0, 207, __pyx_L9_except_error) + if (__pyx_t_10 < (0)) __PYX_ERR(0, 175, __pyx_L9_except_error) __pyx_t_16 = (!__pyx_t_10); if (unlikely(__pyx_t_16)) { __Pyx_GIVEREF(__pyx_t_2); @@ -8795,7 +8790,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_5); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; - __PYX_ERR(0, 207, __pyx_L9_except_error) + __PYX_ERR(0, 175, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8821,7 +8816,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON if (__pyx_t_11) { __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_mstate_global->__pyx_tuple[4], NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 207, __pyx_L1_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } @@ -8836,15 +8831,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_L16:; } - /* "dopt_sensor_anomalies/detection.py":210 + /* "dopt_sensor_anomalies/detection.py":178 * output = model(input_tensor) * * anomaly_score = output.pred_score.item() # <<<<<<<<<<<<<< * anomaly_label = output.pred_label.item() * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 210, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 178, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_score); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); @@ -8854,21 +8849,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_item, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_score = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":211 + /* "dopt_sensor_anomalies/detection.py":179 * * anomaly_score = output.pred_score.item() * anomaly_label = output.pred_label.item() # <<<<<<<<<<<<<< * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 211, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 179, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_pred_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); @@ -8878,21 +8873,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_item, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_label = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":212 + /* "dopt_sensor_anomalies/detection.py":180 * anomaly_score = output.pred_score.item() * anomaly_label = output.pred_label.item() * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() # <<<<<<<<<<<<<< * - * # resize heatmap to original image size + * img_np = np.array(pil_image) */ - if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 212, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); __PYX_ERR(0, 180, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_mstate_global->__pyx_n_u_anomaly_map); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); @@ -8902,7 +8897,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_squeeze, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_4 = __pyx_t_8; @@ -8913,7 +8908,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cpu, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_1 = __pyx_t_2; @@ -8924,23 +8919,23 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_numpy, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_map = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":215 + /* "dopt_sensor_anomalies/detection.py":182 + * anomaly_map = output.anomaly_map.squeeze().cpu().numpy() * - * # resize heatmap to original image size * img_np = np.array(pil_image) # <<<<<<<<<<<<<< * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; @@ -8960,41 +8955,41 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_img_np = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":216 - * # resize heatmap to original image size + /* "dopt_sensor_anomalies/detection.py":183 + * * img_np = np.array(pil_image) * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) # <<<<<<<<<<<<<< * * return t.InferenceResult( */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cv2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_resize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_np, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 216, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 216, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 183, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_9 = 1; @@ -9015,13 +9010,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_v_anomaly_map_resized = __pyx_t_5; __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":218 + /* "dopt_sensor_anomalies/detection.py":185 * anomaly_map_resized = cv2.resize(anomaly_map, (img_np.shape[1], img_np.shape[0])) * * return t.InferenceResult( # <<<<<<<<<<<<<< @@ -9030,13 +9025,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InferenceResult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_sensor_anomalies/detection.py":222 + /* "dopt_sensor_anomalies/detection.py":189 * anomaly_map_resized=anomaly_map_resized, * anomaly_score=anomaly_score, * anomaly_label=anomaly_label, # <<<<<<<<<<<<<< @@ -9057,26 +9052,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_1, NULL}; - __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_v_anomaly_label, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img, __pyx_v_img_np, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_map_resized, __pyx_v_anomaly_map_resized, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_score, __pyx_v_anomaly_score, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_anomaly_label, __pyx_v_anomaly_label, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "dopt_sensor_anomalies/detection.py":190 - * # helper function - * # anomaly detection + /* "dopt_sensor_anomalies/detection.py":158 + * + * * def infer_image( # <<<<<<<<<<<<<< * image: npt.NDArray[np.uint8], * model: Patchcore, @@ -9111,9 +9106,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_6infer_image(CYTHON return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":227 +/* "dopt_sensor_anomalies/detection.py":193 + * * - * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< * img_path: Path, * detection_models: t.DetectionModels, @@ -9161,44 +9156,44 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_img_path,&__pyx_mstate_global->__pyx_n_u_detection_models,&__pyx_mstate_global->__pyx_n_u_data_csv,&__pyx_mstate_global->__pyx_n_u_sensor_images,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 227, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 193, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "anomaly_detection", 0) < (0)) __PYX_ERR(0, 227, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "anomaly_detection", 0) < (0)) __PYX_ERR(0, 193, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, i); __PYX_ERR(0, 227, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, i); __PYX_ERR(0, 193, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 193, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 193, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 193, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 227, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 193, __pyx_L3_error) } __pyx_v_img_path = values[0]; __pyx_v_detection_models = values[1]; @@ -9207,7 +9202,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 227, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("anomaly_detection", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 193, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9263,61 +9258,61 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("anomaly_detection", 0); - /* "dopt_sensor_anomalies/detection.py":233 + /* "dopt_sensor_anomalies/detection.py":199 * sensor_images: t.SensorImages, * ) -> None: * file_stem = img_path.stem # <<<<<<<<<<<<<< * folder_path = img_path.parent * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_stem); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_file_stem = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":234 + /* "dopt_sensor_anomalies/detection.py":200 * ) -> None: * file_stem = img_path.stem * folder_path = img_path.parent # <<<<<<<<<<<<<< * - * # reconstruct the model and initialize the engine + * model = Patchcore( */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_img_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_folder_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":237 + /* "dopt_sensor_anomalies/detection.py":202 + * folder_path = img_path.parent * - * # reconstruct the model and initialize the engine * model = Patchcore( # <<<<<<<<<<<<<< * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Patchcore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":238 - * # reconstruct the model and initialize the engine + /* "dopt_sensor_anomalies/detection.py":203 + * * model = Patchcore( * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO # <<<<<<<<<<<<<< * ) - * # preparation for plot + * _, axes = plt.subplots(1, 2, figsize=(12, 6)) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_BACKBONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_BACKBONE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LAYERS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LAYERS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RATIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_RATIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = 1; @@ -9334,11 +9329,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_2, NULL}; - __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_backbone, __pyx_t_5, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 237, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_layers, __pyx_t_6, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 237, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_coreset_sampling_ratio, __pyx_t_7, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 237, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_backbone, __pyx_t_5, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_layers, __pyx_t_6, __pyx_t_4, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_coreset_sampling_ratio, __pyx_t_7, __pyx_t_4, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9346,28 +9341,28 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_model = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":241 + /* "dopt_sensor_anomalies/detection.py":205 + * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) - * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< - * # loop over left and right sensor + * * for i, (side, image) in enumerate(sensor_images.items()): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_figsize, __pyx_mstate_global->__pyx_tuple[6]) < (0)) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_figsize, __pyx_mstate_global->__pyx_tuple[6]) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9377,7 +9372,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 241, __pyx_L1_error) + __PYX_ERR(0, 205, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9387,22 +9382,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); } #else - __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __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_ERR(0, 241, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); @@ -9410,7 +9405,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 241, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L4_unpacking_done; @@ -9418,7 +9413,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 241, __pyx_L1_error) + __PYX_ERR(0, 205, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v__ = __pyx_t_1; @@ -9426,21 +9421,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_v_axes = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_sensor_anomalies/detection.py":243 + /* "dopt_sensor_anomalies/detection.py":207 * _, axes = plt.subplots(1, 2, figsize=(12, 6)) - * # loop over left and right sensor + * * for i, (side, image) in enumerate(sensor_images.items()): # <<<<<<<<<<<<<< - * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt * image = cast(npt.NDArray[np.uint8], image) + * checkpoint = torch.load(detection_models[side]) */ __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; __pyx_t_10 = 0; if (unlikely(__pyx_v_sensor_images == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 243, __pyx_L1_error) + __PYX_ERR(0, 207, __pyx_L1_error) } - __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_sensor_images, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_1; @@ -9448,7 +9443,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( while (1) { __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_10, &__pyx_t_1, &__pyx_t_7, NULL, __pyx_t_12); if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 243, __pyx_L1_error) + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_side, __pyx_t_1); @@ -9457,33 +9452,33 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":245 + /* "dopt_sensor_anomalies/detection.py":208 + * * for i, (side, image) in enumerate(sensor_images.items()): - * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt * image = cast(npt.NDArray[np.uint8], image) # <<<<<<<<<<<<<< * checkpoint = torch.load(detection_models[side]) * model.load_state_dict(checkpoint["model_state_dict"]) */ __pyx_t_1 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_npt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NDArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -9505,26 +9500,26 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 245, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF_SET(__pyx_v_image, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":246 - * # Ich habe die Modellpfade als Funktionsparameter hinzugefgt + /* "dopt_sensor_anomalies/detection.py":209 + * for i, (side, image) in enumerate(sensor_images.items()): * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) # <<<<<<<<<<<<<< * model.load_state_dict(checkpoint["model_state_dict"]) * */ __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_torch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_detection_models, __pyx_v_side); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS @@ -9544,13 +9539,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_checkpoint, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":247 + /* "dopt_sensor_anomalies/detection.py":210 * image = cast(npt.NDArray[np.uint8], image) * checkpoint = torch.load(detection_models[side]) * model.load_state_dict(checkpoint["model_state_dict"]) # <<<<<<<<<<<<<< @@ -9559,7 +9554,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_model; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_checkpoint, __pyx_mstate_global->__pyx_n_u_model_state_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 0; { @@ -9567,12 +9562,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_load_state_dict, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":249 + /* "dopt_sensor_anomalies/detection.py":212 * model.load_state_dict(checkpoint["model_state_dict"]) * * result = infer_image(image, model) # <<<<<<<<<<<<<< @@ -9580,7 +9575,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infer_image); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS @@ -9599,13 +9594,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":250 + /* "dopt_sensor_anomalies/detection.py":213 * * result = infer_image(image, model) * data_csv.extend([int(result.anomaly_label)]) # <<<<<<<<<<<<<< @@ -9614,15 +9609,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_data_csv; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 250, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 213, __pyx_L1_error); __pyx_t_6 = 0; __pyx_t_8 = 0; { @@ -9630,24 +9625,24 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":252 + /* "dopt_sensor_anomalies/detection.py":215 * data_csv.extend([int(result.anomaly_label)]) * * ax = axes[i] # <<<<<<<<<<<<<< * ax.axis("off") * ax.imshow(image, alpha=0.8) */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_axes, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_ax, __pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":253 + /* "dopt_sensor_anomalies/detection.py":216 * * ax = axes[i] * ax.axis("off") # <<<<<<<<<<<<<< @@ -9661,12 +9656,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_off}; __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_axis, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":254 + /* "dopt_sensor_anomalies/detection.py":217 * ax = axes[i] * ax.axis("off") * ax.imshow(image, alpha=0.8) # <<<<<<<<<<<<<< @@ -9678,18 +9673,18 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_image}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_8, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 217, __pyx_L1_error) __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":255 + /* "dopt_sensor_anomalies/detection.py":218 * ax.axis("off") * ax.imshow(image, alpha=0.8) * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) # <<<<<<<<<<<<<< @@ -9698,20 +9693,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( */ __pyx_t_1 = __pyx_v_ax; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_mstate_global->__pyx_n_u_anomaly_map_resized); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_t_5}; - __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 255, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cmap, __pyx_mstate_global->__pyx_n_u_jet, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alpha, __pyx_mstate_global->__pyx_float_0_5, __pyx_t_6, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 218, __pyx_L1_error) __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_imshow, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -9719,7 +9714,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":257 + /* "dopt_sensor_anomalies/detection.py":220 * ax.imshow(result.anomaly_map_resized, cmap="jet", alpha=0.5) * * plt.subplots_adjust(wspace=0, hspace=0) # <<<<<<<<<<<<<< @@ -9727,9 +9722,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_subplots_adjust); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = 1; @@ -9746,20 +9741,20 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, NULL}; - __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_wspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hspace, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":258 + /* "dopt_sensor_anomalies/detection.py":221 * * plt.subplots_adjust(wspace=0, hspace=0) * plt.savefig( # <<<<<<<<<<<<<< @@ -9767,38 +9762,38 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * bbox_inches="tight", */ __pyx_t_6 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_savefig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "dopt_sensor_anomalies/detection.py":259 + /* "dopt_sensor_anomalies/detection.py":222 * plt.subplots_adjust(wspace=0, hspace=0) * plt.savefig( * (folder_path / f"{file_stem}{const.HEATMAP_FILENAME_SUFFIX}.png"), # <<<<<<<<<<<<<< * bbox_inches="tight", * pad_inches=0, */ - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_const); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_HEATMAP_FILENAME_SUFFIX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_15[0] = __pyx_t_7; __pyx_t_15[1] = __pyx_t_5; __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u_png; __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 4, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = 1; @@ -9815,21 +9810,21 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 258, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bbox_inches, __pyx_mstate_global->__pyx_n_u_tight, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 221, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pad_inches, __pyx_mstate_global->__pyx_int_0, __pyx_t_1, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 221, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":263 + /* "dopt_sensor_anomalies/detection.py":226 * pad_inches=0, * ) * plt.close() # <<<<<<<<<<<<<< @@ -9837,9 +9832,9 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * df = DataFrame([data_csv]) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = 1; @@ -9859,12 +9854,12 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":265 + /* "dopt_sensor_anomalies/detection.py":228 * plt.close() * * df = DataFrame([data_csv]) # <<<<<<<<<<<<<< @@ -9872,13 +9867,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( * (folder_path / f"{file_stem}.csv"), */ __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_data_csv); __Pyx_GIVEREF(__pyx_v_data_csv); - if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 265, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_data_csv) != (0)) __PYX_ERR(0, 228, __pyx_L1_error); __pyx_t_8 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { @@ -9897,13 +9892,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_v_df = __pyx_t_4; __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":266 + /* "dopt_sensor_anomalies/detection.py":229 * * df = DataFrame([data_csv]) * df.to_csv( # <<<<<<<<<<<<<< @@ -9913,57 +9908,57 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( __pyx_t_3 = __pyx_v_df; __Pyx_INCREF(__pyx_t_3); - /* "dopt_sensor_anomalies/detection.py":267 + /* "dopt_sensor_anomalies/detection.py":230 * df = DataFrame([data_csv]) * df.to_csv( * (folder_path / f"{file_stem}.csv"), # <<<<<<<<<<<<<< * mode="w", * index=False, */ - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_file_stem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_folder_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":271 + /* "dopt_sensor_anomalies/detection.py":234 * index=False, * header=False, * quoting=csv.QUOTE_NONE, # <<<<<<<<<<<<<< * sep=";", * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_csv_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_QUOTE_NONE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 5 : 0)] = {__pyx_t_3, __pyx_t_1}; - __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L1_error) + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_5, __pyx_callargs+2, 4) < (0)) __PYX_ERR(0, 266, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_mstate_global->__pyx_n_u_w, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_False, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_header, Py_False, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_quoting, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 3) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sep, __pyx_mstate_global->__pyx_kp_u__4, __pyx_t_5, __pyx_callargs+2, 4) < (0)) __PYX_ERR(0, 229, __pyx_L1_error) __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_to_csv, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":227 + /* "dopt_sensor_anomalies/detection.py":193 + * * - * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< * img_path: Path, * detection_models: t.DetectionModels, @@ -10001,7 +9996,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_8anomaly_detection( return __pyx_r; } -/* "dopt_sensor_anomalies/detection.py":276 +/* "dopt_sensor_anomalies/detection.py":239 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< @@ -10050,46 +10045,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_user_img_path,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_X,&__pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 276, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 239, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 239, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 239, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 239, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < (0)) __PYX_ERR(0, 276, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipeline", 0) < (0)) __PYX_ERR(0, 239, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, i); __PYX_ERR(0, 276, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, i); __PYX_ERR(0, 239, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 239, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 239, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 276, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 239, __pyx_L3_error) } __pyx_v_user_img_path = ((PyObject*)values[0]); - __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L3_error) - __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 280, __pyx_L3_error) + __pyx_v_pixels_per_metric_X = __Pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_pixels_per_metric_X == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_pixels_per_metric_Y = __Pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pixels_per_metric_Y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 276, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("pipeline", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 239, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10100,7 +10095,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_img_path), (&PyUnicode_Type), 0, "user_img_path", 2))) __PYX_ERR(0, 278, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_img_path), (&PyUnicode_Type), 0, "user_img_path", 2))) __PYX_ERR(0, 241, __pyx_L1_error) __pyx_r = __pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(__pyx_self, __pyx_v_user_img_path, __pyx_v_pixels_per_metric_X, __pyx_v_pixels_per_metric_Y); /* function exit code */ @@ -10142,7 +10137,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pipeline", 0); - /* "dopt_sensor_anomalies/detection.py":282 + /* "dopt_sensor_anomalies/detection.py":245 * pixels_per_metric_Y: float, * ) -> None: * file_path = Path(user_img_path) # <<<<<<<<<<<<<< @@ -10150,7 +10145,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * raise FileNotFoundError("The provided path seems not to exist") */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10169,13 +10164,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_file_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":283 + /* "dopt_sensor_anomalies/detection.py":246 * ) -> None: * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -10189,15 +10184,15 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { - /* "dopt_sensor_anomalies/detection.py":284 + /* "dopt_sensor_anomalies/detection.py":247 * file_path = Path(user_img_path) * if not file_path.exists(): * raise FileNotFoundError("The provided path seems not to exist") # <<<<<<<<<<<<<< @@ -10213,14 +10208,14 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 284, __pyx_L1_error) + __PYX_ERR(0, 247, __pyx_L1_error) - /* "dopt_sensor_anomalies/detection.py":283 + /* "dopt_sensor_anomalies/detection.py":246 * ) -> None: * file_path = Path(user_img_path) * if not file_path.exists(): # <<<<<<<<<<<<<< @@ -10229,16 +10224,16 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U */ } - /* "dopt_sensor_anomalies/detection.py":286 + /* "dopt_sensor_anomalies/detection.py":249 * raise FileNotFoundError("The provided path seems not to exist") * * MODEL_FOLDER: Final[Path] = dopt_sensor_anomalies._find_paths.get_model_folder() # <<<<<<<<<<<<<< * DETECTION_MODELS: Final[t.DetectionModels] = ( * dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_7; @@ -10249,22 +10244,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_model_folder, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_MODEL_FOLDER = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":288 + /* "dopt_sensor_anomalies/detection.py":251 * MODEL_FOLDER: Final[Path] = dopt_sensor_anomalies._find_paths.get_model_folder() * DETECTION_MODELS: Final[t.DetectionModels] = ( * dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER) # <<<<<<<<<<<<<< * ) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_find_paths); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __pyx_t_3; @@ -10275,13 +10270,13 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_detection_models, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_DETECTION_MODELS = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":291 + /* "dopt_sensor_anomalies/detection.py":254 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10289,19 +10284,19 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * ) */ __pyx_t_3 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_measure_length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":292 + /* "dopt_sensor_anomalies/detection.py":255 * * data_csv, sensor_images = measure_length( * file_path, pixels_per_metric_X, pixels_per_metric_Y # <<<<<<<<<<<<<< * ) * anomaly_detection( */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pixels_per_metric_Y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS @@ -10322,7 +10317,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -10331,7 +10326,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 291, __pyx_L1_error) + __PYX_ERR(0, 254, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -10341,22 +10336,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_INCREF(__pyx_t_8); } else { __pyx_t_7 = __Pyx_PyList_GetItemRef(sequence, 0); - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 1); - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_8); } #else - __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); @@ -10364,7 +10359,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 291, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 254, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L5_unpacking_done; @@ -10372,11 +10367,11 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 291, __pyx_L1_error) + __PYX_ERR(0, 254, __pyx_L1_error) __pyx_L5_unpacking_done:; } - /* "dopt_sensor_anomalies/detection.py":291 + /* "dopt_sensor_anomalies/detection.py":254 * ) * * data_csv, sensor_images = measure_length( # <<<<<<<<<<<<<< @@ -10388,7 +10383,7 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U __pyx_v_sensor_images = __pyx_t_8; __pyx_t_8 = 0; - /* "dopt_sensor_anomalies/detection.py":294 + /* "dopt_sensor_anomalies/detection.py":257 * file_path, pixels_per_metric_X, pixels_per_metric_Y * ) * anomaly_detection( # <<<<<<<<<<<<<< @@ -10396,10 +10391,10 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U * detection_models=DETECTION_MODELS, */ __pyx_t_8 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_anomaly_detection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "dopt_sensor_anomalies/detection.py":298 + /* "dopt_sensor_anomalies/detection.py":261 * detection_models=DETECTION_MODELS, * data_csv=data_csv, * sensor_images=sensor_images, # <<<<<<<<<<<<<< @@ -10419,22 +10414,22 @@ static PyObject *__pyx_pf_21dopt_sensor_anomalies_9detection_10pipeline(CYTHON_U #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_8, NULL}; - __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img_path, __pyx_v_file_path, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 294, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_detection_models, __pyx_v_DETECTION_MODELS, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 294, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data_csv, __pyx_v_data_csv, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 294, __pyx_L1_error) - if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_v_sensor_images, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 294, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_img_path, __pyx_v_file_path, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_detection_models, __pyx_v_DETECTION_MODELS, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data_csv, __pyx_v_data_csv, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_v_sensor_images, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_7, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_sensor_anomalies/detection.py":276 + /* "dopt_sensor_anomalies/detection.py":239 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< @@ -11673,15 +11668,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length)) __PYX_ERR(0, 65, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct__measure_length->tp_getattro == PyObject_GenericGetAttr)) { @@ -11689,15 +11684,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 97, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 84, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11705,15 +11700,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 137, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 112, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 137, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11721,15 +11716,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 172, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 143, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 172, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11737,15 +11732,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 173, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 144, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11753,15 +11748,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 174, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 145, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 145, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 174, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 145, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_5_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -11769,15 +11764,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 175, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 146, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr = &__pyx_type_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 175, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_21dopt_sensor_anomalies_9detection___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) { @@ -12460,170 +12455,130 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); /* "dopt_sensor_anomalies/detection.py":32 * - * # input parameters: user-defined - * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") # <<<<<<<<<<<<<< - * pixels_per_metric_X: float = 0.251 - * pixels_per_metric_Y: float = 0.251 -*/ - __pyx_t_5 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = 1; - { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_C_Users_demon_Documents_EKF_Anal}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_file_path, __pyx_t_3) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dopt_sensor_anomalies/detection.py":33 - * # input parameters: user-defined - * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") - * pixels_per_metric_X: float = 0.251 # <<<<<<<<<<<<<< - * pixels_per_metric_Y: float = 0.251 * -*/ - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) - - /* "dopt_sensor_anomalies/detection.py":34 - * file_path: Path = Path(r"C:\Users\demon\Documents\EKF\Analyse_fuer_Florian\bild2.bmp") - * pixels_per_metric_X: float = 0.251 - * pixels_per_metric_Y: float = 0.251 # <<<<<<<<<<<<<< - * - * -*/ - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_float_0_251) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) - - /* "dopt_sensor_anomalies/detection.py":38 - * - * # measuring * def midpoint( # <<<<<<<<<<<<<< * pt_A: npt.NDArray[np.floating], * pt_B: npt.NDArray[np.floating], */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint, 0, __pyx_mstate_global->__pyx_n_u_midpoint, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_A, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pt_B, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_floating) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_float_float) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_1midpoint, 0, __pyx_mstate_global->__pyx_n_u_midpoint, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_midpoint, __pyx_t_4) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_midpoint, __pyx_t_5) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":48 + /* "dopt_sensor_anomalies/detection.py":42 * box_1: t.Box, * box_2: t.Box, * tolerance: float = 5.0, # <<<<<<<<<<<<<< * ) -> bool: - * # unpack the boxes + * c1, s1, _ = box_1 */ - __pyx_t_4 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyFloat_FromDouble(((double)5.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "dopt_sensor_anomalies/detection.py":45 + /* "dopt_sensor_anomalies/detection.py":39 * * * def check_box_redundancy( # <<<<<<<<<<<<<< * box_1: t.Box, * box_2: t.Box, */ - __pyx_t_3 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_3 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy, 0, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_5) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_box_1, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_box_2, __pyx_mstate_global->__pyx_kp_u_t_Box) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_bool) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_3check_box_redundancy, 0, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_check_box_redundancy, __pyx_t_4) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":65 + /* "dopt_sensor_anomalies/detection.py":55 + * * - * # ** main function * def measure_length( # <<<<<<<<<<<<<< * img_path: Path, * pixels_per_metric_X: float, */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_CsvData_t_SensorImages) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length, 0, __pyx_mstate_global->__pyx_n_u_measure_length, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_4) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_tuple_t_CsvData_t_SensorImages) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_5measure_length, 0, __pyx_mstate_global->__pyx_n_u_measure_length, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_measure_length, __pyx_t_5) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":190 - * # helper function - * # anomaly detection + /* "dopt_sensor_anomalies/detection.py":158 + * + * * def infer_image( # <<<<<<<<<<<<<< * image: npt.NDArray[np.uint8], * model: Patchcore, */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image, 0, __pyx_mstate_global->__pyx_n_u_infer_image, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_5) < (0)) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_image, __pyx_mstate_global->__pyx_kp_u_npt_NDArray_np_uint8) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_model, __pyx_mstate_global->__pyx_n_u_Patchcore) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_t_InferenceResult) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_7infer_image, 0, __pyx_mstate_global->__pyx_n_u_infer_image, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_infer_image, __pyx_t_4) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_sensor_anomalies/detection.py":227 + /* "dopt_sensor_anomalies/detection.py":193 + * * - * # ** main function * def anomaly_detection( # <<<<<<<<<<<<<< * img_path: Path, * detection_models: t.DetectionModels, */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_data_csv, __pyx_mstate_global->__pyx_kp_u_t_CsvData) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection, 0, __pyx_mstate_global->__pyx_n_u_anomaly_detection, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_4) < (0)) __PYX_ERR(0, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_img_path, __pyx_mstate_global->__pyx_n_u_Path) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_detection_models, __pyx_mstate_global->__pyx_kp_u_t_DetectionModels) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_data_csv, __pyx_mstate_global->__pyx_kp_u_t_CsvData) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sensor_images, __pyx_mstate_global->__pyx_kp_u_t_SensorImages) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_9anomaly_detection, 0, __pyx_mstate_global->__pyx_n_u_anomaly_detection, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_anomaly_detection, __pyx_t_5) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "dopt_sensor_anomalies/detection.py":276 + /* "dopt_sensor_anomalies/detection.py":239 * * * @result_pattern.wrap_result(100) # <<<<<<<<<<<<<< * def pipeline( * user_img_path: str, */ - __pyx_t_5 = NULL; + __pyx_t_4 = NULL; __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_result_pattern); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_wrap_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_wrap_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = 1; @@ -12632,41 +12587,41 @@ __Pyx_RefNannySetupContext("PyInit_detection", 0); __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_8 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_user_img_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_11pipeline, 0, __pyx_mstate_global->__pyx_n_u_pipeline, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_user_img_path, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_X, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate_global->__pyx_n_u_float) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_21dopt_sensor_anomalies_9detection_11pipeline, 0, __pyx_mstate_global->__pyx_n_u_pipeline, NULL, __pyx_mstate_global->__pyx_n_u_dopt_sensor_anomalies_detection, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_6 = 1; { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); } - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_4) < (0)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pipeline, __pyx_t_5) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "dopt_sensor_anomalies/detection.py":1 * import csv # <<<<<<<<<<<<<< * import warnings * from pathlib import Path */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /*--- Wrapped vars code ---*/ @@ -12740,7 +12695,6 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = { {__pyx_k_CHAIN_APPROX_SIMPLE, sizeof(__pyx_k_CHAIN_APPROX_SIMPLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CHAIN_APPROX_SIMPLE */ {__pyx_k_COLOR_BGR2GRAY, sizeof(__pyx_k_COLOR_BGR2GRAY), 0, 1, 1}, /* PyObject cname: __pyx_n_u_COLOR_BGR2GRAY */ {__pyx_k_COLOR_BGR2RGB, sizeof(__pyx_k_COLOR_BGR2RGB), 0, 1, 1}, /* PyObject cname: __pyx_n_u_COLOR_BGR2RGB */ - {__pyx_k_C_Users_demon_Documents_EKF_Anal, sizeof(__pyx_k_C_Users_demon_Documents_EKF_Anal), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_C_Users_demon_Documents_EKF_Anal */ {__pyx_k_Canny, sizeof(__pyx_k_Canny), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Canny */ {__pyx_k_ContourCalculationError, sizeof(__pyx_k_ContourCalculationError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ContourCalculationError */ {__pyx_k_Contour_detection_not_valid_cont, sizeof(__pyx_k_Contour_detection_not_valid_cont), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Contour_detection_not_valid_cont */ @@ -13052,11 +13006,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, c static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __pyx_builtin_UserWarning = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_UserWarning); if (!__pyx_builtin_UserWarning) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 172, __pyx_L1_error) - __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 173, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 97, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 243, __pyx_L1_error) - __pyx_builtin_FileNotFoundError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_FileNotFoundError); if (!__pyx_builtin_FileNotFoundError) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_builtin_FileNotFoundError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_FileNotFoundError); if (!__pyx_builtin_FileNotFoundError) __PYX_ERR(0, 247, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -13068,86 +13022,86 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "dopt_sensor_anomalies/detection.py":172 + /* "dopt_sensor_anomalies/detection.py":143 + * ) * - * # identify left and right sensor areas * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 */ - __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); - /* "dopt_sensor_anomalies/detection.py":174 + /* "dopt_sensor_anomalies/detection.py":145 * x_min = min(np.min(c[:, 0, 0]) for c in filtered_cnts) - 20 * x_max = max(np.max(c[:, 0, 0]) for c in filtered_cnts) + 20 * y_min = min(np.min(c[:, 0, 1]) for c in filtered_cnts) - 20 # <<<<<<<<<<<<<< * y_max = max(np.max(c[:, 0, 1]) for c in filtered_cnts) + 20 * */ - __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); - /* "dopt_sensor_anomalies/detection.py":75 + /* "dopt_sensor_anomalies/detection.py":65 * raise errors.ImageNotReadError(f"Image could not be read from: >{img_path}<") * * cropped = image[500:1500, 100 : image.shape[1] - 100] # <<<<<<<<<<<<<< * orig = cropped.copy() - * # change colours in the image to black and white + * */ - __pyx_mstate_global->__pyx_slice[1] = PySlice_New(__pyx_mstate_global->__pyx_int_500, __pyx_mstate_global->__pyx_int_1500, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_mstate_global->__pyx_slice[1] = PySlice_New(__pyx_mstate_global->__pyx_int_500, __pyx_mstate_global->__pyx_int_1500, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); - /* "dopt_sensor_anomalies/detection.py":81 + /* "dopt_sensor_anomalies/detection.py":71 * _, binary = cv2.threshold(gray, const.THRESHOLD_BW, 255, cv2.THRESH_BINARY) - * # perform edge detection, identify rectangular shapes + * * kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # <<<<<<<<<<<<<< * closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) * edged = cv2.Canny(closed, 50, 100) */ - __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_5, __pyx_mstate_global->__pyx_int_5); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_5, __pyx_mstate_global->__pyx_int_5); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); - /* "dopt_sensor_anomalies/detection.py":201 + /* "dopt_sensor_anomalies/detection.py":169 * pil_image = pil_image.convert("RGB") * image_np = np.array(pil_image).astype(np.float32) / 255.0 * input_tensor = torch.from_numpy(image_np).permute(2, 0, 1) # <<<<<<<<<<<<<< * * input_tensor = input_tensor.unsqueeze(0) */ - __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); - /* "dopt_sensor_anomalies/detection.py":207 + /* "dopt_sensor_anomalies/detection.py":175 * * model.eval() * with torch.no_grad(): # <<<<<<<<<<<<<< * output = model(input_tensor) * */ - __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); - /* "dopt_sensor_anomalies/detection.py":241 + /* "dopt_sensor_anomalies/detection.py":205 + * backbone=const.BACKBONE, layers=const.LAYERS, coreset_sampling_ratio=const.RATIO * ) - * # preparation for plot * _, axes = plt.subplots(1, 2, figsize=(12, 6)) # <<<<<<<<<<<<<< - * # loop over left and right sensor + * * for i, (side, image) in enumerate(sensor_images.items()): */ - __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]); - __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_6); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); @@ -13199,7 +13153,6 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_mstate->__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_float_0_8 = PyFloat_FromDouble(0.8); if (unlikely(!__pyx_mstate->__pyx_float_0_8)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_mstate->__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_mstate->__pyx_float_0_251 = PyFloat_FromDouble(0.251); if (unlikely(!__pyx_mstate->__pyx_float_0_251)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_float_255_0 = PyFloat_FromDouble(255.0); if (unlikely(!__pyx_mstate->__pyx_float_255_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_int_0 = PyLong_FromLong(0); if (unlikely(!__pyx_mstate->__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_int_1 = PyLong_FromLong(1); if (unlikely(!__pyx_mstate->__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -13225,7 +13178,7 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { unsigned int num_kwonly_args : 1; unsigned int nlocals : 6; unsigned int flags : 10; - unsigned int first_line : 9; + unsigned int first_line : 8; unsigned int line_table_length : 15; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ @@ -13243,62 +13196,62 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 97, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 84, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_x2}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 137, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 112, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_existing}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 172, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 143, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 173, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 144, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 174, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 145, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 175, 2}; + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 146, 2}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 38, 52}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 32, 52}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt_A, __pyx_mstate->__pyx_n_u_pt_B}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_midpoint, __pyx_k_AT_Rt1D_AS_at2Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 45, 141}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39, 139}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_box_1, __pyx_mstate->__pyx_n_u_box_2, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_c1, __pyx_mstate->__pyx_n_u_s1, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_c2, __pyx_mstate->__pyx_n_u_s2, __pyx_mstate->__pyx_n_u_center_dist, __pyx_mstate->__pyx_n_u_size_diff}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_check_box_redundancy, __pyx_k_q_D_D_q_q_awb_uARvQd_BfAQ_AWBgU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 56, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 65, 880}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 56, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 55, 860}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_cropped, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_gray, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_binary, __pyx_mstate->__pyx_n_u_kernel, __pyx_mstate->__pyx_n_u_closed, __pyx_mstate->__pyx_n_u_edged, __pyx_mstate->__pyx_n_u_cnts, __pyx_mstate->__pyx_n_u_x_coords, __pyx_mstate->__pyx_n_u_is_sorted, __pyx_mstate->__pyx_n_u_accepted_boxes, __pyx_mstate->__pyx_n_u_filtered_cnts, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_rbox, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_tl, __pyx_mstate->__pyx_n_u_tr, __pyx_mstate->__pyx_n_u_br, __pyx_mstate->__pyx_n_u_bl, __pyx_mstate->__pyx_n_u_tltrX, __pyx_mstate->__pyx_n_u_tltrY, __pyx_mstate->__pyx_n_u_blbrX, __pyx_mstate->__pyx_n_u_blbrY, __pyx_mstate->__pyx_n_u_tlblX, __pyx_mstate->__pyx_n_u_tlblY, __pyx_mstate->__pyx_n_u_trbrX, __pyx_mstate->__pyx_n_u_trbrY, __pyx_mstate->__pyx_n_u_dA, __pyx_mstate->__pyx_n_u_dB, __pyx_mstate->__pyx_n_u_is_duplicate, __pyx_mstate->__pyx_n_u_dimA, __pyx_mstate->__pyx_n_u_dimB, __pyx_mstate->__pyx_n_u_num_contours, __pyx_mstate->__pyx_n_u_x_min, __pyx_mstate->__pyx_n_u_x_max, __pyx_mstate->__pyx_n_u_y_min, __pyx_mstate->__pyx_n_u_y_max, __pyx_mstate->__pyx_n_u_rightmost_x_third, __pyx_mstate->__pyx_n_u_leftmost_x_fourth, __pyx_mstate->__pyx_n_u_x_middle, __pyx_mstate->__pyx_n_u_cropped_sensor_left, __pyx_mstate->__pyx_n_u_cropped_sensor_right, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_measure_length, __pyx_k_Cwas_1_vS_f_ar_LA_e1D_fE_q_2Q_7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 190, 280}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 158, 278}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_torch_device, __pyx_mstate->__pyx_n_u_image_rgb, __pyx_mstate->__pyx_n_u_pil_image, __pyx_mstate->__pyx_n_u_image_np, __pyx_mstate->__pyx_n_u_input_tensor, __pyx_mstate->__pyx_n_u_output, __pyx_mstate->__pyx_n_u_anomaly_score, __pyx_mstate->__pyx_n_u_anomaly_label, __pyx_mstate->__pyx_n_u_anomaly_map, __pyx_mstate->__pyx_n_u_img_np, __pyx_mstate->__pyx_n_u_anomaly_map_resized}; __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_infer_image, __pyx_k_5_q_uM_AQ_9AWCq_Zq_r_q_Jb_5_1IX, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 227, 342}; + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 193, 338}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_img_path, __pyx_mstate->__pyx_n_u_detection_models, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images, __pyx_mstate->__pyx_n_u_file_stem, __pyx_mstate->__pyx_n_u_folder_path, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u__8, __pyx_mstate->__pyx_n_u_axes, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_side, __pyx_mstate->__pyx_n_u_image, __pyx_mstate->__pyx_n_u_checkpoint, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_df}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_anomaly_detection, __pyx_k_IQ_k_Y6MURS_wc_3c_a_F_IQm6_AS_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 276, 118}; + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 239, 118}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_user_img_path, __pyx_mstate->__pyx_n_u_pixels_per_metric_X, __pyx_mstate->__pyx_n_u_pixels_per_metric_Y, __pyx_mstate->__pyx_n_u_file_path, __pyx_mstate->__pyx_n_u_MODEL_FOLDER, __pyx_mstate->__pyx_n_u_DETECTION_MODELS, __pyx_mstate->__pyx_n_u_data_csv, __pyx_mstate->__pyx_n_u_sensor_images}; __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_sensor_anomalies_detect, __pyx_mstate->__pyx_n_u_pipeline, __pyx_k_AQ_t9G1_q_5_ARRS_aq_nA_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; }