From 01ede5622194298202515d2cd377f363a637856e Mon Sep 17 00:00:00 2001 From: sronilsson Date: Wed, 23 Oct 2024 13:12:05 +0000 Subject: [PATCH] cleaned --- simba/bounding_box_tools/yolo/model.py | 9 +++---- simba/plotting/pose_plotter_mp.py | 9 +++++-- .../third_party_label_appenders/converters.py | 24 ++++++++++++------- .../pop_ups/visualize_pose_in_dir_pop_up.py | 6 +++-- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/simba/bounding_box_tools/yolo/model.py b/simba/bounding_box_tools/yolo/model.py index 91beded44..9801523b4 100644 --- a/simba/bounding_box_tools/yolo/model.py +++ b/simba/bounding_box_tools/yolo/model.py @@ -1,14 +1,15 @@ import os -from typing import Optional, Tuple, Union, Dict +from typing import Dict, Optional, Tuple, Union import numpy as np import pandas as pd import torch from ultralytics import YOLO -from simba.utils.printing import stdout_success, SimbaTimer -from simba.utils.checks import check_file_exist_and_readable, check_if_dir_exists, check_int, get_fn_ext -from simba.utils.read_write import (get_video_meta_data) +from simba.utils.checks import (check_file_exist_and_readable, + check_if_dir_exists, check_int, get_fn_ext) +from simba.utils.printing import SimbaTimer, stdout_success +from simba.utils.read_write import get_video_meta_data def fit_yolo(initial_weights: Union[str, os.PathLike], diff --git a/simba/plotting/pose_plotter_mp.py b/simba/plotting/pose_plotter_mp.py index 1a3ff8e94..6ac5644c8 100644 --- a/simba/plotting/pose_plotter_mp.py +++ b/simba/plotting/pose_plotter_mp.py @@ -10,12 +10,17 @@ from simba.mixins.config_reader import ConfigReader from simba.mixins.plotting_mixin import PlottingMixin -from simba.utils.checks import (check_instance, check_int, check_str, check_that_column_exist, check_valid_boolean, check_nvidea_gpu_available) +from simba.utils.checks import (check_instance, check_int, + check_nvidea_gpu_available, check_str, + check_that_column_exist, check_valid_boolean) from simba.utils.data import create_color_palette from simba.utils.enums import OS, Formats, Options from simba.utils.errors import CountError, InvalidFilepathError from simba.utils.printing import SimbaTimer, stdout_success -from simba.utils.read_write import (concatenate_videos_in_folder, find_core_cnt, find_files_of_filetypes_in_directory, get_fn_ext, get_video_meta_data, read_df) +from simba.utils.read_write import (concatenate_videos_in_folder, + find_core_cnt, + find_files_of_filetypes_in_directory, + get_fn_ext, get_video_meta_data, read_df) from simba.utils.warnings import FrameRangeWarning diff --git a/simba/third_party_label_appenders/converters.py b/simba/third_party_label_appenders/converters.py index c956ad81e..d22322fec 100644 --- a/simba/third_party_label_appenders/converters.py +++ b/simba/third_party_label_appenders/converters.py @@ -1,12 +1,14 @@ +import base64 +import io +import itertools import json import os -import itertools +from datetime import datetime +from typing import Any, Dict, Iterable, Optional, Tuple, Union + import pandas as pd -import io from PIL import Image -import base64 -from datetime import datetime -from typing import Dict, Optional, Tuple, Union, Any, Iterable + try: from typing import Literal except: @@ -20,11 +22,17 @@ from simba.mixins.geometry_mixin import GeometryMixin from simba.mixins.image_mixin import ImageMixin -from simba.utils.checks import check_instance, check_int, check_valid_array, check_if_dir_exists, check_if_keys_exist_in_dict, check_file_exist_and_readable, check_if_valid_img, check_valid_tuple +from simba.utils.checks import (check_file_exist_and_readable, + check_if_dir_exists, + check_if_keys_exist_in_dict, + check_if_valid_img, check_instance, check_int, + check_valid_array, check_valid_tuple) from simba.utils.enums import Formats -from simba.utils.read_write import get_video_meta_data, read_df, read_frm_of_video, find_files_of_filetypes_in_directory, get_fn_ext -from simba.utils.errors import NoFilesFoundError, InvalidInputError +from simba.utils.errors import InvalidInputError, NoFilesFoundError from simba.utils.printing import SimbaTimer, stdout_success +from simba.utils.read_write import (find_files_of_filetypes_in_directory, + get_fn_ext, get_video_meta_data, read_df, + read_frm_of_video) def geometry_to_rle(geometry: Union[np.ndarray, Polygon], img_size: Tuple[int, int]): diff --git a/simba/ui/pop_ups/visualize_pose_in_dir_pop_up.py b/simba/ui/pop_ups/visualize_pose_in_dir_pop_up.py index 6da70c040..601f04b2b 100644 --- a/simba/ui/pop_ups/visualize_pose_in_dir_pop_up.py +++ b/simba/ui/pop_ups/visualize_pose_in_dir_pop_up.py @@ -7,8 +7,10 @@ from simba.mixins.pop_up_mixin import PopUpMixin from simba.plotting.pose_plotter import PosePlotter from simba.plotting.pose_plotter_mp import PosePlotterMultiProcess -from simba.ui.tkinter_functions import (CreateLabelFrameWithIcon, DropDownMenu, FileSelect, FolderSelect) -from simba.utils.checks import (check_file_exist_and_readable, check_if_dir_exists) +from simba.ui.tkinter_functions import (CreateLabelFrameWithIcon, DropDownMenu, + FileSelect, FolderSelect) +from simba.utils.checks import (check_file_exist_and_readable, + check_if_dir_exists) from simba.utils.enums import Formats, Keys, Links, Options from simba.utils.read_write import find_core_cnt, str_2_bool