currently finished pipeline
Browse files- main.py +25 -0
- polygons_processing/postpprocess_detectree2.py +3 -1
main.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from detectree2model.predictions.predict import run_detectree2
|
| 2 |
+
from polygons_processing.postpprocess_detectree2 import postprocess, export_df_as_geojson
|
| 3 |
+
from generate_tree_images.generate_tree_images import generate_tree_images
|
| 4 |
+
from classification.classification_predict import classify
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
if __name__=="__main__":
|
| 8 |
+
tif_input = ""
|
| 9 |
+
detectree2_output = run_detectree2(tif_input)
|
| 10 |
+
|
| 11 |
+
processed_output_df = postprocess(detectree2_output)
|
| 12 |
+
processed_geojson = '../polygons_processing/postprocessed_predictions'
|
| 13 |
+
|
| 14 |
+
generate_tree_images(processed_geojson, tif_input)
|
| 15 |
+
output_folder = '../generate_tree_images/tree_images'
|
| 16 |
+
|
| 17 |
+
for file_name in os.listdir(output_folder):
|
| 18 |
+
file_path = os.path.join(output_folder, file_name)
|
| 19 |
+
probs = classify(file_path)
|
| 20 |
+
#add probs to df and then convert to geojson again for final output
|
| 21 |
+
processed_output_df['class_probs'] = probs
|
| 22 |
+
|
| 23 |
+
final_output_path = 'result.geojson'
|
| 24 |
+
export_df_as_geojson(processed_output_df, final_output_path)
|
| 25 |
+
|
polygons_processing/postpprocess_detectree2.py
CHANGED
|
@@ -351,4 +351,6 @@ def postprocess(prediction_geojson_path):
|
|
| 351 |
|
| 352 |
df_res = process([df])
|
| 353 |
|
| 354 |
-
export_df_as_geojson(df=df_res, filename="postprocessed_predictions")
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
df_res = process([df])
|
| 353 |
|
| 354 |
+
export_df_as_geojson(df=df_res, filename="postprocessed_predictions")
|
| 355 |
+
|
| 356 |
+
return df_res
|