Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sronilsson committed Nov 16, 2024
2 parents 2af2ad6 + 5de682f commit 830eb65
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
15 changes: 11 additions & 4 deletions simba/bounding_box_tools/yolo/model.py
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
13 changes: 9 additions & 4 deletions simba/bounding_box_tools/yolo/visualize.py
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
8 changes: 6 additions & 2 deletions simba/plotting/geometry_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 8 additions & 5 deletions simba/third_party_label_appenders/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
# """
Expand Down

0 comments on commit 830eb65

Please sign in to comment.