forked from lanha/DSen2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiple generate patches bugs (lanha#6)
* Fix import and data_path * Fix path to xml file * Add data_name to class * Handle unever array case in downsizing * Add data_name instance var * Format * Format * Add generate patches script * Add logger * Add sys * Add md file for patch gen * Add test imgs ids for L1C * Add test images L2A * Add test commands * Remove xtra - * Remove duplicated test_data * remove / * Fix linter issues * Fix duplicated code * Disable tuple unbalance error * Disable type for var input_shape
- Loading branch information
Rodrigo Almeida
committed
Aug 14, 2020
1 parent
8a27f35
commit 574550a
Showing
11 changed files
with
178 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
S2B_MSIL1C_20200131T050029_N0208_R119_T45RTK_20200131T074329 | ||
S2B_MSIL1C_20200101T082239_N0208_R121_T34HCJ_20200101T102510 | ||
S2B_MSIL1C_20200103T024319_N0208_R003_T49JFM_20200103T054632 | ||
S2B_MSIL1C_20200112T143449_N0208_R139_T23VMG_20200112T162018 | ||
S2B_MSIL1C_20200116T155609_N0208_R054_T18TVK_20200116T192635 | ||
S2B_MSIL1C_20200112T144659_N0208_R139_T19LED_20200112T181024 | ||
S2B_MSIL1C_20200210T064019_N0209_R120_T43WEP_20200210T102521 | ||
S2B_MSIL1C_20200105T132229_N0208_R038_T22JEP_20200105T140318 | ||
S2A_MSIL1C_20200102T223701_N0208_R072_T59GLM_20200102T233015 | ||
S2B_MSIL1C_20200117T102249_N0208_R065_T33UVA_20200117T113858 | ||
S2B_MSIL1C_20200112T111329_N0208_R137_T30UWB_20200112T114220 | ||
S2B_MSIL1C_20200131T050029_N0208_R119_T45RTK_20200131T074329 | ||
S2A_MSIL1C_20200104T160641_N0208_R097_T16PET_20200104T193742 | ||
S2A_MSIL1C_20200105T021051_N0208_R103_T52SEC_20200105T040308 | ||
S2A_MSIL1C_20200104T074311_N0208_R092_T37NDF_20200104T092554 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
S2B_MSIL2A_20200805T044709_N0214_R076_T45RTK_20200805T090405 | ||
S2B_MSIL2A_20200808T081609_N0214_R121_T34HDK_20200808T122511 | ||
S2A_MSIL2A_20200805T024331_N0214_R003_T49JEN_20200805T042709 | ||
S2B_MSIL2A_20200806T141739_N0214_R096_T23VNH_20200806T164315 | ||
S2A_MSIL2A_20200805T153911_N0214_R011_T18TWK_20200805T200607 | ||
S2B_MSIL2A_20200809T144729_N0214_R139_T19LFE_20200809T190255 | ||
S2A_MSIL2A_20200806T064631_N0214_R020_T43WEP_20200806T083125 | ||
S2A_MSIL2A_20200807T132241_N0214_R038_T22JFP_20200807T154317 | ||
S2A_MSIL2A_20200809T223721_N0214_R072_T59GMN_20200810T002854 | ||
S2A_MSIL2A_20200809T102031_N0214_R065_T33UWA_20200809T130506 | ||
S2B_MSIL2A_20200809T110629_N0214_R137_T30UXC_20200809T140506 | ||
S2B_MSIL2A_20200805T044709_N0214_R076_T45RTK_20200805T090405 | ||
S2A_MSIL2A_20200804T160911_N0214_R140_T16PET_20200804T215526 | ||
S2B_MSIL2A_20200804T015659_N0214_R060_T52SED_20200804T044656 | ||
S2A_MSIL2A_20200801T073621_N0214_R092_T37NCE_20200801T102406 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Create train datasets | ||
Place L1C and L2A data into train folder, and then run: | ||
```bash | ||
python generate_patches.py L1C --save_prefix "../data/l1c" --run_60 --train_data | ||
python generate_patches.py L1C --save_prefix "../data/l1c" --train_data | ||
python generate_patches.py L2A --save_prefix "../data/l2a" --run_60 --train_data | ||
python generate_patches.py L2A --save_prefix "../data/l2a" --train_data | ||
``` | ||
|
||
# Create test datasets | ||
```bash | ||
python generate_patches.py L1C_test --save_prefix "../data/l1c" --run_60 --test_data | ||
python generate_patches.py L1C_test --save_prefix "../data/l1c" --test_data | ||
python generate_patches.py L2A_test --save_prefix "../data/l2a" --run_60 --test_data | ||
python generate_patches.py L2A_test --save_prefix "../data/l2a" --test_data | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import sys | ||
import argparse | ||
from pathlib import Path | ||
|
||
sys.path.append("..") | ||
|
||
from create_patches import readS2fromFile | ||
from create_patches import parser_common | ||
|
||
|
||
from utils.data_utils import get_logger | ||
|
||
LOGGER = get_logger(__name__) | ||
|
||
|
||
def arg_parse(): | ||
parser = argparse.ArgumentParser( | ||
description="Read Sentinel-2 data. The code was adapted from N. Brodu.", | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter, | ||
) | ||
parser.add_argument( | ||
"data_folder_path", help=("Path to folder with S2 SAFE files."), | ||
) | ||
parser = parser_common(parser) | ||
args = parser.parse_args() | ||
return args | ||
|
||
|
||
def main(args): | ||
# pylint: disable=logging-fstring-interpolation | ||
LOGGER.info(f"I will proceed with file {args.data_folder_path}") | ||
|
||
for file_path in Path(args.data_folder_path).glob("S2*"): | ||
LOGGER.info(f"Processing {file_path}") | ||
readS2fromFile( | ||
str(file_path), | ||
"", | ||
args.save_prefix, | ||
args.rgb_images, | ||
args.run_60, | ||
args.true_data, | ||
args.test_data, | ||
args.train_data, | ||
).process_patches() | ||
|
||
|
||
if __name__ == "__main__": | ||
main(arg_parse()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters