diff --git a/simba/bounding_box_tools/yolo/model.py b/simba/bounding_box_tools/yolo/model.py index 02d200f18..8af3cdbd6 100644 --- a/simba/bounding_box_tools/yolo/model.py +++ b/simba/bounding_box_tools/yolo/model.py @@ -1,20 +1,27 @@ import os + os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" -from typing import Dict, Optional, Tuple, Union, List +from typing import Dict, List, Optional, Tuple, Union + try: from typing import Literal except: from typing_extensions import Literal + import numpy as np import pandas as pd import torch from ultralytics import YOLO -from simba.utils.checks import (check_file_exist_and_readable, check_if_dir_exists, check_int, get_fn_ext, check_valid_lst, check_valid_boolean, check_float, check_str) +from simba.third_party_label_appenders.converters import \ + yolo_obb_data_to_bounding_box +from simba.utils.checks import (check_file_exist_and_readable, check_float, + check_if_dir_exists, check_int, check_str, + check_valid_boolean, check_valid_lst, + get_fn_ext) +from simba.utils.data import df_smoother, savgol_smoother from simba.utils.printing import SimbaTimer, stdout_success from simba.utils.read_write import get_video_meta_data -from simba.third_party_label_appenders.converters import yolo_obb_data_to_bounding_box -from simba.utils.data import df_smoother, savgol_smoother def fit_yolo(initial_weights: Union[str, os.PathLike], diff --git a/simba/bounding_box_tools/yolo/visualize.py b/simba/bounding_box_tools/yolo/visualize.py index 55134c529..c54ca2865 100644 --- a/simba/bounding_box_tools/yolo/visualize.py +++ b/simba/bounding_box_tools/yolo/visualize.py @@ -1,12 +1,17 @@ import os +from typing import Optional, Tuple, Union + import numpy as np import pandas as pd -from typing import Union, Tuple, Optional -from simba.utils.checks import check_if_dir_exists, check_valid_boolean, check_file_exist_and_readable, check_valid_dataframe, check_int -from simba.utils.read_write import get_fn_ext, get_video_meta_data, find_core_cnt -from simba.utils.errors import FrameRangeError + from simba.mixins.geometry_mixin import GeometryMixin from simba.plotting.geometry_plotter import GeometryPlotter +from simba.utils.checks import (check_file_exist_and_readable, + check_if_dir_exists, check_int, + check_valid_boolean, check_valid_dataframe) +from simba.utils.errors import FrameRangeError +from simba.utils.read_write import (find_core_cnt, get_fn_ext, + get_video_meta_data) EXPECTED_COLS = ['FRAME', 'CLASS_ID', 'CLASS_NAME', 'CONFIDENCE', 'X1', 'Y1', 'X2', 'Y2', 'X3', 'Y3', 'X4', 'Y4'] FRAME = 'FRAME' diff --git a/simba/plotting/geometry_plotter.py b/simba/plotting/geometry_plotter.py index e0a030f0e..354ca2c4a 100644 --- a/simba/plotting/geometry_plotter.py +++ b/simba/plotting/geometry_plotter.py @@ -11,12 +11,16 @@ from simba.mixins.config_reader import ConfigReader from simba.mixins.plotting_mixin import PlottingMixin -from simba.utils.checks import (check_float, check_if_dir_exists, check_instance, check_int, check_iterable_length, check_valid_boolean) +from simba.utils.checks import (check_float, check_if_dir_exists, + check_instance, check_int, + check_iterable_length, check_valid_boolean) from simba.utils.data import create_color_palettes from simba.utils.enums import Defaults, Formats from simba.utils.errors import InvalidInputError from simba.utils.printing import SimbaTimer, stdout_success -from simba.utils.read_write import (concatenate_videos_in_folder, find_core_cnt, find_video_of_file, get_fn_ext, get_video_meta_data) +from simba.utils.read_write import (concatenate_videos_in_folder, + find_core_cnt, find_video_of_file, + get_fn_ext, get_video_meta_data) from simba.utils.warnings import FrameRangeWarning ACCEPTED_TYPES = [Polygon, LineString, MultiPolygon, MultiLineString, Point] diff --git a/simba/third_party_label_appenders/converters.py b/simba/third_party_label_appenders/converters.py index 8f2b82e0c..06e9b2ef4 100644 --- a/simba/third_party_label_appenders/converters.py +++ b/simba/third_party_label_appenders/converters.py @@ -23,18 +23,21 @@ from simba.mixins.config_reader import ConfigReader from simba.mixins.geometry_mixin import GeometryMixin from simba.mixins.image_mixin import ImageMixin -from simba.utils.checks import (check_file_exist_and_readable, +from simba.utils.checks import (check_file_exist_and_readable, check_float, check_if_dir_exists, check_if_keys_exist_in_dict, check_if_valid_img, check_int, check_valid_array, check_valid_boolean, - check_valid_dict, check_valid_tuple, check_float) + check_valid_dict, check_valid_tuple) from simba.utils.enums import Formats 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, find_video_of_file, get_fn_ext, - get_video_meta_data, read_df, read_pickle, copy_files_to_directory, - read_frm_of_video, read_roi_data, write_pickle) +from simba.utils.read_write import (copy_files_to_directory, + find_files_of_filetypes_in_directory, + find_video_of_file, get_fn_ext, + get_video_meta_data, read_df, + read_frm_of_video, read_pickle, + read_roi_data, write_pickle) # def geometry_to_rle(geometry: Union[np.ndarray, Polygon], img_size: Tuple[int, int]): # """