simba-uw-tf-dev 4.6.2__py3-none-any.whl → 4.6.4__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.
Potentially problematic release.
This version of simba-uw-tf-dev might be problematic. Click here for more details.
- simba/assets/lookups/tooptips.json +6 -1
- 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/data_processors/kleinberg_calculator.py +57 -29
- 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/gantt_creator_mp.py +61 -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 +28 -29
- simba/plotting/probability_plot_creator_mp.py +288 -288
- simba/plotting/roi_plotter_mp.py +31 -31
- 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 +32 -27
- simba/plotting/yolo_pose_visualizer.py +35 -36
- 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/get_cpu_pool.py +5 -0
- simba/ui/pop_ups/kleinberg_pop_up.py +39 -41
- simba/ui/tkinter_functions.py +3 -0
- simba/utils/data.py +89 -12
- simba/utils/enums.py +1 -0
- simba/utils/printing.py +124 -124
- simba/utils/read_write.py +3730 -3721
- simba/video_processors/egocentric_video_rotator.py +2 -4
- simba/video_processors/video_processing.py +19 -8
- simba/video_processors/videos_to_frames.py +1 -1
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/METADATA +1 -1
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/RECORD +46 -45
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.6.4.dist-info}/top_level.txt +0 -0
simba/plotting/roi_plotter_mp.py
CHANGED
|
@@ -24,15 +24,16 @@ from simba.utils.checks import (check_file_exist_and_readable, check_float,
|
|
|
24
24
|
check_valid_boolean, check_valid_lst,
|
|
25
25
|
check_video_and_data_frm_count_align)
|
|
26
26
|
from simba.utils.data import (create_color_palettes, detect_bouts,
|
|
27
|
-
slice_roi_dict_for_video
|
|
27
|
+
get_cpu_pool, slice_roi_dict_for_video,
|
|
28
|
+
terminate_cpu_pool)
|
|
28
29
|
from simba.utils.enums import ROI_SETTINGS, Formats, Keys, Paths, TextOptions
|
|
29
30
|
from simba.utils.errors import (BodypartColumnNotFoundError, DuplicationError,
|
|
30
31
|
NoFilesFoundError, NoROIDataError,
|
|
31
32
|
ROICoordinatesNotFoundError)
|
|
32
33
|
from simba.utils.printing import SimbaTimer, stdout_success
|
|
33
34
|
from simba.utils.read_write import (concatenate_videos_in_folder,
|
|
34
|
-
find_core_cnt,
|
|
35
|
-
read_df)
|
|
35
|
+
find_core_cnt, get_current_time,
|
|
36
|
+
get_video_meta_data, read_df)
|
|
36
37
|
from simba.utils.warnings import (DuplicateNamesWarning, FrameRangeWarning,
|
|
37
38
|
GPUToolsWarning)
|
|
38
39
|
|
|
@@ -117,7 +118,7 @@ def _roi_plotter_mp(data: Tuple[int, pd.DataFrame],
|
|
|
117
118
|
|
|
118
119
|
writer.write(img)
|
|
119
120
|
current_frm += 1
|
|
120
|
-
if verbose: print(f"Multi-processing video frame {current_frm}
|
|
121
|
+
if verbose: print(f"[{get_current_time()}] Multi-processing video frame {current_frm}/{video_meta_data['frame_count']} (core batch: {group_cnt}, video: {video_meta_data['video_name']})...")
|
|
121
122
|
else:
|
|
122
123
|
FrameRangeWarning(msg=f'Could not read frame {current_frm} in video {video_meta_data["video_name"]}', source=_roi_plotter_mp.__name__)
|
|
123
124
|
break
|
|
@@ -363,34 +364,33 @@ class ROIPlotMultiprocess(ConfigReader):
|
|
|
363
364
|
del self.data_df
|
|
364
365
|
del self.roi_analyzer.logger
|
|
365
366
|
if self.verbose: print(f"Creating ROI images, multiprocessing (chunksize: {self.multiprocess_chunksize}, cores: {self.core_cnt})...")
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
367
|
+
self.pool = get_cpu_pool(core_cnt=self.core_cnt, maxtasksperchild=self.maxtasksperchild, source=self.__class__.__name__, verbose=True)
|
|
368
|
+
constants = functools.partial(_roi_plotter_mp,
|
|
369
|
+
loc_dict=self.loc_dict,
|
|
370
|
+
font_size=self.font_size,
|
|
371
|
+
circle_sizes=self.circle_sizes,
|
|
372
|
+
save_temp_directory=self.temp_folder,
|
|
373
|
+
body_part_dict=self.bp_dict,
|
|
374
|
+
input_video_path=self.video_path,
|
|
375
|
+
roi_dfs_dict=self.sliced_roi_dict,
|
|
376
|
+
roi_dict = self.roi_dict_,
|
|
377
|
+
video_shape_names=self.shape_names,
|
|
378
|
+
bp_colors=self.color_lst,
|
|
379
|
+
show_animal_name=self.show_animal_name,
|
|
380
|
+
show_pose=self.show_pose,
|
|
381
|
+
animal_ids=self.animal_names,
|
|
382
|
+
threshold=self.threshold,
|
|
383
|
+
outside_roi=self.outside_roi,
|
|
384
|
+
verbose=self.verbose,
|
|
385
|
+
border_bg_clr=self.border_bg_clr,
|
|
386
|
+
animal_bp_dict=self.animal_bp_dict,
|
|
387
|
+
show_bbox=self.show_bbox)
|
|
388
|
+
|
|
389
|
+
for cnt, batch_cnt in enumerate(self.pool.imap(constants, data, chunksize=self.multiprocess_chunksize)):
|
|
390
|
+
print(f'Image batch {batch_cnt+1} / {self.core_cnt} complete...')
|
|
390
391
|
print(f"Joining {self.video_name} multi-processed ROI video...")
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
pool.join()
|
|
392
|
+
concatenate_videos_in_folder(in_folder=self.temp_folder, save_path=self.save_path, video_format="mp4", remove_splits=True, gpu=self.gpu)
|
|
393
|
+
terminate_cpu_pool(pool=self.pool, force=False, source=self.__class__.__name__)
|
|
394
394
|
video_timer.stop_timer()
|
|
395
395
|
stdout_success(msg=f"Video {self.video_name} created. ROI video saved at {self.save_path}", elapsed_time=video_timer.elapsed_time_str, source=self.__class__.__name__, )
|
|
396
396
|
|