tferhan commited on
Commit
5402399
·
verified ·
1 Parent(s): 5b0445c

Update zipdeepness/processing/map_processor/map_processor_segmentation.py

Browse files
zipdeepness/processing/map_processor/map_processor_segmentation.py CHANGED
@@ -1,7 +1,9 @@
1
  """ This file implements map processing for segmentation model """
2
 
3
  from typing import Callable
4
-
 
 
5
  import numpy as np
6
  from qgis.core import QgsProject, QgsVectorLayer, QgsCoordinateTransform, QgsCoordinateReferenceSystem, QgsField, QgsFeature, QgsGeometry, QgsMessageLog
7
  from deepness.common.lazy_package_loader import LazyPackageLoader
@@ -160,8 +162,10 @@ class MapProcessorSegmentation(MapProcessorWithModel):
160
 
161
  self.set_results_img(full_result_img)
162
  if gdf_list:
 
 
 
163
  final_gdf = gpd.GeoDataFrame(pd.concat(gdf_list, ignore_index=True), crs=gdf_list[0].crs)
164
- csv_file = r"C:\Users\carin\Documents\segmen.csv"
165
  final_gdf.to_csv(csv_file, index=False)
166
  else:
167
  final_gdf = None
 
1
  """ This file implements map processing for segmentation model """
2
 
3
  from typing import Callable
4
+ import os
5
+ from pathlib import Path
6
+ from datetime import datetime
7
  import numpy as np
8
  from qgis.core import QgsProject, QgsVectorLayer, QgsCoordinateTransform, QgsCoordinateReferenceSystem, QgsField, QgsFeature, QgsGeometry, QgsMessageLog
9
  from deepness.common.lazy_package_loader import LazyPackageLoader
 
162
 
163
  self.set_results_img(full_result_img)
164
  if gdf_list:
165
+ home_dir = Path.home()
166
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
167
+ csv_file = home_dir / f"segmen_{timestamp}.csv"
168
  final_gdf = gpd.GeoDataFrame(pd.concat(gdf_list, ignore_index=True), crs=gdf_list[0].crs)
 
169
  final_gdf.to_csv(csv_file, index=False)
170
  else:
171
  final_gdf = None