blue-sandbox 5.294.1__py3-none-any.whl → 5.320.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. blue_sandbox/.abcli/alias.sh +2 -0
  2. blue_sandbox/.abcli/assets/publish.sh +30 -0
  3. blue_sandbox/.abcli/assets.sh +15 -0
  4. blue_sandbox/.abcli/tests/help.sh +0 -8
  5. blue_sandbox/README.py +6 -51
  6. blue_sandbox/__init__.py +1 -1
  7. blue_sandbox/assets/__main__.py +45 -0
  8. blue_sandbox/assets/functions.py +66 -0
  9. blue_sandbox/config.env +3 -1
  10. blue_sandbox/env.py +5 -0
  11. blue_sandbox/help/functions.py +0 -10
  12. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/METADATA +2 -10
  13. blue_sandbox-5.320.1.dist-info/RECORD +33 -0
  14. blue_sandbox/.abcli/cemetery/inference/cloudwatch.sh +0 -40
  15. blue_sandbox/.abcli/cemetery/inference/inference.sh +0 -155
  16. blue_sandbox/.abcli/microsoft_building_damage_assessment/ingest/list.sh +0 -21
  17. blue_sandbox/.abcli/microsoft_building_damage_assessment/ingest.sh +0 -76
  18. blue_sandbox/.abcli/microsoft_building_damage_assessment/install.sh +0 -50
  19. blue_sandbox/.abcli/microsoft_building_damage_assessment/label.sh +0 -26
  20. blue_sandbox/.abcli/microsoft_building_damage_assessment/tensorboard.sh +0 -21
  21. blue_sandbox/.abcli/microsoft_building_damage_assessment/train.sh +0 -53
  22. blue_sandbox/.abcli/microsoft_building_damage_assessment.sh +0 -15
  23. blue_sandbox/.abcli/sagesemseg/cache_dataset.sh +0 -49
  24. blue_sandbox/.abcli/sagesemseg/consts.sh +0 -3
  25. blue_sandbox/.abcli/sagesemseg/train.sh +0 -48
  26. blue_sandbox/.abcli/sagesemseg/upload_dataset.sh +0 -47
  27. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_ingest.sh +0 -13
  28. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_ingest_list.sh +0 -19
  29. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_label.sh +0 -12
  30. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_train.sh +0 -20
  31. blue_sandbox/.abcli/tests/sagesemseg_train.sh +0 -29
  32. blue_sandbox/list.py +0 -37
  33. blue_sandbox/microsoft_building_damage_assessment/README.py +0 -45
  34. blue_sandbox/microsoft_building_damage_assessment/__main__.py +0 -82
  35. blue_sandbox/microsoft_building_damage_assessment/ingest.py +0 -31
  36. blue_sandbox/microsoft_building_damage_assessment/label.py +0 -38
  37. blue_sandbox/microsoft_building_damage_assessment/sas_token.py +0 -9
  38. blue_sandbox/microsoft_building_damage_assessment/train.py +0 -95
  39. blue_sandbox-5.294.1.dist-info/RECORD +0 -54
  40. /blue_sandbox/{microsoft_building_damage_assessment → assets}/__init__.py +0 -0
  41. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/LICENSE +0 -0
  42. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/WHEEL +0 -0
  43. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/top_level.txt +0 -0
@@ -1,50 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_install() {
4
- local options=$1
5
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
- local recreate_env=$(abcli_option_int "$options" recreate_env 0)
7
-
8
- if [[ -d "$abcli_path_git/building-damage-assessment" ]]; then
9
- abcli_log "✅ building-damage-assessment"
10
- else
11
- abcli_git_clone https://github.com/microsoft/building-damage-assessment.git
12
- [[ $? -ne 0 ]] && return 1
13
- fi
14
-
15
- [[ "$abcli_is_github_workflow" == true ]] ||
16
- [[ "$abcli_is_sagemaker_system" == true ]] &&
17
- return 0
18
-
19
- if [[ "$recreate_env" == 1 ]]; then
20
- abcli_conda_rm name=bda
21
- [[ $? -ne 0 ]] && return 1
22
- fi
23
-
24
- local exists=$(abcli_conda_exists name=bda)
25
- if [[ "$exists" == 0 ]]; then
26
- # https://github.com/microsoft/building-damage-assessment?tab=readme-ov-file#setup
27
- conda env create \
28
- -f $abcli_path_git/building-damage-assessment/environment.yml
29
- [[ $? -ne 0 ]] && return 1
30
- fi
31
-
32
- conda activate bda
33
- [[ $? -ne 0 ]] && return 1
34
-
35
- pushd $abcli_path_git/blue-sandbox >/dev/null
36
- pip3 install -e .
37
- [[ $? -ne 0 ]] && return 1
38
- popd >/dev/null
39
-
40
- [[ "$abcli_is_mac" == true ]] &&
41
- brew install wget
42
-
43
- return 0
44
- }
45
-
46
- function abcli_install_microsoft_building_damage_assessment() {
47
- blue_sandbox_microsoft_building_damage_assessment_install "$@"
48
- }
49
-
50
- abcli_install_module microsoft_building_damage_assessment 1.1.1
@@ -1,26 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_label() {
4
- local options=$1
5
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
7
- local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
8
-
9
- local object_name=$(abcli_clarify_object $2 .)
10
- [[ "$do_download" == 1 ]] &&
11
- abcli_download - $object_name
12
-
13
- abcli_log "labeling $object_name ..."
14
-
15
- abcli_eval dryrun=$do_dryrun \
16
- python3 -m blue_sandbox.microsoft_building_damage_assessment \
17
- label \
18
- --object_name $object_name \
19
- "${@:3}"
20
- local status="$?"
21
-
22
- [[ "$do_upload" == 1 ]] &&
23
- abcli_upload - $object_name
24
-
25
- return $status
26
- }
@@ -1,21 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_tensorboard() {
4
- local options=$1
5
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
- local do_browse=$(abcli_option_int "$options" browse $(abcli_not $do_dryrun))
7
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
8
- local port=$(abcli_option "$options" port 8889)
9
-
10
- local model_object_name=$(abcli_clarify_object $2 .)
11
- [[ "$do_download" == 1 ]] &&
12
- abcli_download - $model_object_name
13
-
14
- [[ "$do_browse" == 1 ]] &&
15
- abcli_browse http://localhost:$port/
16
-
17
- abcli_eval ,$options \
18
- tensorboard \
19
- --logdir $ABCLI_OBJECT_ROOT/$model_object_name/logs/ \
20
- --port $port
21
- }
@@ -1,53 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_train() {
4
- local options=$1
5
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
7
- local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
8
-
9
- local dataset_object_name=$(abcli_clarify_object $2 .)
10
- [[ "$do_download" == 1 ]] &&
11
- abcli_download - $dataset_object_name
12
-
13
- local model_object_name=$(abcli_clarify_object $3 $dataset_object_name-model-$(abcli_string_timestamp_short))
14
-
15
- abcli_log "training $dataset_object_name -> $model_object_name ..."
16
-
17
- conda activate bda
18
- [[ $? -ne 0 ]] && return 1
19
-
20
- abcli_eval dryrun=$do_dryrun \
21
- python3 -m blue_sandbox.microsoft_building_damage_assessment \
22
- train \
23
- --dataset_object_name $dataset_object_name \
24
- --model_object_name $model_object_name \
25
- "${@:4}"
26
- [[ $? -ne 0 ]] && return 1
27
-
28
- abcli_eval dryrun=$do_dryrun,path=$abcli_path_git/building-damage-assessment \
29
- python3 project_setup.py \
30
- --skip_health_check \
31
- --config $ABCLI_OBJECT_ROOT/$model_object_name/config.yml
32
- [[ $? -ne 0 ]] && return 1
33
-
34
- abcli_eval dryrun=$do_dryrun,path=$abcli_path_git/building-damage-assessment \
35
- python3 create_masks.py \
36
- --config $ABCLI_OBJECT_ROOT/$model_object_name/config.yml
37
- [[ $? -ne 0 ]] && return 1
38
-
39
- abcli_eval dryrun=$do_dryrun,path=$abcli_path_git/building-damage-assessment \
40
- python3 fine_tune.py \
41
- --config $ABCLI_OBJECT_ROOT/$model_object_name/config.yml
42
- [[ $? -ne 0 ]] && return 1
43
-
44
- abcli_eval dryrun=$do_dryrun,path=$abcli_path_git/building-damage-assessment \
45
- python3 inference.py \
46
- --config $ABCLI_OBJECT_ROOT/$model_object_name/config.yml
47
- [[ $? -ne 0 ]] && return 1
48
-
49
- [[ "$do_upload" == 1 ]] &&
50
- abcli_upload - $model_object_name
51
-
52
- return 0
53
- }
@@ -1,15 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment() {
4
- local task=$(abcli_unpack_keyword $1 help)
5
-
6
- local function_name=blue_sandbox_microsoft_building_damage_assessment_$task
7
- if [[ $(type -t $function_name) == "function" ]]; then
8
- $function_name "${@:2}"
9
- return
10
- fi
11
-
12
- python3 -m blue_sandbox.microsoft_building_damage_assessment "$@"
13
- }
14
-
15
- abcli_source_caller_suffix_path /microsoft_building_damage_assessment
@@ -1,49 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function runme() {
4
- local options=$1
5
-
6
- local script_full_name="${BASH_SOURCE[0]}"
7
- local script_name=$(abcli_script_get name)
8
-
9
- abcli_scripts source - sagesemseg/consts
10
-
11
- if [ $(abcli_option_int "$options" help 0) == 1 ]; then
12
- local options="$sagesemseg_cache_dataset_options,rm"
13
- abcli_meta_script_show_usage $script_full_name "$EOP[$options]$EOPE" \
14
- "cache dataset."
15
- return
16
- fi
17
-
18
- local dataset_name=$(abcli_option "$options" dataset pascal-voc)
19
- local do_rm=$(abcli_option "$options" rm 0)
20
- local suffix=$(abcli_option "$options" suffix v1)
21
-
22
- local dataset_object_name=$dataset_name-$suffix
23
-
24
- local dataset_object_path=$ABCLI_OBJECT_ROOT/$dataset_object_name
25
- mkdir -pv $dataset_object_path
26
-
27
- if [[ -d "$dataset_object_path/$dataset_name" ]]; then
28
- abcli_log "✅ $dataset_object_name/$dataset_name/"
29
- return
30
- fi
31
-
32
- abcli_log "caching $dataset_object_name"
33
-
34
- pushd $dataset_object_path >/dev/null
35
-
36
- if [[ ! -f "$dataset_name.tgz" ]]; then
37
- curl -O https://fast-ai-imagelocal.s3.amazonaws.com/pascal-voc.tgz
38
- else
39
- abcli_log "✅ $dataset_object_name/$dataset_name.tgz"
40
- fi
41
-
42
- tar -xvf $dataset_name.tgz
43
-
44
- [[ "$do_rm" == 1 ]] && rm -v $dataset_name.tgz
45
-
46
- popd >/dev/null
47
- }
48
-
49
- runme "$@"
@@ -1,3 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- export sagesemseg_cache_dataset_options="dataset=pascal-voc,suffix=<v1>"
@@ -1,48 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function runme() {
4
- local options=$1
5
-
6
- local script_full_name="${BASH_SOURCE[0]}"
7
- local script_name=$(abcli_script_get name)
8
-
9
- abcli_scripts source - sagesemseg/consts
10
-
11
- if [ $(abcli_option_int "$options" help 0) == 1 ]; then
12
- local options="dryrun,~upload"
13
- local args="[--deploy 0]$ABCUL[--delete_endpoint 0]$ABCUL[--epochs 10]$ABCUL[--instance_type ml.p3.2xlarge]"
14
- abcli_meta_script_show_usage $script_full_name "$EOP[$options]$ABCUL[test|<dataset-object-name>]$ABCUL[-|<model-object-name>]$ABCUL$args$EOPE" \
15
- "<dataset-object-name> -train-> <model-object-name>."
16
- return
17
- fi
18
-
19
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
20
- local do_upload=$(abcli_not $do_dryrun)
21
-
22
- local dataset_object_name=$(abcli_clarify_object "$2" test)
23
- if [[ "$dataset_object_name" == "test" ]]; then
24
- dataset_object_name="pascal-voc-v1-debug-v2"
25
- do_upload=0
26
- fi
27
-
28
- do_upload=$(abcli_option_int "$options" upload $do_upload)
29
-
30
- local model_object_name=$(abcli_clarify_object "$3" sagesemseg-model-test-$(abcli_string_timestamp))
31
-
32
- abcli_log "$script_name: $dataset_object_name -> $model_object_name"
33
-
34
- abcli_tags set \
35
- $model_object_name \
36
- trained_on.$dataset_object_name
37
-
38
- abcli_eval dryrun=$do_dryrun \
39
- python3 -m blue_sandbox.cemetry.sagesemseg train_model \
40
- --dataset_object_name $dataset_object_name \
41
- --model_object_name $model_object_name \
42
- "${@:4}"
43
-
44
- [[ "$do_upload" == 1 ]] &&
45
- abcli_upload - $model_object_name
46
- }
47
-
48
- runme "$@"
@@ -1,47 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function runme() {
4
- local options=$1
5
-
6
- local script_full_name="${BASH_SOURCE[0]}"
7
- local script_name=$(abcli_script_get name)
8
-
9
- abcli_scripts source - sagesemseg/consts
10
-
11
- if [ $(abcli_option_int "$options" help 0) == 1 ]; then
12
- local cache_options=$sagesemseg_cache_dataset_options
13
- local options="dryrun,suffix=<v1>"
14
- local args="[--count <count>]"
15
- abcli_meta_script_show_usage $script_full_name "$EOP[$cache_options]$ABCUL[$options]$ABCUL$args" \
16
- "upload dataset to SageMaker for training."
17
- return
18
- fi
19
-
20
- local cache_options=$1
21
- local dataset_name=$(abcli_option "$cache_options" dataset pascal-voc)
22
- local cache_suffix=$(abcli_option "$cache_options" suffix v1)
23
-
24
- local dataset_object_name=$dataset_name
25
- [[ ! -z "$cache_suffix" ]] && dataset_object_name=$dataset_name-$cache_suffix
26
-
27
- [[ "$dataset_name" == "pascal-voc" ]] &&
28
- abcli_scripts source dryrun=$do_dryrun \
29
- sagesemseg/cache_dataset \
30
- "$cache_options"
31
-
32
- local options=$2
33
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
34
- local suffix=$(abcli_option "$options" suffix v1)
35
-
36
- local object_name=$dataset_object_name-$suffix
37
-
38
- abcli_log "$script_name: $dataset_object_name -> ☁️ / $object_name"
39
-
40
- abcli_eval dryrun=$do_dryrun \
41
- python3 -m blue_sandbox.cemetry.sagesemseg upload_dataset \
42
- --dataset_object_name $dataset_object_name \
43
- --object_name $object_name \
44
- "${@:3}"
45
- }
46
-
47
- runme "$@"
@@ -1,13 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_sandbox_microsoft_building_damage_assessment_ingest() {
4
- local options=$1
5
-
6
- abcli_eval ,$options \
7
- blue_sandbox_microsoft_building_damage_assessment \
8
- ingest \
9
- event=Maui-Hawaii-fires-Aug-23,~upload,$options \
10
- test_blue_sandbox_microsoft_building_damage_assessment_ingest-$(abcli_string_timestamp_short) \
11
- --verbose 1 \
12
- "${@:2}"
13
- }
@@ -1,19 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_sandbox_microsoft_building_damage_assessment_ingest_list() {
4
- local options=$1
5
-
6
- abcli_eval ,$options \
7
- blue_sandbox_microsoft_building_damage_assessment_ingest list
8
- [[ $? -ne 0 ]] && return 1
9
-
10
- abcli_eval ,$options \
11
- blue_sandbox_microsoft_building_damage_assessment_ingest list \
12
- event=Maui-Hawaii-fires-Aug-23
13
- [[ $? -ne 0 ]] && return 1
14
-
15
- abcli_eval ,$options \
16
- blue_sandbox_microsoft_building_damage_assessment_ingest list \
17
- event=Maui-Hawaii-fires-Aug-23 \
18
- 04/
19
- }
@@ -1,12 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_sandbox_microsoft_building_damage_assessment_label() {
4
- local options=$1
5
-
6
- abcli_eval ,$options \
7
- blue_sandbox_microsoft_building_damage_assessment \
8
- label \
9
- ~upload,$options \
10
- $DAMAGES_TEST_DATASET_OBJECT_NAME \
11
- "${@:2}"
12
- }
@@ -1,20 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_sandbox_microsoft_building_damage_assessment_train() {
4
- local options=$1
5
-
6
- abcli_log_warning "disabled."
7
- return 0
8
-
9
- abcli_eval ,$options \
10
- blue_sandbox_microsoft_building_damage_assessment \
11
- train \
12
- ~upload,$options \
13
- $DAMAGES_TEST_DATASET_OBJECT_NAME \
14
- test_blue_sandbox_microsoft_building_damage_assessment_train-$(abcli_string_timestamp_short) \
15
- --verbose 1 \
16
- "${@:2}"
17
-
18
- # ignore error - TODO: disable
19
- return 0
20
- }
@@ -1,29 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_sandbox_cemetery_sagesemseg_train() {
4
- local options=$1
5
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
-
7
- abcli_log_warning "🚧 may incur cost 💰, disabled."
8
- do_dryrun=1
9
-
10
- local dataset_object_name=dataset-$(abcli_string_timestamp)
11
-
12
- abcli_eval dryrun=$do_dryrun \
13
- roofai_dataset_ingest \
14
- source=AIRS,target=sagemaker,$2 \
15
- $dataset_object_name \
16
- --test_count 0 \
17
- --train_count 16 \
18
- --val_count 16
19
-
20
- local model_object_name=model-$(abcli_string_timestamp)
21
-
22
- abcli_eval dryrun=$do_dryrun \
23
- blue_sandbox_cemetery_sagesemseg_train \
24
- ,$3 \
25
- $dataset_object_name \
26
- $model_object_name \
27
- --instance_type ml.g4dn.2xlarge \
28
- "${@:4}"
29
- }
blue_sandbox/list.py DELETED
@@ -1,37 +0,0 @@
1
- list_of_experiments = {
2
- "palisades": {
3
- "ICON": "🧑🏽‍🚒",
4
- "title": "Geospatial AI for Post-Disaster Damage Assessment using Maxar Open Data.",
5
- "url": "https://github.com/kamangir/palisades",
6
- "marquee": "https://github.com/kamangir/assets/blob/main/palisades/predict-datacube-maxar_open_data-WildFires-LosAngeles-Jan-2025-11-031311102213-103001010B9A1B00-2025-01-20-x54yb0/640.gif?raw=true",
7
- "status": "🎓",
8
- },
9
- "sagesemseg": {
10
- "ICON": "🌀",
11
- "title": "A SemSeg (Semantic Segmenter) trained and deployed on AWS Sagemaker.",
12
- "url": "https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/sagesemseg/README.md",
13
- "marquee": "https://github.com/kamangir/assets/blob/main/blue-sandbox/sagesemseg-predict.png?raw=true",
14
- "status": "⏸️",
15
- },
16
- "`@damages`": {
17
- "ICON": "🌐",
18
- "title": "Satellite imagery damage assessment workflow",
19
- "url": "https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/microsoft_building_damage_assessment/README.md",
20
- "marquee": "https://github.com/kamangir/assets/raw/main/blue-sandbox/Maui-Hawaii-fires-Aug-23-ingest-2025-01-10-qqJqhm.png?raw=true",
21
- "status": "⏸️",
22
- },
23
- "cemetery": {
24
- "ICON": "🪦",
25
- "title": "An AI cemetery.",
26
- "url": "https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/cemetery/README.md",
27
- "marquee": "https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true",
28
- "status": "🪦",
29
- },
30
- "template": {
31
- "ICON": "",
32
- "title": "",
33
- "url": "",
34
- "marquee": "https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true",
35
- "status": "🎰",
36
- },
37
- }
@@ -1,45 +0,0 @@
1
- from typing import Dict
2
-
3
- from blue_sandbox.env import DAMAGES_TEST_DATASET_OBJECT_NAME
4
-
5
- list_of_steps: Dict[str, Dict] = {
6
- "ingest": {
7
- "object_name": DAMAGES_TEST_DATASET_OBJECT_NAME,
8
- "image_name": "Maui-Hawaii-fires-Aug-23-damage-2025-01-09-GgnjQC",
9
- },
10
- "label": {
11
- "object_name": "",
12
- "image_name": DAMAGES_TEST_DATASET_OBJECT_NAME,
13
- },
14
- "train": {
15
- "object_name": "",
16
- "image_name": "Maui-Hawaii-fires-Aug-23-model-2025-01-10-NQb8IS",
17
- },
18
- "predict": {"object_name": "", "image_name": ""},
19
- "summarize": {"object_name": "", "image_name": ""},
20
- }
21
-
22
- items = (
23
- [f"`{step}`" for step in list_of_steps]
24
- + [
25
- (
26
- "[`{}`](https://kamangir-public.s3.ca-central-1.amazonaws.com/{}.tar.gz)".format(
27
- step["object_name"],
28
- step["image_name"],
29
- )
30
- if step["object_name"]
31
- else ""
32
- )
33
- for step in list_of_steps.values()
34
- ]
35
- + [
36
- (
37
- "![image](https://github.com/kamangir/assets/blob/main/blue-sandbox/{}.png?raw=true)".format(
38
- step["image_name"],
39
- )
40
- if step["image_name"]
41
- else ""
42
- )
43
- for step in list_of_steps.values()
44
- ]
45
- )
@@ -1,82 +0,0 @@
1
- import argparse
2
-
3
- from blueness import module
4
- from blueness.argparse.generic import sys_exit
5
-
6
- from blue_sandbox import NAME
7
- from blue_sandbox.microsoft_building_damage_assessment.ingest import ingest
8
- from blue_sandbox.microsoft_building_damage_assessment.label import label
9
- from blue_sandbox.microsoft_building_damage_assessment.train import train
10
- from blue_sandbox.microsoft_building_damage_assessment.sas_token import (
11
- decode_token,
12
- encode_token,
13
- )
14
- from blue_sandbox.help.microsoft_building_damage_assessment import list_of_events
15
- from blue_sandbox.logger import logger
16
-
17
- NAME = module.name(__file__, NAME)
18
-
19
- parser = argparse.ArgumentParser(NAME)
20
- parser.add_argument(
21
- "task",
22
- type=str,
23
- help="decode_token | encode_token | ingest | label | train",
24
- )
25
- parser.add_argument(
26
- "--object_name",
27
- type=str,
28
- )
29
- parser.add_argument(
30
- "--dataset_object_name",
31
- type=str,
32
- )
33
- parser.add_argument(
34
- "--model_object_name",
35
- type=str,
36
- )
37
- parser.add_argument(
38
- "--event_name",
39
- type=str,
40
- default=list_of_events[0],
41
- help=" | ".join(list_of_events),
42
- )
43
- parser.add_argument(
44
- "--verbose",
45
- type=bool,
46
- default=0,
47
- help="0|1",
48
- )
49
- parser.add_argument(
50
- "--token",
51
- type=str,
52
- )
53
- args = parser.parse_args()
54
-
55
- success = False
56
- if args.task == "decode_token":
57
- success = True
58
- print(decode_token(args.token))
59
- elif args.task == "encode_token":
60
- success = True
61
- print(encode_token(args.token))
62
- elif args.task == "ingest":
63
- success = ingest(
64
- object_name=args.object_name,
65
- event_name=args.event_name,
66
- verbose=args.verbose == 1,
67
- )
68
- elif args.task == "label":
69
- success = label(
70
- object_name=args.object_name,
71
- verbose=args.verbose == 1,
72
- )
73
- elif args.task == "train":
74
- success = train(
75
- dataset_object_name=args.dataset_object_name,
76
- model_object_name=args.model_object_name,
77
- verbose=args.verbose == 1,
78
- )
79
- else:
80
- success = None
81
-
82
- sys_exit(logger, NAME, args.task, success)
@@ -1,31 +0,0 @@
1
- from blueness import module
2
-
3
- from blue_objects import mlflow, metadata
4
-
5
- from blue_sandbox import NAME
6
- from blue_sandbox.logger import logger
7
-
8
-
9
- NAME = module.name(__file__, NAME)
10
-
11
-
12
- def ingest(
13
- event_name: str,
14
- object_name: str,
15
- verbose: bool = False,
16
- ) -> bool:
17
- logger.info(f"{NAME}.ingest({event_name}) -> {object_name}")
18
-
19
- return all(
20
- [
21
- mlflow.set_tags(
22
- object_name,
23
- {"event": event_name},
24
- ),
25
- metadata.post_to_object(
26
- object_name,
27
- "ingest",
28
- {"event": event_name},
29
- ),
30
- ]
31
- )
@@ -1,38 +0,0 @@
1
- import os
2
-
3
- from blueness import module
4
- from blue_objects import metadata, file, objects
5
- from blue_objects.env import abcli_path_git
6
-
7
- from blue_sandbox import NAME
8
- from blue_sandbox.logger import logger
9
-
10
-
11
- NAME = module.name(__file__, NAME)
12
-
13
-
14
- def label(
15
- object_name: str,
16
- verbose: bool = False,
17
- ) -> bool:
18
- logger.info(f"{NAME}.label: {object_name}")
19
-
20
- geojson_filename = os.path.join(
21
- abcli_path_git,
22
- "building-damage-assessment/data/demo/labels/Maui_Wildfires_August_0.geojson",
23
- )
24
-
25
- if not file.copy(
26
- geojson_filename,
27
- objects.path_of(
28
- filename="label.geojson",
29
- object_name=object_name,
30
- ),
31
- ):
32
- return False
33
-
34
- return metadata.post_to_object(
35
- object_name,
36
- "label",
37
- {"geojson": geojson_filename},
38
- )
@@ -1,9 +0,0 @@
1
- import base64
2
-
3
-
4
- def encode_token(token: str) -> str:
5
- return base64.b64encode(token.encode()).decode()
6
-
7
-
8
- def decode_token(encoded_token: str) -> str:
9
- return base64.b64decode(encoded_token.encode()).decode()