simba-uw-tf-dev 4.6.2__py3-none-any.whl → 4.7.2__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/assets/.recent_projects.txt +1 -0
- simba/assets/lookups/tooptips.json +6 -1
- simba/assets/lookups/yolo_schematics/yolo_mitra.csv +9 -0
- simba/data_processors/agg_clf_counter_mp.py +52 -53
- simba/data_processors/blob_location_computer.py +1 -1
- simba/data_processors/circling_detector.py +30 -13
- simba/data_processors/cuda/geometry.py +45 -27
- simba/data_processors/cuda/image.py +1648 -1598
- simba/data_processors/cuda/statistics.py +72 -26
- simba/data_processors/cuda/timeseries.py +1 -1
- simba/data_processors/cue_light_analyzer.py +5 -9
- simba/data_processors/egocentric_aligner.py +25 -7
- simba/data_processors/freezing_detector.py +55 -47
- simba/data_processors/kleinberg_calculator.py +61 -29
- simba/feature_extractors/feature_subsets.py +14 -7
- simba/feature_extractors/mitra_feature_extractor.py +2 -2
- simba/feature_extractors/straub_tail_analyzer.py +4 -6
- simba/labelling/standard_labeller.py +1 -1
- simba/mixins/config_reader.py +5 -2
- simba/mixins/geometry_mixin.py +22 -36
- simba/mixins/image_mixin.py +24 -28
- simba/mixins/plotting_mixin.py +28 -10
- simba/mixins/statistics_mixin.py +48 -11
- simba/mixins/timeseries_features_mixin.py +1 -1
- simba/mixins/train_model_mixin.py +68 -33
- simba/model/inference_batch.py +2 -2
- simba/model/yolo_seg_inference.py +3 -3
- simba/outlier_tools/skip_outlier_correction.py +1 -1
- 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.py +29 -10
- simba/plotting/gantt_creator_mp.py +96 -33
- simba/plotting/geometry_plotter.py +270 -272
- simba/plotting/heat_mapper_clf_mp.py +4 -6
- 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/pose_importers/simba_blob_importer.py +3 -3
- simba/roi_tools/roi_aggregate_stats_mp.py +5 -4
- simba/roi_tools/roi_clf_calculator_mp.py +4 -4
- simba/sandbox/analyze_runtimes.py +30 -0
- simba/sandbox/cuda/egocentric_rotator.py +374 -374
- simba/sandbox/get_cpu_pool.py +5 -0
- simba/sandbox/proboscis_to_tip.py +28 -0
- simba/sandbox/test_directionality.py +47 -0
- simba/sandbox/test_nonstatic_directionality.py +27 -0
- simba/sandbox/test_pycharm_cuda.py +51 -0
- simba/sandbox/test_simba_install.py +41 -0
- simba/sandbox/test_static_directionality.py +26 -0
- simba/sandbox/test_static_directionality_2d.py +26 -0
- simba/sandbox/verify_env.py +42 -0
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo.py +3 -3
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo_bbox.py +2 -2
- simba/third_party_label_appenders/transform/simba_to_yolo.py +8 -5
- simba/ui/pop_ups/clf_plot_pop_up.py +2 -2
- simba/ui/pop_ups/fsttc_pop_up.py +27 -25
- simba/ui/pop_ups/gantt_pop_up.py +31 -6
- simba/ui/pop_ups/kleinberg_pop_up.py +39 -40
- simba/ui/pop_ups/run_machine_models_popup.py +21 -21
- simba/ui/pop_ups/simba_to_yolo_keypoints_popup.py +2 -2
- simba/ui/pop_ups/video_processing_pop_up.py +37 -29
- simba/ui/pop_ups/yolo_inference_popup.py +1 -1
- simba/ui/pop_ups/yolo_pose_train_popup.py +1 -1
- simba/ui/tkinter_functions.py +3 -0
- simba/utils/custom_feature_extractor.py +1 -1
- simba/utils/data.py +90 -14
- simba/utils/enums.py +1 -0
- simba/utils/errors.py +441 -440
- simba/utils/lookups.py +1203 -1203
- simba/utils/printing.py +124 -124
- simba/utils/read_write.py +3769 -3721
- simba/utils/yolo.py +10 -1
- simba/video_processors/blob_tracking_executor.py +2 -2
- simba/video_processors/clahe_ui.py +1 -1
- simba/video_processors/egocentric_video_rotator.py +44 -41
- simba/video_processors/multi_cropper.py +1 -1
- simba/video_processors/video_processing.py +75 -33
- simba/video_processors/videos_to_frames.py +43 -33
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/METADATA +4 -3
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/RECORD +96 -85
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.2.dist-info}/top_level.txt +0 -0
|
@@ -15,14 +15,16 @@ from simba.mixins.plotting_mixin import PlottingMixin
|
|
|
15
15
|
from simba.utils.checks import (check_instance, check_int,
|
|
16
16
|
check_nvidea_gpu_available, check_str,
|
|
17
17
|
check_that_column_exist, check_valid_boolean)
|
|
18
|
-
from simba.utils.data import create_color_palette
|
|
18
|
+
from simba.utils.data import (create_color_palette, get_cpu_pool,
|
|
19
|
+
terminate_cpu_pool)
|
|
19
20
|
from simba.utils.enums import OS, Formats, Options
|
|
20
21
|
from simba.utils.errors import CountError, InvalidFilepathError
|
|
21
22
|
from simba.utils.printing import SimbaTimer, stdout_success
|
|
22
23
|
from simba.utils.read_write import (concatenate_videos_in_folder,
|
|
23
24
|
find_core_cnt,
|
|
24
25
|
find_files_of_filetypes_in_directory,
|
|
25
|
-
|
|
26
|
+
get_current_time, get_fn_ext,
|
|
27
|
+
get_video_meta_data, read_df)
|
|
26
28
|
from simba.utils.warnings import FrameRangeWarning
|
|
27
29
|
|
|
28
30
|
|
|
@@ -59,7 +61,7 @@ def pose_plotter_mp(data: pd.DataFrame,
|
|
|
59
61
|
img = cv2.polylines(img, [animal_bbox], True, colors_dict[animal_cnt][0], thickness=max(1, int(circle_size/1.5)), lineType=-1)
|
|
60
62
|
writer.write(img)
|
|
61
63
|
current_frm += 1
|
|
62
|
-
print(f"Multi-processing video frame {current_frm} on core {group_cnt}...")
|
|
64
|
+
print(f"[{get_current_time()}] Multi-processing video frame {current_frm} on core {group_cnt}...")
|
|
63
65
|
else:
|
|
64
66
|
print(f'Frame {current_frm} not found in video {video_path}, terminating video creation...')
|
|
65
67
|
break
|
|
@@ -109,9 +111,8 @@ class PosePlotterMultiProcess():
|
|
|
109
111
|
else:
|
|
110
112
|
files_found = [data_path]
|
|
111
113
|
self.animal_bp_dict = self.config.body_parts_lst
|
|
112
|
-
if circle_size is not None:
|
|
113
|
-
|
|
114
|
-
check_int(name='core_cnt', value=core_cnt, min_value=-1)
|
|
114
|
+
if circle_size is not None: check_int(name='circle_size', value=circle_size, min_value=1)
|
|
115
|
+
check_int(name='core_cnt', value=core_cnt, min_value=-1, unaccepted_vals=[0])
|
|
115
116
|
if core_cnt == -1: core_cnt = find_core_cnt()[0]
|
|
116
117
|
self.color_dict = {}
|
|
117
118
|
if palettes is not None:
|
|
@@ -145,12 +146,12 @@ class PosePlotterMultiProcess():
|
|
|
145
146
|
multiprocessing.set_start_method("spawn", force=True)
|
|
146
147
|
|
|
147
148
|
def run(self):
|
|
149
|
+
self.pool = get_cpu_pool(core_cnt=self.core_cnt, source=self.__class__.__name__)
|
|
148
150
|
for file_cnt, (pose_path, video_path) in enumerate(self.data.items()):
|
|
149
151
|
video_timer = SimbaTimer(start=True)
|
|
150
152
|
video_name = get_fn_ext(pose_path)[1]
|
|
151
153
|
self.temp_folder = os.path.join(self.out_dir, video_name, "temp")
|
|
152
|
-
if os.path.exists(self.temp_folder):
|
|
153
|
-
self.config.remove_a_folder(self.temp_folder)
|
|
154
|
+
if os.path.exists(self.temp_folder): self.config.remove_a_folder(self.temp_folder)
|
|
154
155
|
os.makedirs(self.temp_folder, exist_ok=True)
|
|
155
156
|
save_video_path = os.path.join(self.out_dir, f"{video_name}.mp4")
|
|
156
157
|
pose_df = read_df(file_path=pose_path, file_type=self.config.file_type, check_multiindex=True)
|
|
@@ -170,35 +171,33 @@ class PosePlotterMultiProcess():
|
|
|
170
171
|
pose_df = (pose_df.apply(pd.to_numeric, errors="coerce").fillna(0).reset_index(drop=True))
|
|
171
172
|
pose_lst, obs_per_split = PlottingMixin().split_and_group_df(df=pose_df, splits=self.core_cnt)
|
|
172
173
|
print(f"Creating pose videos, multiprocessing (chunksize: {self.config.multiprocess_chunksize}, cores: {self.core_cnt})...")
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
print(f"Image {min(len(pose_df), obs_per_split*(cnt+1))}/{len(pose_df)}, Video {file_cnt+1}/{len(list(self.data.keys()))}...")
|
|
184
|
-
pool.terminate()
|
|
185
|
-
pool.join()
|
|
174
|
+
constants = functools.partial(pose_plotter_mp,
|
|
175
|
+
video_meta_data=video_meta_data,
|
|
176
|
+
video_path=video_path,
|
|
177
|
+
bp_dict=self.config.animal_bp_dict,
|
|
178
|
+
colors_dict=self.color_dict,
|
|
179
|
+
circle_size=video_circle_size,
|
|
180
|
+
bbox=self.bbox,
|
|
181
|
+
video_save_dir=self.temp_folder)
|
|
182
|
+
for cnt, result in enumerate(self.pool.imap(constants, pose_lst, chunksize=self.config.multiprocess_chunksize)):
|
|
183
|
+
print(f"[{get_current_time()}] Image {min(len(pose_df), obs_per_split*(cnt+1))}/{len(pose_df)}, Video {file_cnt+1}/{len(list(self.data.keys()))}...")
|
|
186
184
|
print(f"Joining {video_name} multi-processed video...")
|
|
187
185
|
concatenate_videos_in_folder(in_folder=self.temp_folder, save_path=save_video_path, remove_splits=True, gpu=self.gpu)
|
|
188
186
|
video_timer.stop_timer()
|
|
189
187
|
stdout_success(msg=f"Pose video {video_name} complete and saved at {save_video_path}", elapsed_time=video_timer.elapsed_time_str, source=self.__class__.__name__)
|
|
188
|
+
terminate_cpu_pool(pool=self.pool, force=False, source=self.__class__.__name__)
|
|
190
189
|
self.config.timer.stop_timer()
|
|
191
190
|
stdout_success(f"Pose visualizations for {len(list(self.data.keys()))} video(s) created in {self.out_dir} directory", elapsed_time=self.config.timer.elapsed_time_str, source=self.__class__.__name__)
|
|
192
191
|
|
|
193
192
|
|
|
194
|
-
if __name__ == "__main__":
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
# if __name__ == "__main__":
|
|
194
|
+
# test = PosePlotterMultiProcess(data_path=r"C:\troubleshooting\mitra\project_folder\csv\input_csv",
|
|
195
|
+
# out_dir=None,
|
|
196
|
+
# circle_size=8,
|
|
197
|
+
# core_cnt=18,
|
|
198
|
+
# palettes=None,
|
|
199
|
+
# bbox=True,)
|
|
200
|
+
# test.run()
|
|
202
201
|
|
|
203
202
|
|
|
204
203
|
|