simba-uw-tf-dev 4.7.7__py3-none-any.whl → 4.7.9__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 +1 -1
- simba/assets/lookups/tooptips.json +32 -1
- simba/third_party_label_appenders/transform/sleap_csv_to_yolo.py +5 -3
- simba/ui/blob_tracker_ui.py +25 -26
- simba/ui/pop_ups/batch_preprocess_pop_up.py +2 -2
- simba/ui/pop_ups/initialize_blob_tracking_pop_up.py +2 -2
- simba/ui/pop_ups/video_processing_pop_up.py +8 -7
- simba/ui/pop_ups/yolo_pose_train_popup.py +1 -1
- simba/ui/tkinter_functions.py +1091 -1044
- simba/utils/read_write.py +2 -2
- simba/video_processors/batch_process_menus.py +24 -21
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/METADATA +1 -1
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/RECORD +17 -17
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.7.7.dist-info → simba_uw_tf_dev-4.7.9.dist-info}/top_level.txt +0 -0
simba/SimBA.py
CHANGED
|
@@ -231,7 +231,7 @@ try:
|
|
|
231
231
|
except (ImportError, AttributeError):
|
|
232
232
|
is_worker_process = False
|
|
233
233
|
if not is_worker_process:
|
|
234
|
-
print(f'SimBA environment variables: {ENV}.
|
|
234
|
+
print(f'SimBA environment variables: {ENV}. SimBA load time: {load_timer.elapsed_time_str}s')
|
|
235
235
|
|
|
236
236
|
class LoadProjectPopUp(object):
|
|
237
237
|
def __init__(self):
|
|
@@ -65,5 +65,36 @@
|
|
|
65
65
|
"ANIMAL_COUNT": "Number of animals (tracks) in the videos. Used to name classes (e.g. animal_1, animal_2) in the YOLO dataset.",
|
|
66
66
|
"sleap_remove_animal_ids": "If TRUE, merge all tracks into a single identity (animal_1). Use when animal IDs are not meaningful or for single-animal data.",
|
|
67
67
|
"sleap_threshold": "Minimum SLEAP instance confidence (the instance.score column in the CSV). Only pose predictions with score ≥ this value are used when building the YOLO dataset. E.g. 90 means keep instances where instance.score ≥ 0.9; lower values include more frames but may add noisy predictions.",
|
|
68
|
-
"SLEAP_SLP_DATA_DIR": "Directory containing SLEAP .SLP project/annotation files. Each .SLP file is converted to YOLO pose format."
|
|
68
|
+
"SLEAP_SLP_DATA_DIR": "Directory containing SLEAP .SLP project/annotation files. Each .SLP file is converted to YOLO pose format.",
|
|
69
|
+
"BATCH_CLIP_START_TIME": "Start time for clipping all videos. Use HH:MM:SS (e.g. 00:00:10). Click APPLY to copy this value to every video row.",
|
|
70
|
+
"BATCH_CLIP_END_TIME": "End time for clipping all videos. Use HH:MM:SS (e.g. 00:01:30). Must be after start time. Click APPLY to copy this value to every video row.",
|
|
71
|
+
"BATCH_DOWNSAMPLE_WIDTH": "Output width in pixels when downsampling all videos. Must be even. Click APPLY to copy to every video row.",
|
|
72
|
+
"BATCH_DOWNSAMPLE_HEIGHT": "Output height in pixels when downsampling all videos. Must be even. Click APPLY to copy to every video row.",
|
|
73
|
+
"BATCH_FPS": "Target frames per second for all videos. Click APPLY to copy this value to every video row.",
|
|
74
|
+
"BATCH_APPLY_DOWNSAMPLE": "Tick to check the downsample box for all videos (all will be downsampled on execute). Untick to uncheck all. Set width and height in the DOWNSAMPLE VIDEOS panel, then click APPLY there to copy those values to every row.",
|
|
75
|
+
"BATCH_APPLY_FPS": "Tick to enable FPS change for all videos.\nUntick to disable for all.\nSet FPS in CHANGE FPS panel, then APPLY there.",
|
|
76
|
+
"BATCH_APPLY_GREYSCALE": "Tick to enable greyscale for all videos.\nUntick to disable for all.",
|
|
77
|
+
"BATCH_APPLY_FRAME_COUNT": "Tick to superimpose frame numbers on all videos.\nUntick to disable for all.",
|
|
78
|
+
"BATCH_APPLY_CLAHE": "Tick to apply CLAHE (contrast) to all videos.\nUntick to disable for all.",
|
|
79
|
+
"BATCH_APPLY_CLIP": "Tick to enable clipping for all videos.\nUntick to disable for all.\nSet start/end in CLIP VIDEOS SETTING, then APPLY there.",
|
|
80
|
+
"BLOB_THRESHOLD": "How strict the background subtraction is (1–100). Lower = more counts as animal; higher = only strong differences.\nClick APPLY to put this value in every video row.",
|
|
81
|
+
"BLOB_SMOOTHING_TIME": "Smooth the animal's position over time (seconds). Reduces jitter. None = no smoothing.\nClick APPLY to put this value in every video row.",
|
|
82
|
+
"BLOB_BUFFER": "Extra pixels drawn around the detected animal (padding).\nClick APPLY to put this value in every video row.",
|
|
83
|
+
"BLOB_GAP_FILL_SIZE": "Filter size (as % of frame) that fills small holes in the animal mask. Helps merge broken blobs. None = off.\nClick APPLY to put this value in every video row.",
|
|
84
|
+
"BLOB_NOISE_REMOVAL_SIZE": "Filter size (as % of frame) that removes small speckles from the mask. Reduces false detections. None = off.\nClick APPLY to put this value in every video row.",
|
|
85
|
+
"BLOB_VERTICE_COUNT": "Number of points used to describe the blob shape. Higher = more detailed outline.",
|
|
86
|
+
"BLOB_SAVE_BG_VIDEOS": "If on, save the background-subtracted videos to the output folder.",
|
|
87
|
+
"BLOB_GAP_FILL_ITERATIONS": "How many times to run the gap-fill filter. More = stronger filling.",
|
|
88
|
+
"BLOB_NOISE_REMOVAL_ITERATIONS": "How many times to run the noise-removal filter. More = stronger cleaning.",
|
|
89
|
+
"BLOB_DUPLICATE_INCLUSION": "Copy the inclusion zones you drew for one video to all others. Pick the source video, then click APPLY.",
|
|
90
|
+
"BLOB_BACKGROUND_DIRECTORY": "Folder with one background reference video per video to track. File names must match input videos.\nClick APPLY to fill the BACKGROUND REFERENCE column for all rows.",
|
|
91
|
+
"BLOB_HEADER_VIDEO_NAME": "Input video filename for this row.",
|
|
92
|
+
"BLOB_HEADER_BACKGROUND_REFERENCE": "Background reference video path for this video.",
|
|
93
|
+
"BLOB_HEADER_THRESHOLD": "Background subtraction strictness (1–100) for this video.",
|
|
94
|
+
"BLOB_HEADER_SMOOTHING_TIME": "Smoothing time (seconds) for this video. Reduces jitter.",
|
|
95
|
+
"BLOB_HEADER_BUFFER": "Padding (pixels) around the detected animal for this video.",
|
|
96
|
+
"BLOB_HEADER_GAP_FILL_SIZE": "Gap-fill filter size (% of frame) for this video.",
|
|
97
|
+
"BLOB_HEADER_NOISE_REMOVAL_SIZE": "Noise-removal filter size (% of frame) for this video.",
|
|
98
|
+
"BLOB_HEADER_INCLUSION_ZONES": "Draw regions where the animal must stay. Tracking is ignored outside these zones.",
|
|
99
|
+
"BLOB_HEADER_QUICK_CHECK": "Preview blob tracking for this video with current settings."
|
|
69
100
|
}
|
|
@@ -19,10 +19,12 @@ from simba.utils.checks import (check_float, check_if_dir_exists, check_int,
|
|
|
19
19
|
check_valid_dataframe, check_valid_tuple)
|
|
20
20
|
from simba.utils.enums import Options
|
|
21
21
|
from simba.utils.errors import NoFilesFoundError
|
|
22
|
-
from simba.utils.printing import SimbaTimer,
|
|
23
|
-
from simba.utils.read_write import (
|
|
22
|
+
from simba.utils.printing import SimbaTimer, stdout_information, stdout_success
|
|
23
|
+
from simba.utils.read_write import (clean_sleap_filenames_in_directory,
|
|
24
|
+
copy_files_to_directory, create_directory,
|
|
24
25
|
find_files_of_filetypes_in_directory,
|
|
25
|
-
get_video_meta_data, read_frm_of_video,
|
|
26
|
+
get_video_meta_data, read_frm_of_video,
|
|
27
|
+
remove_a_folder)
|
|
26
28
|
from simba.utils.yolo import keypoint_array_to_yolo_annotation_str
|
|
27
29
|
|
|
28
30
|
|
simba/ui/blob_tracker_ui.py
CHANGED
|
@@ -26,7 +26,7 @@ from simba.utils.read_write import (find_all_videos_in_directory,
|
|
|
26
26
|
find_core_cnt,
|
|
27
27
|
find_files_of_filetypes_in_directory,
|
|
28
28
|
get_video_meta_data, remove_files,
|
|
29
|
-
save_json, str_2_bool, write_pickle)
|
|
29
|
+
save_json, str_2_bool, write_pickle, read_frm_of_video)
|
|
30
30
|
from simba.video_processors.blob_tracking_executor import BlobTrackingExecutor
|
|
31
31
|
|
|
32
32
|
ABSOLUTE = 'absolute'
|
|
@@ -101,15 +101,15 @@ class BlobTrackingUI(PopUpMixin):
|
|
|
101
101
|
def get_quick_settings(self):
|
|
102
102
|
self.settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name='settings', padx=15, pady=15)
|
|
103
103
|
self.quick_settings_frm = CreateLabelFrameWithIcon(parent=self.settings_frm, header="QUICK SETTINGS", icon_name='clock', padx=15, pady=15, relief='solid')
|
|
104
|
-
self.quick_setting_threshold_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=list(range(1, 101)), label="THRESHOLD:", label_width=30, dropdown_width=10, value=DEFAULT_THRESHOLD, img='threshold')
|
|
104
|
+
self.quick_setting_threshold_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=list(range(1, 101)), label="THRESHOLD:", label_width=30, dropdown_width=10, value=DEFAULT_THRESHOLD, img='threshold', tooltip_key='BLOB_THRESHOLD')
|
|
105
105
|
self.quick_setting_threshold_btn = SimbaButton(parent=self.quick_settings_frm, txt='APPLY', img='tick',cmd=self._set_threshold, cmd_kwargs={'threshold': lambda: self.quick_setting_threshold_dropdown.getChoices()})
|
|
106
|
-
self.set_smoothing_time_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=SMOOTHING_TIMES, label="SMOOTHING TIME (S):", label_width=30, dropdown_width=10, value=SMOOTHING_TIMES[0], img='smooth')
|
|
106
|
+
self.set_smoothing_time_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=SMOOTHING_TIMES, label="SMOOTHING TIME (S):", label_width=30, dropdown_width=10, value=SMOOTHING_TIMES[0], img='smooth', tooltip_key='BLOB_SMOOTHING_TIME')
|
|
107
107
|
self.set_smoothing_time_btn = SimbaButton(parent=self.quick_settings_frm, txt='APPLY', img='tick', cmd=self._set_smoothing_time, cmd_kwargs={'time': lambda: self.set_smoothing_time_dropdown.getChoices()})
|
|
108
|
-
self.set_buffer_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=BUFFER_SIZES, label="BUFFER (PIXELS):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='resize')
|
|
108
|
+
self.set_buffer_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=BUFFER_SIZES, label="BUFFER (PIXELS):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='resize', tooltip_key='BLOB_BUFFER')
|
|
109
109
|
self.set_buffer_btn = SimbaButton(parent=self.quick_settings_frm, txt='APPLY', img='tick', cmd=self._set_buffer_size, cmd_kwargs={'size': lambda: self.set_buffer_dropdown.getChoices()})
|
|
110
|
-
self.closing_kernal_size_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=KERNEL_SIZES, label="GAP FILL FILTER SIZE (%):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='pct')
|
|
110
|
+
self.closing_kernal_size_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=KERNEL_SIZES, label="GAP FILL FILTER SIZE (%):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='pct', tooltip_key='BLOB_GAP_FILL_SIZE')
|
|
111
111
|
self.set_closing_kernel_btn = SimbaButton(parent=self.quick_settings_frm, txt='APPLY', img='tick', cmd=self._set_close_kernel_dropdown, cmd_kwargs={'size': lambda: self.closing_kernal_size_dropdown.getChoices()})
|
|
112
|
-
self.opening_kernal_size_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=KERNEL_SIZES, label="NOISE REMOVAL FILTER SIZE (%):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='pct_2')
|
|
112
|
+
self.opening_kernal_size_dropdown = SimBADropDown(parent=self.quick_settings_frm, dropdown_options=KERNEL_SIZES, label="NOISE REMOVAL FILTER SIZE (%):", label_width=30, dropdown_width=10, value=BUFFER_SIZES[0], img='pct_2', tooltip_key='BLOB_NOISE_REMOVAL_SIZE')
|
|
113
113
|
self.opening_kernel_btn = SimbaButton(parent=self.quick_settings_frm, txt='APPLY', img='tick', cmd=self._set_open_kernel_dropdown, cmd_kwargs={'size': lambda: self.opening_kernal_size_dropdown.getChoices()})
|
|
114
114
|
|
|
115
115
|
self.settings_frm.grid(row=0, column=0, sticky=NW)
|
|
@@ -126,19 +126,17 @@ class BlobTrackingUI(PopUpMixin):
|
|
|
126
126
|
self.opening_kernel_btn.grid(row=6, column=1, sticky=NW)
|
|
127
127
|
|
|
128
128
|
self.run_time_settings_frm = CreateLabelFrameWithIcon(parent=self.settings_frm, header="RUN-TIME SETTINGS", icon_name='run', padx=15, pady=15, relief='solid')
|
|
129
|
-
self.bg_dir = FolderSelect(parent=self.run_time_settings_frm, folderDescription='BACKGROUND DIRECTORY:', lblwidth=30, initialdir=self.input_dir, lbl_icon='video_2')
|
|
129
|
+
self.bg_dir = FolderSelect(parent=self.run_time_settings_frm, folderDescription='BACKGROUND DIRECTORY:', lblwidth=30, initialdir=self.input_dir, lbl_icon='video_2', tooltip_key='BLOB_BACKGROUND_DIRECTORY')
|
|
130
130
|
self.bg_dir_apply = SimbaButton(parent=self.run_time_settings_frm, txt='APPLY', img='tick', cmd=self._apply_bg_dir, cmd_kwargs={'bg_dir': lambda: self.bg_dir.folder_path})
|
|
131
|
-
self.use_gpu_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=['TRUE', 'FALSE'], label="USE GPU:", label_width=30, dropdown_width=10, value='FALSE', img='gpu_3')
|
|
132
|
-
#if not self.gpu_available: self.use_gpu_dropdown.disable()
|
|
133
|
-
#else: self.use_gpu_dropdown.set_value(value='TRUE')
|
|
131
|
+
self.use_gpu_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=['TRUE', 'FALSE'], label="USE GPU:", label_width=30, dropdown_width=10, value='FALSE', img='gpu_3', tooltip_key='USE_GPU')
|
|
134
132
|
self.use_gpu_dropdown.disable()
|
|
135
|
-
self.core_cnt_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, self.core_cnt+1)), label="CPU CORE COUNT:", label_width=30, dropdown_width=10, value=int(self.core_cnt / 2), img='cpu_small')
|
|
133
|
+
self.core_cnt_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, self.core_cnt+1)), label="CPU CORE COUNT:", label_width=30, dropdown_width=10, value=int(self.core_cnt / 2), img='cpu_small', tooltip_key='CORE_COUNT')
|
|
136
134
|
|
|
137
|
-
self.vertice_cnt_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(10, 501)), label="VERTICE COUNT:", label_width=30, dropdown_width=10, value=30, img='polygon')
|
|
138
|
-
self.save_videos_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=['TRUE', 'FALSE'], label="SAVE BACKGROUND VIDEOS:", label_width=30, dropdown_width=10, value='TRUE', img='save_small')
|
|
139
|
-
self.close_iterations_dropdown_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, 20)), label="GAP FILLING ITERATIONS:", label_width=30, dropdown_width=10, value=3, img='abacus')
|
|
140
|
-
self.open_iterations_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, 20)), label="NOISE REMOVAL ITERATIONS:", label_width=30, dropdown_width=10, value=3, img='abacus_2')
|
|
141
|
-
self.duplicate_inclusion_zones_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(self.in_videos.keys()), label="DUPLICATE INCLUSION ZONES:", label_width=30, dropdown_width=self.len_max_char, value=list(self.in_videos.keys())[0], img='duplicate')
|
|
135
|
+
self.vertice_cnt_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(10, 501)), label="VERTICE COUNT:", label_width=30, dropdown_width=10, value=30, img='polygon', tooltip_key='BLOB_VERTICE_COUNT')
|
|
136
|
+
self.save_videos_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=['TRUE', 'FALSE'], label="SAVE BACKGROUND VIDEOS:", label_width=30, dropdown_width=10, value='TRUE', img='save_small', tooltip_key='BLOB_SAVE_BG_VIDEOS')
|
|
137
|
+
self.close_iterations_dropdown_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, 20)), label="GAP FILLING ITERATIONS:", label_width=30, dropdown_width=10, value=3, img='abacus', tooltip_key='BLOB_GAP_FILL_ITERATIONS')
|
|
138
|
+
self.open_iterations_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(range(1, 20)), label="NOISE REMOVAL ITERATIONS:", label_width=30, dropdown_width=10, value=3, img='abacus_2', tooltip_key='BLOB_NOISE_REMOVAL_ITERATIONS')
|
|
139
|
+
self.duplicate_inclusion_zones_dropdown = SimBADropDown(parent=self.run_time_settings_frm, dropdown_options=list(self.in_videos.keys()), label="DUPLICATE INCLUSION ZONES:", label_width=30, dropdown_width=self.len_max_char, value=list(self.in_videos.keys())[0], img='duplicate', tooltip_key='BLOB_DUPLICATE_INCLUSION')
|
|
142
140
|
self.duplicate_inclusion_zones_btn = SimbaButton(parent=self.run_time_settings_frm, txt='APPLY', img='tick', cmd=self._duplicate_inclusion_zones, cmd_kwargs={'video_name': lambda: self.duplicate_inclusion_zones_dropdown.getChoices()})
|
|
143
141
|
self.run_time_settings_frm.grid(row=0, column=1, sticky=NW, padx=(0, 15))
|
|
144
142
|
|
|
@@ -162,16 +160,16 @@ class BlobTrackingUI(PopUpMixin):
|
|
|
162
160
|
def get_main_table(self):
|
|
163
161
|
self.headings = {}
|
|
164
162
|
self.videos_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="VIDEOS", icon_name='video', pady=5, padx=15, relief='solid')
|
|
165
|
-
self.headings['video_name'] = SimBALabel(parent=self.videos_frm, txt='VIDEO NAME', width=self.len_max_char, font=Formats.FONT_HEADER.value)
|
|
163
|
+
self.headings['video_name'] = SimBALabel(parent=self.videos_frm, txt='VIDEO NAME', width=self.len_max_char, font=Formats.FONT_HEADER.value, tooltip_key='BLOB_HEADER_VIDEO_NAME')
|
|
166
164
|
self.headings['vertical_seperator'] = SimBASeperator(parent=self.videos_frm, color='black', orient='vertical', relief='flat')
|
|
167
|
-
self.headings['bg_path'] = SimBALabel(parent=self.videos_frm, txt='BACKGROUND \n REFERENCE', font=Formats.FONT_HEADER.value, justify='center', img='video_2')
|
|
168
|
-
self.headings['threshold'] = SimBALabel(parent=self.videos_frm, txt='THRESHOLD', font=Formats.FONT_HEADER.value, justify='center', img='threshold')
|
|
169
|
-
self.headings['inclusion_zones'] = SimBALabel(parent=self.videos_frm, txt='INCLUSION \n ZONES', font=Formats.FONT_HEADER.value, img='shapes_small')
|
|
170
|
-
self.headings['smoothing_time'] = SimBALabel(parent=self.videos_frm, txt='SMOOTHING \n TIME (S)', font=Formats.FONT_HEADER.value, img='smooth', justify='center')
|
|
171
|
-
self.headings['buffer_size'] = SimBALabel(parent=self.videos_frm, txt='BUFFER \n SIZE (PX)', font=Formats.FONT_HEADER.value, img='resize')
|
|
172
|
-
self.headings['closing_kernel_size'] = SimBALabel(parent=self.videos_frm, txt='GAP FILL \n SIZE (%)', font=Formats.FONT_HEADER.value, img='pct')
|
|
173
|
-
self.headings['opening_kernel_size'] = SimBALabel(parent=self.videos_frm, txt='NOISE \n FILL SIZE (%)', font=Formats.FONT_HEADER.value, img='pct_2')
|
|
174
|
-
self.headings['quick_check'] = SimBALabel(parent=self.videos_frm, txt='QUICK \n CHECK', font=Formats.FONT_HEADER.value, img='eye')
|
|
165
|
+
self.headings['bg_path'] = SimBALabel(parent=self.videos_frm, txt='BACKGROUND \n REFERENCE', font=Formats.FONT_HEADER.value, justify='center', img='video_2', tooltip_key='BLOB_HEADER_BACKGROUND_REFERENCE')
|
|
166
|
+
self.headings['threshold'] = SimBALabel(parent=self.videos_frm, txt='THRESHOLD', font=Formats.FONT_HEADER.value, justify='center', img='threshold', tooltip_key='BLOB_HEADER_THRESHOLD')
|
|
167
|
+
self.headings['inclusion_zones'] = SimBALabel(parent=self.videos_frm, txt='INCLUSION \n ZONES', font=Formats.FONT_HEADER.value, img='shapes_small', tooltip_key='BLOB_HEADER_INCLUSION_ZONES')
|
|
168
|
+
self.headings['smoothing_time'] = SimBALabel(parent=self.videos_frm, txt='SMOOTHING \n TIME (S)', font=Formats.FONT_HEADER.value, img='smooth', justify='center', tooltip_key='BLOB_HEADER_SMOOTHING_TIME')
|
|
169
|
+
self.headings['buffer_size'] = SimBALabel(parent=self.videos_frm, txt='BUFFER \n SIZE (PX)', font=Formats.FONT_HEADER.value, img='resize', tooltip_key='BLOB_HEADER_BUFFER')
|
|
170
|
+
self.headings['closing_kernel_size'] = SimBALabel(parent=self.videos_frm, txt='GAP FILL \n SIZE (%)', font=Formats.FONT_HEADER.value, img='pct', tooltip_key='BLOB_HEADER_GAP_FILL_SIZE')
|
|
171
|
+
self.headings['opening_kernel_size'] = SimBALabel(parent=self.videos_frm, txt='NOISE \n FILL SIZE (%)', font=Formats.FONT_HEADER.value, img='pct_2', tooltip_key='BLOB_HEADER_NOISE_REMOVAL_SIZE')
|
|
172
|
+
self.headings['quick_check'] = SimBALabel(parent=self.videos_frm, txt='QUICK \n CHECK', font=Formats.FONT_HEADER.value, img='eye', tooltip_key='BLOB_HEADER_QUICK_CHECK')
|
|
175
173
|
col_cnt = 0
|
|
176
174
|
for k, v in self.headings.items():
|
|
177
175
|
if k == 'vertical_seperator':
|
|
@@ -190,7 +188,8 @@ class BlobTrackingUI(PopUpMixin):
|
|
|
190
188
|
for video_cnt, (video_name, video_path) in enumerate(self.in_videos.items()):
|
|
191
189
|
row_cnt = video_cnt * 2 + 2
|
|
192
190
|
self.videos[video_name] = {}
|
|
193
|
-
|
|
191
|
+
img = read_frm_of_video(video_path=video_path, frame_index=0, size=(420, 280), keep_aspect_ratio=True, raise_error=False)
|
|
192
|
+
self.videos[video_name]['name_lbl'] = SimBALabel(parent=self.videos_frm, txt=video_name, width=self.len_max_char, font=Formats.FONT_HEADER.value, hover_img=img)
|
|
194
193
|
self.videos[video_name]["threshold_dropdown"] = SimBADropDown(parent=self.videos_frm, dropdown_options=list(range(1, 100)), label="", label_width=0, dropdown_width=15, value=DEFAULT_THRESHOLD)
|
|
195
194
|
self.videos[video_name]["inclusion_btn"] = SimbaButton(parent=self.videos_frm, txt="SET INCLUSION ZONES", cmd=lambda k=self.videos[video_name]['name_lbl']["text"]: self._launch_set_inclusion_zones(k), img='shapes_small')
|
|
196
195
|
self.videos[video_name]["bg_file"] = FileSelect(parent=self.videos_frm, width=25)
|
|
@@ -20,8 +20,8 @@ class BatchPreProcessPopUp(PopUpMixin):
|
|
|
20
20
|
def __init__(self):
|
|
21
21
|
PopUpMixin.__init__(self, title="BATCH PROCESS VIDEO", size=(600, 400), icon='stack')
|
|
22
22
|
selections_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SELECTIONS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.BATCH_PREPROCESS.value,)
|
|
23
|
-
self.input_folder_select = FolderSelect(selections_frm, "INPUT VIDEO DIRECTORY:", title="Select Folder with Input Videos", lblwidth=30, lbl_icon='
|
|
24
|
-
self.output_folder_select = FolderSelect(selections_frm, "OUTPUT VIDEO DIRECTORY:", title="Select Folder for Output videos", lblwidth=30, lbl_icon='folder_2')
|
|
23
|
+
self.input_folder_select = FolderSelect(selections_frm, "INPUT VIDEO DIRECTORY:", title="Select Folder with Input Videos", lblwidth=30, lbl_icon='folder_video', tooltip_key='VIDEO_DIR')
|
|
24
|
+
self.output_folder_select = FolderSelect(selections_frm, "OUTPUT VIDEO DIRECTORY:", title="Select Folder for Output videos", lblwidth=30, lbl_icon='folder_2', tooltip_key='SAVE_DIR')
|
|
25
25
|
|
|
26
26
|
confirm_btn = SimbaButton(parent=selections_frm, txt="CONFIRM", img='tick', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run)
|
|
27
27
|
selections_frm.grid(row=0, column=0, sticky=NW)
|
|
@@ -19,8 +19,8 @@ class InitializeBlobTrackerPopUp(PopUpMixin):
|
|
|
19
19
|
def __init__(self):
|
|
20
20
|
super().__init__(title="BLOB TRACKER: SELECT INPUT AND OUTPUT DIRECTORIES", size=(500, 500), icon='bubble_green')
|
|
21
21
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="DATA DIRECTORY SETTINGS", icon_name='settings')
|
|
22
|
-
self.input_dir_select = FolderSelect(parent=settings_frm, folderDescription= 'INPUT VIDEO DIRECTORY:', lblwidth=30, entry_width=20, lbl_icon='
|
|
23
|
-
self.save_dir_select = FolderSelect(parent=settings_frm, folderDescription='SAVE DATA DIRECTORY:', lblwidth=30, entry_width=20, lbl_icon='
|
|
22
|
+
self.input_dir_select = FolderSelect(parent=settings_frm, folderDescription= 'INPUT VIDEO DIRECTORY:', lblwidth=30, entry_width=20, lbl_icon='folder_video', tooltip_key='VIDEO_DIR')
|
|
23
|
+
self.save_dir_select = FolderSelect(parent=settings_frm, folderDescription='SAVE DATA DIRECTORY:', lblwidth=30, entry_width=20, lbl_icon='folder_2', tooltip_key='SAVE_DIR')
|
|
24
24
|
self.create_run_frm(run_function=self.run)
|
|
25
25
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
26
26
|
self.input_dir_select.grid(row=0, column=0, sticky=NW)
|
|
@@ -50,7 +50,7 @@ from simba.utils.read_write import (
|
|
|
50
50
|
check_if_hhmmss_timestamp_is_valid_part_of_video,
|
|
51
51
|
concatenate_videos_in_folder, find_all_videos_in_directory, find_core_cnt,
|
|
52
52
|
find_files_of_filetypes_in_directory, find_video_of_file, get_fn_ext,
|
|
53
|
-
get_video_meta_data, seconds_to_timestamp, str_2_bool,
|
|
53
|
+
get_video_meta_data, read_frm_of_video, seconds_to_timestamp, str_2_bool,
|
|
54
54
|
timestamp_to_seconds)
|
|
55
55
|
from simba.utils.warnings import FrameRangeWarning
|
|
56
56
|
from simba.video_processors.brightness_contrast_ui import BrightnessContrastUI
|
|
@@ -1590,7 +1590,6 @@ class ClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1590
1590
|
check_if_dir_exists(in_dir=data_dir, source=self.__class__.__name__, create_if_not_exist=False )
|
|
1591
1591
|
check_if_dir_exists(in_dir=save_dir, source=self.__class__.__name__, create_if_not_exist=True)
|
|
1592
1592
|
self.video_paths = find_all_videos_in_directory(directory=data_dir, as_dict=True, raise_error=True)
|
|
1593
|
-
print(self.video_paths)
|
|
1594
1593
|
self.video_meta_data = [get_video_meta_data(video_path=x)["frame_count"]for x in list(self.video_paths.values())]
|
|
1595
1594
|
max_video_name_len = len(max(list(self.video_paths.keys())))
|
|
1596
1595
|
super().__init__(title="CLIP MULTIPLE VIDEOS BY FRAME NUMBERS", icon='clip')
|
|
@@ -1606,9 +1605,10 @@ class ClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1606
1605
|
seperator.grid(row=1, column=0, columnspan=5, rowspan=1, sticky="ew")
|
|
1607
1606
|
|
|
1608
1607
|
self.entry_boxes, self.interactive_btns = {}, {}
|
|
1609
|
-
for cnt, video_name in enumerate(self.video_paths.
|
|
1608
|
+
for cnt, (video_name, video_path) in enumerate(self.video_paths.items()):
|
|
1610
1609
|
self.entry_boxes[video_name] = {}
|
|
1611
|
-
|
|
1610
|
+
img = read_frm_of_video(video_path=video_path, frame_index=0, size=(420, 280), keep_aspect_ratio=True, raise_error=False)
|
|
1611
|
+
SimBALabel(parent=data_frm, font=Formats.FONT_REGULAR_BOLD.value, txt=video_name + f' (frames: { self.video_meta_data[cnt]})', justify='left', hover_img=img).grid(row=cnt + 2, column=0, padx=padx, sticky=NW)
|
|
1612
1612
|
self.entry_boxes[video_name]["start"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, validation="numeric", justify='center')
|
|
1613
1613
|
self.entry_boxes[video_name]["end"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, validation="numeric", justify='center')
|
|
1614
1614
|
self.entry_boxes[video_name]["start"].grid(row=cnt + 2, column=2, sticky=NW, padx=padx)
|
|
@@ -1732,7 +1732,7 @@ class InitiateClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1732
1732
|
icon_link=Links.VIDEO_TOOLS.value,
|
|
1733
1733
|
)
|
|
1734
1734
|
self.input_folder = FolderSelect(
|
|
1735
|
-
data_frm, "VIDEO DIRECTORY:", title="Select Folder with videos", lblwidth=30, lbl_icon='
|
|
1735
|
+
data_frm, "VIDEO DIRECTORY:", title="Select Folder with videos", lblwidth=30, lbl_icon='folder_video'
|
|
1736
1736
|
)
|
|
1737
1737
|
self.output_folder = FolderSelect(
|
|
1738
1738
|
data_frm,
|
|
@@ -1814,9 +1814,10 @@ class ClipMultipleVideosByTimestamps(PopUpMixin):
|
|
|
1814
1814
|
seperator.grid(row=1, column=0, columnspan=5, rowspan=1, sticky="ew")
|
|
1815
1815
|
|
|
1816
1816
|
self.entry_boxes, self.interactive_btns = {}, {}
|
|
1817
|
-
for cnt, video_name in enumerate(self.video_paths.
|
|
1817
|
+
for cnt, (video_name, video_path) in enumerate(self.video_paths.items()):
|
|
1818
1818
|
self.entry_boxes[video_name] = {}
|
|
1819
|
-
|
|
1819
|
+
img = read_frm_of_video(video_path=video_path, frame_index=0, size=(420, 280), keep_aspect_ratio=True, raise_error=False)
|
|
1820
|
+
SimBALabel(parent=data_frm, txt=video_name, justify='center', hover_img=img, font=Formats.FONT_REGULAR_BOLD.value).grid(row=cnt + 2, column=0, sticky=NW, padx=padx)
|
|
1820
1821
|
video_length = self.video_meta_data[cnt]["video_length_s"]
|
|
1821
1822
|
video_length_hhmmss = seconds_to_timestamp(seconds=video_length)
|
|
1822
1823
|
SimBALabel(data_frm, txt=video_length_hhmmss, justify='center').grid(row=cnt + 2, column=1, sticky=NW, padx=padx)
|