From f20fd1323bffef75b3fbe113699269f2f5c6d813 Mon Sep 17 00:00:00 2001 From: sronilsson Date: Mon, 9 Dec 2024 14:37:27 +0000 Subject: [PATCH] cleaned --- simba/data_processors/cuda/data.py | 13 ++++++---- simba/data_processors/cuda/utils.py | 1 - simba/data_processors/egocentric_aligner.py | 13 +++++++--- .../egocentric_video_rotator.py | 25 +++++++++++++------ 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/simba/data_processors/cuda/data.py b/simba/data_processors/cuda/data.py index 89b3fb0a5..409f7a4ce 100644 --- a/simba/data_processors/cuda/data.py +++ b/simba/data_processors/cuda/data.py @@ -1,14 +1,17 @@ import math import time +from typing import Tuple -from simba.utils.checks import check_int, check_valid_array import numpy as np -from typing import Tuple -from simba.utils.errors import InvalidInputError +from numba import cuda + +from simba.data_processors.cuda.utils import (_cuda_2d_transpose, _cuda_add_2d, + _cuda_matrix_multiplication, + _cuda_subtract_2d) +from simba.utils.checks import check_int, check_valid_array from simba.utils.enums import Formats +from simba.utils.errors import InvalidInputError from simba.utils.read_write import read_df -from numba import cuda -from simba.data_processors.cuda.utils import _cuda_matrix_multiplication, _cuda_2d_transpose, _cuda_subtract_2d, _cuda_add_2d THREADS_PER_BLOCK = 1024 diff --git a/simba/data_processors/cuda/utils.py b/simba/data_processors/cuda/utils.py index c95c5adaa..de0934091 100644 --- a/simba/data_processors/cuda/utils.py +++ b/simba/data_processors/cuda/utils.py @@ -5,7 +5,6 @@ from numba import cuda, float64, guvectorize - @cuda.jit(device=True) def _cuda_sum(x: np.ndarray): s = 0 diff --git a/simba/data_processors/egocentric_aligner.py b/simba/data_processors/egocentric_aligner.py index a26576c17..fab1c99d5 100644 --- a/simba/data_processors/egocentric_aligner.py +++ b/simba/data_processors/egocentric_aligner.py @@ -4,12 +4,19 @@ import numpy as np import pandas as pd -from simba.utils.checks import (check_if_dir_exists, check_if_valid_rgb_tuple, check_int, check_str, check_valid_dataframe, check_valid_tuple, check_valid_boolean) +from simba.utils.checks import (check_if_dir_exists, check_if_valid_rgb_tuple, + check_int, check_str, check_valid_boolean, + check_valid_dataframe, check_valid_tuple) from simba.utils.data import egocentrically_align_pose_numba from simba.utils.enums import Formats, Options from simba.utils.printing import SimbaTimer, stdout_success -from simba.utils.read_write import (bgr_to_rgb_tuple, find_core_cnt, find_files_of_filetypes_in_directory, find_video_of_file, get_fn_ext, read_df, write_df) -from simba.video_processors.egocentric_video_rotator import EgocentricVideoRotator +from simba.utils.read_write import (bgr_to_rgb_tuple, find_core_cnt, + find_files_of_filetypes_in_directory, + find_video_of_file, get_fn_ext, read_df, + write_df) +from simba.video_processors.egocentric_video_rotator import \ + EgocentricVideoRotator + class EgocentricalAligner(): diff --git a/simba/video_processors/egocentric_video_rotator.py b/simba/video_processors/egocentric_video_rotator.py index fd1f23aaf..e7895144e 100644 --- a/simba/video_processors/egocentric_video_rotator.py +++ b/simba/video_processors/egocentric_video_rotator.py @@ -1,15 +1,26 @@ -import os -from typing import Union, Tuple, Optional -import numpy as np import functools import multiprocessing +import os +from typing import Optional, Tuple, Union + import cv2 +import numpy as np -from simba.utils.checks import check_if_valid_rgb_tuple, check_valid_boolean, check_int, check_file_exist_and_readable, check_if_dir_exists, check_valid_array, check_valid_tuple -from simba.utils.enums import Formats, Defaults -from simba.utils.read_write import get_video_meta_data, get_fn_ext, find_core_cnt, remove_a_folder, read_frm_of_video, concatenate_videos_in_folder, read_df, read_img_batch_from_video_gpu, create_directory +from simba.utils.checks import (check_file_exist_and_readable, + check_if_dir_exists, check_if_valid_rgb_tuple, + check_int, check_valid_array, + check_valid_boolean, check_valid_tuple) +from simba.utils.data import (align_target_warpaffine_vectors, + center_rotation_warpaffine_vectors, + egocentrically_align_pose) +from simba.utils.enums import Defaults, Formats from simba.utils.printing import SimbaTimer, stdout_success -from simba.utils.data import egocentrically_align_pose, center_rotation_warpaffine_vectors, align_target_warpaffine_vectors +from simba.utils.read_write import (concatenate_videos_in_folder, + create_directory, find_core_cnt, + get_fn_ext, get_video_meta_data, read_df, + read_frm_of_video, + read_img_batch_from_video_gpu, + remove_a_folder) def egocentric_video_aligner(frm_range: np.ndarray,