simba-uw-tf-dev 4.6.1__py3-none-any.whl → 4.6.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simba/SimBA.py +2 -2
- simba/assets/icons/frames_2.png +0 -0
- simba/data_processors/agg_clf_counter_mp.py +52 -53
- simba/data_processors/cuda/image.py +3 -1
- simba/data_processors/cue_light_analyzer.py +5 -9
- simba/mixins/geometry_mixin.py +14 -28
- simba/mixins/image_mixin.py +10 -14
- simba/mixins/train_model_mixin.py +2 -2
- simba/plotting/ROI_feature_visualizer_mp.py +3 -5
- simba/plotting/clf_validator_mp.py +4 -5
- simba/plotting/cue_light_visualizer.py +6 -7
- simba/plotting/directing_animals_visualizer_mp.py +2 -3
- simba/plotting/distance_plotter_mp.py +378 -378
- simba/plotting/frame_mergerer_ffmpeg.py +137 -137
- simba/plotting/gantt_creator_mp.py +59 -31
- simba/plotting/geometry_plotter.py +270 -272
- simba/plotting/heat_mapper_clf_mp.py +2 -4
- simba/plotting/heat_mapper_location_mp.py +2 -2
- simba/plotting/light_dark_box_plotter.py +2 -2
- simba/plotting/path_plotter_mp.py +26 -29
- simba/plotting/plot_clf_results_mp.py +455 -454
- simba/plotting/pose_plotter_mp.py +27 -32
- simba/plotting/probability_plot_creator_mp.py +288 -288
- simba/plotting/roi_plotter_mp.py +29 -30
- simba/plotting/single_run_model_validation_video_mp.py +427 -427
- simba/plotting/spontaneous_alternation_plotter.py +2 -3
- simba/plotting/yolo_pose_track_visualizer.py +31 -27
- simba/plotting/yolo_pose_visualizer.py +32 -34
- simba/plotting/yolo_seg_visualizer.py +2 -3
- simba/roi_tools/roi_aggregate_stats_mp.py +4 -3
- simba/roi_tools/roi_clf_calculator_mp.py +3 -3
- simba/sandbox/cuda/egocentric_rotator.py +374 -0
- simba/sandbox/get_cpu_pool.py +5 -0
- simba/ui/pop_ups/clf_add_remove_print_pop_up.py +3 -1
- simba/ui/pop_ups/egocentric_alignment_pop_up.py +6 -3
- simba/ui/pop_ups/multiple_videos_to_frames_popup.py +10 -11
- simba/ui/pop_ups/single_video_to_frames_popup.py +10 -10
- simba/ui/pop_ups/video_processing_pop_up.py +63 -63
- simba/ui/tkinter_functions.py +7 -1
- simba/utils/data.py +89 -12
- simba/utils/enums.py +1 -0
- simba/utils/printing.py +9 -8
- simba/utils/read_write.py +3726 -3721
- simba/video_processors/clahe_ui.py +65 -22
- simba/video_processors/egocentric_video_rotator.py +6 -9
- simba/video_processors/video_processing.py +21 -10
- simba/video_processors/videos_to_frames.py +3 -2
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/METADATA +1 -1
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/RECORD +53 -50
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.6.1.dist-info → simba_uw_tf_dev-4.6.3.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
__author__ = "Simon Nilsson; sronilsson@gmail.com"
|
|
2
2
|
|
|
3
3
|
import functools
|
|
4
|
-
import multiprocessing
|
|
5
4
|
import os
|
|
6
|
-
import platform
|
|
7
5
|
from copy import deepcopy
|
|
8
|
-
from typing import Any, Dict, List, Optional,
|
|
6
|
+
from typing import Any, Dict, List, Optional, Union
|
|
9
7
|
|
|
10
8
|
import cv2
|
|
11
9
|
import numpy as np
|
|
@@ -20,17 +18,16 @@ from simba.utils.checks import (
|
|
|
20
18
|
check_that_hhmmss_start_is_before_end, check_valid_boolean,
|
|
21
19
|
check_valid_dataframe, check_valid_lst,
|
|
22
20
|
check_video_and_data_frm_count_align)
|
|
23
|
-
from simba.utils.data import (find_frame_numbers_from_time_stamp,
|
|
24
|
-
slice_roi_dict_for_video)
|
|
21
|
+
from simba.utils.data import (find_frame_numbers_from_time_stamp, get_cpu_pool,
|
|
22
|
+
slice_roi_dict_for_video, terminate_cpu_pool)
|
|
25
23
|
from simba.utils.enums import Formats, TagNames
|
|
26
24
|
from simba.utils.errors import (FrameRangeError, InvalidInputError,
|
|
27
25
|
InvalidVideoFileError, NoSpecifiedOutputError)
|
|
28
26
|
from simba.utils.printing import SimbaTimer, log_event, stdout_success
|
|
29
27
|
from simba.utils.read_write import (concatenate_videos_in_folder,
|
|
30
28
|
create_directory, find_core_cnt,
|
|
31
|
-
find_video_of_file,
|
|
32
|
-
|
|
33
|
-
read_frm_of_video, remove_a_folder)
|
|
29
|
+
find_video_of_file, get_current_time,
|
|
30
|
+
get_fn_ext, read_df, read_frm_of_video)
|
|
34
31
|
from simba.utils.warnings import ROIWarning
|
|
35
32
|
|
|
36
33
|
STYLE_WIDTH = "width"
|
|
@@ -252,10 +249,13 @@ class PathPlotterMulticore(ConfigReader, PlottingMixin):
|
|
|
252
249
|
video_styles[STYLE_BG] = video_path
|
|
253
250
|
return video_styles
|
|
254
251
|
|
|
255
|
-
|
|
256
252
|
def run(self):
|
|
257
253
|
check_all_file_names_are_represented_in_video_log(video_info_df=self.video_info_df, data_paths=self.data_paths)
|
|
258
254
|
print(f"Processing path plots for {len(self.data_paths)} video(s)...")
|
|
255
|
+
if self.video_setting or self.frame_setting:
|
|
256
|
+
self.pool = get_cpu_pool(core_cnt=self.core_cnt, source=self.__class__.__name__, )
|
|
257
|
+
else:
|
|
258
|
+
self.pool = None
|
|
259
259
|
for file_cnt, file_path in enumerate(self.data_paths):
|
|
260
260
|
video_timer = SimbaTimer(start=True)
|
|
261
261
|
_, self.video_name, _ = get_fn_ext(file_path)
|
|
@@ -333,26 +333,22 @@ class PathPlotterMulticore(ConfigReader, PlottingMixin):
|
|
|
333
333
|
frm_id_range = np.array_split(frm_numbers, self.core_cnt)
|
|
334
334
|
frm_range = [(cnt, x, y) for cnt, (x, y) in enumerate(zip(frm_cnt_range, frm_id_range))]
|
|
335
335
|
print(f"Creating path plots, multiprocessing (chunksize: {self.multiprocess_chunksize}, cores: {self.core_cnt})...")
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
print(f"Path batch {result+1}/{self.core_cnt} complete...")
|
|
353
|
-
pool.terminate()
|
|
354
|
-
pool.join()
|
|
355
|
-
|
|
336
|
+
constants = functools.partial(path_plot_mp,
|
|
337
|
+
line_data=line_data,
|
|
338
|
+
colors=self.colors,
|
|
339
|
+
video_setting=self.video_setting,
|
|
340
|
+
video_name=self.video_name,
|
|
341
|
+
frame_setting=self.frame_setting,
|
|
342
|
+
video_save_dir=self.video_temp_dir,
|
|
343
|
+
frame_folder_dir=self.save_frm_dir,
|
|
344
|
+
style_attr=video_styles,
|
|
345
|
+
clf_attr=clf_attr,
|
|
346
|
+
animal_names=self.animal_names,
|
|
347
|
+
fps=self.fps,
|
|
348
|
+
roi=video_rois,
|
|
349
|
+
verbose=self.verbose)
|
|
350
|
+
for cnt, result in enumerate(self.pool.imap(constants, frm_range, chunksize=self.multiprocess_chunksize)):
|
|
351
|
+
print(f"[{get_current_time()}] Path batch {result+1}/{self.core_cnt} complete...")
|
|
356
352
|
if self.video_setting:
|
|
357
353
|
print(f"Joining {self.video_name} multi-processed video...")
|
|
358
354
|
print(self.video_temp_dir, self.video_save_path)
|
|
@@ -361,6 +357,7 @@ class PathPlotterMulticore(ConfigReader, PlottingMixin):
|
|
|
361
357
|
print(f"Path plot video {self.video_name} complete (elapsed time: {video_timer.elapsed_time_str}s) ...")
|
|
362
358
|
|
|
363
359
|
self.timer.stop_timer()
|
|
360
|
+
if self.pool is not None: terminate_cpu_pool(pool=self.pool, force=False, source=self.__class__.__name__)
|
|
364
361
|
stdout_success(msg=f"Path plot visualizations for {len(self.data_paths)} video(s) created in {self.path_plot_dir} directory", elapsed_time=self.timer.elapsed_time_str, source=self.__class__.__name__)
|
|
365
362
|
|
|
366
363
|
|