@@ -54,20 +54,7 @@ def apply_xseg(input_path, model_path):
5454 dflimg .set_xseg_mask (mask )
5555 dflimg .save ()
5656
57- def remove_xseg (input_path ):
58- if not input_path .exists ():
59- raise ValueError (f'{ input_path } not found. Please ensure it exists.' )
60-
61- images_paths = pathex .get_image_paths (input_path , return_Path_class = True )
62-
63- for filepath in io .progress_bar_generator (images_paths , "Processing" ):
64- dflimg = DFLIMG .load (filepath )
65- if dflimg is None or not dflimg .has_data ():
66- io .log_info (f'{ filepath } is not a DFLIMG' )
67- continue
68-
69- dflimg .set_xseg_mask (None )
70- dflimg .save ()
57+
7158
7259def fetch_xseg (input_path ):
7360 if not input_path .exists ():
@@ -93,4 +80,55 @@ def fetch_xseg(input_path):
9380 files_copied += 1
9481 shutil .copy ( str (filepath ), str (output_path / filepath .name ) )
9582
96- io .log_info (f'Files copied: { files_copied } ' )
83+ io .log_info (f'Files copied: { files_copied } ' )
84+
85+ def remove_xseg (input_path ):
86+ if not input_path .exists ():
87+ raise ValueError (f'{ input_path } not found. Please ensure it exists.' )
88+
89+ io .log_info (f'Processing folder { input_path } ' )
90+ io .log_info ('!!! WARNING : APPLIED XSEG MASKS WILL BE REMOVED FROM THE FRAMES !!!' )
91+ io .log_info ('!!! WARNING : APPLIED XSEG MASKS WILL BE REMOVED FROM THE FRAMES !!!' )
92+ io .log_info ('!!! WARNING : APPLIED XSEG MASKS WILL BE REMOVED FROM THE FRAMES !!!' )
93+ io .input_str ('Press enter to continue.' )
94+
95+ images_paths = pathex .get_image_paths (input_path , return_Path_class = True )
96+
97+ files_processed = 0
98+ for filepath in io .progress_bar_generator (images_paths , "Processing" ):
99+ dflimg = DFLIMG .load (filepath )
100+ if dflimg is None or not dflimg .has_data ():
101+ io .log_info (f'{ filepath } is not a DFLIMG' )
102+ continue
103+
104+ if dflimg .has_xseg_mask ():
105+ dflimg .set_xseg_mask (None )
106+ dflimg .save ()
107+ files_processed += 1
108+ io .log_info (f'Files processed: { files_processed } ' )
109+
110+ def remove_xseg_labels (input_path ):
111+ if not input_path .exists ():
112+ raise ValueError (f'{ input_path } not found. Please ensure it exists.' )
113+
114+ io .log_info (f'Processing folder { input_path } ' )
115+ io .log_info ('!!! WARNING : LABELED XSEG POLYGONS WILL BE REMOVED FROM THE FRAMES !!!' )
116+ io .log_info ('!!! WARNING : LABELED XSEG POLYGONS WILL BE REMOVED FROM THE FRAMES !!!' )
117+ io .log_info ('!!! WARNING : LABELED XSEG POLYGONS WILL BE REMOVED FROM THE FRAMES !!!' )
118+ io .input_str ('Press enter to continue.' )
119+
120+ images_paths = pathex .get_image_paths (input_path , return_Path_class = True )
121+
122+ files_processed = 0
123+ for filepath in io .progress_bar_generator (images_paths , "Processing" ):
124+ dflimg = DFLIMG .load (filepath )
125+ if dflimg is None or not dflimg .has_data ():
126+ io .log_info (f'{ filepath } is not a DFLIMG' )
127+ continue
128+
129+ if dflimg .has_seg_ie_polys ():
130+ dflimg .set_seg_ie_polys (None )
131+ dflimg .save ()
132+ files_processed += 1
133+
134+ io .log_info (f'Files processed: { files_processed } ' )
0 commit comments