diff --git a/Workflows/basic.py b/Workflows/basic.py index e8191481278ddffec8f85156d6e25c89af5dff7a..d6d7ec6891f72edeed8c57f175bfa4ed1039e30c 100644 --- a/Workflows/basic.py +++ b/Workflows/basic.py @@ -1,7 +1,7 @@ import os import json import pickle -from moringa import preprocess_s2, run_segmentation +from moringa import fetch, preprocess_s2, run_segmentation from Learning.ObjectBased import ObjectBasedClassifier from Postprocessing import Report @@ -103,12 +103,15 @@ def basic(cfg, runlevel=1, single_step=False): d = json.load(f) oroot = os.path.join(d['output_path'], d['chain_name']) + oside = os.path.join(oroot, '_side') + os.makedirs(oside, exist_ok=True) step = runlevel # Preprocess timeseries - ts_lst_pkl = os.path.join(oroot, 'time_series_list.pkl') + ts_lst_pkl = os.path.join(oside, 'time_series_list.pkl') if step == 1: + print("[MORINGA-INFO] : ***** BEGIN STEP {} *****".format(step)) process_timeseries(oroot, d, ts_lst_pkl) step += 1 if single_step: @@ -117,6 +120,7 @@ def basic(cfg, runlevel=1, single_step=False): # Segmentation seg = os.path.join(oroot, 'segmentation/{}_obj_layer.tif'.format(d['chain_name'])) if step == 2: + print("[MORINGA-INFO] : ***** BEGIN STEP {} *****".format(step)) perform_segmentation(seg, d) step += 1 if single_step: @@ -127,6 +131,7 @@ def basic(cfg, runlevel=1, single_step=False): for cf in d['ref_db']['fields']: m_files.append(os.path.join(oroot, 'model/model_{}.pkl'.format(cf))) if step == 3: + print("[MORINGA-INFO] : ***** BEGIN STEP {} *****".format(step)) train_valid_workflow(seg, ts_lst_pkl, d, m_files) step += 1 if single_step: @@ -137,6 +142,7 @@ def basic(cfg, runlevel=1, single_step=False): for cf in d['ref_db']['fields']: map_files.append(os.path.join(oroot, 'maps/{}_map_{}.tif'.format(d['chain_name'],cf))) if step == 4: + print("[MORINGA-INFO] : ***** BEGIN STEP {} *****".format(step)) classify(seg, ts_lst_pkl, m_files, d, map_files) step += 1 if single_step: @@ -147,12 +153,8 @@ def basic(cfg, runlevel=1, single_step=False): for cf in d['ref_db']['fields']: report_fn.append(os.path.join(oroot, 'reports/{}_report_{}.pdf'.format(d['chain_name'],cf))) if step == 5: + print("[MORINGA-INFO] : ***** BEGIN STEP {} *****".format(step)) report(map_files, m_files, d, report_fn) + print("[MORINGA-INFO] : ***** PROCESS FINISHED *****".format(step)) return - - - - - -