Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
0.2 release (#395)
Browse files Browse the repository at this point in the history
* cleaning up files which are no longer needed

* fixes after removing forking workflow (#322)

* PR to resolve merge issues

* updated main build as well

* added ability to read in git branch name directly

* manually updated the other files

* fixed number of classes for main build tests (#327)

* fixed number of classes for main build tests

* corrected DATASET.ROOT in builds

* added dev build script

* Fixes for development inside the docker container (#335)

* Fix the mound command for the HRNet pretrained model in the docker readme

* Properly catch InvalidGitRepository exception

* make repo paths consistent with non-docker runs -- this way configs paths do not need to be changed

* Properly catch InvalidGitRepository exception in train.py

* Readme update (#337)

* README updates

* Removing user specific path from config

Authored-by: Fatemeh Zamanian <Fatemeh.Zamanian@microsoft.com>

* Fixing #324 and #325 (#338)

* update colormap to a non-discrete one -- fixes #324

* fix mask_to_disk to normalize by n_classes

* changes to test.py

* Updating data.py

* bug fix

* increased timeout time for main_build

* retrigger build

* retrigger the build

* increase timeout

* fixes 318 (#339)

* finished 318

* increased checkerboard test timeout

* fix 333 (#340)

* added label correction to train gradient

* changing the gradient data generator to take inline/crossline argument conssistent with the patchloader

* changing variable name to be more descriptive


Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* bug fix to model predictions (#345)

* replace hrnet with seresnet in experiments - provides stable default model (#343)

* PR to fix #342 (#347)

* intermediate work for normalization

* 1) normalize function runs based on global MIN and MAX 2) has a error handling for division by zero, np.finfo 3) decode_segmap normalizes the label/mask based on the n_calsses

* global normalization added to test.py

* increasing the threshold on timeout

* trigger

* revert

* idk what happened

* increase timeout

* picking up global min and max

* passing config to TrainPatchLoader to facilitate access to global min and max and other attr in low level functions, WIP

* removed print statement

* changed section loaders

* updated test for min and max from config too

* adde MIN and MAX to config

* notebook modified for loaders

* another dataloader in notebook

* readme update

* changed the default values for min max, updated the docstring for loaders, removed suppressed lines

* debug

* merging work from CSE team into main staging branch (#357)

* Adding content to interpretation README (#171)

* added sharat, weehyong to authors

* adding a download script for Dutch F3 dataset

* Adding script instructions for dutch f3

* Update README.md

prepare scripts expect root level directory for dutch f3 dataset. (it is downloaded into $dir/data by the script)

* Adding readme text for the notebooks and checking if config is correctly setup

* fixing prepare script example

* Adding more content to interpretation README

* Update README.md

* Update HRNet_Penobscot_demo_notebook.ipynb

Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* Updates to prepare dutchf3 (#185)

* updating patch to patch_size when we are using it as an integer

* modifying the range function in the prepare_dutchf3 script to get all of our data

* updating path to logging.config so the script can locate it

* manually reverting back log path to troubleshoot build tests

* updating patch to patch_size for testing on preprocessing scripts

* updating patch to patch_size where applicable in ablation.sh

* reverting back changes on ablation.sh to validate build pass

* update patch to patch_size in ablation.sh (#191)

Co-authored-by: Sharat Chikkerur <sharat.chikkerur@gmail.com>

* TestLoader's support for custom paths (#196)

* Add testloader support for custom paths.

* Add test

* added file name workaround for Train*Loader classes

* adding comments and clean up

* Remove legacy code.

* Remove parameters that dont exist in init() from documentation.

* Add unit tests for data loaders in dutchf3

* moved unit tests

Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* select contiguous data splits for val and train (#200)

* select contiguous data splits for test and train

* changed data-dir to data_dir as arg to prepare_dutchf3.py

* update script with new required parameter label_file

* ignoring split_alaudah_et_al_19 as it is not updated

* changed TEST to VALIDATION for clarity in the code

* included job to run scripts unit test

* Fix val/train split and add tests

* adjust to consider the whole horz_lines

* update environment - gitpython version

* Segy Converter Utility (#199)

* Add convert_segy utility script and related notebooks

* add segy files to .gitignore

* readability update

* Create methods for normalizing and clipping separately.

* Add comment

* update file paths

* cleanup tests and terminology for the normalization/clipping code

* update notes to provide more context for using the script

* Add tests for clipping.

* Update comments

* added Microsoft copyright

* Update root README

* Add a flag to turn on clipping in dataprep script.

* Remove hard coded values and fix _filder_data method.

* Fix some minor issues pointed out on comments.

* Remove unused lib.

* Rename notebooks to impose order; set env; move all def funtions into utils; improve comments in notebooks; and include code example to run prepare_dutchf3.py

* Label missing data with 255.

* Remove cell with --help command.

* Add notebooks to test pipeline.

* grammer edits

* update notebook output and utils naming

* fix output dir error and cleanup notebook

* fix yaml indent error in notebooks_build.yml

* fix merge issues and job name errors

* debugging the build pipeline

* combine notebook tests for segy converter since they are dependent on each other

Co-authored-by: Geisa Faustino <32823639+GeisaFaustino@users.noreply.github.com>

* Azureml train pipeline (#195)

* initial add of azure ml pipeline

* update references and dependencies

* fix integration tests

* remove incomplete tests

* add azureml requirements.txt for dutchf3 local patch and update pipeline config

* add empty __init__.py to cv_lib dutchf3

* Get train,py to run in pipeline

* allow output dir in train.py

* Clean up README and __init__

* only pass output if available and use input dir for output in train.py

* update comment in train.py

* updating azureml_requirements to only pull from /master

* removing windows guidance in azureml_pipelines/README.md

* adding .env.example

* adding azureml config example

* updating documentation in azureml_pipelines README.md

* updating main README.md to refer to AML guidance documentation

* updating AML README.md to include additional guidance to cancel runs

* adding documentation on AzureML pipelines in the AML README.me

* adding files needed section for AML training run

* including hyperlink in format poiniting to additional detail on Azure Machine Learning pipeslines in AML README.md

* removing the mention of VSCode in the AML README.md

* fixing typo

* modifying config to pipeline configuration in README.md

* fixing typo in README.md

* adding documentation on how to create a blob container and copy data onto it

* adding documentation on blob storage guidance

* adding guidance on how to get the subscription id

* adding guidance to activate environment and then run the kick off train pipeline from ROOT

* adding ability to pass in experiement name and different pipeline configuration to kickoff_train_pipeline.py

* adding Microsoft Corporation Copyright to kickoff_train_pipeline.py

* fixing format in README.md

* adding trouble shooting section in README.md for connection to subscription

* updating troubleshooting title

* adding guidance on how to download the config.json from the Azure Portal in the README.md

* adding additional guidance and information on AzureML compute targets and naming conventions

* changing the configuation file example to only include the train step that is currently supported

* updating config to pipeline configuration when applicable

* adding link to Microsoft docs for additional information on pipeline steps

* updated AML test build definitions

* updated AML test build definitions

* adding job to aml_build.yml

* updating example config for testing

* modifying the test_train_pipeline.py to have appropriate number of pipeline steps and other required modifications

* updating AML_pipeline_tests in aml_build.yml to consume environment variables

* updating scriptType, sciptLocation, and inlineScript in aml_build.yml

* trivial commit to re-trigger broken build pipelines

* fix to aml yml build to use env vars for secrets and everything else

* another yml fix

* another yml fix

* reverting structure format of jobs for aml_build pipeline tests

* updating path to test_train_pipeline.py

* aml_pipeline_tests timed out, extending timeoutInMinutes from 10 to 40

* adding additional pytest

* adding az login

* updating variables in aml pipeline tests

Co-authored-by: Anna Zietlow <annamzietlow@gmail.com>
Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* moved contrib contributions around from CSE

* fixed dataloader tests - updated them to work with new code from staging branch

* segyconverter notebooks and tests run and pass; updated documentation

* added test job for segy converter notebooks

* removed AML training pipeline from this release

* fixed training model tolerance precision in the tests - wasn't working

* fixed train.py build issues after the merge

* addressed PR comments

* fixed bug in check_performance

Co-authored-by: Sharat Chikkerur <sharat.chikkerur@microsoft.com>
Co-authored-by: kirasoderstrom <kirasoderstrom@gmail.com>
Co-authored-by: Sharat Chikkerur <sharat.chikkerur@gmail.com>
Co-authored-by: Geisa Faustino <32823639+GeisaFaustino@users.noreply.github.com>
Co-authored-by: Ricardo Squassina Lee <8495707+squassina@users.noreply.github.com>
Co-authored-by: Michael Zawacki <mikezawacki@hotmail.com>
Co-authored-by: Anna Zietlow <annamzietlow@gmail.com>

* make tests simpler (#368)

* removed Dutch F3 job from main_build

* fixed a bug in data subset in debug mode

* modified epoch numbers to pass the performance checks, checkedout check_performance from Max's branch

* modified get_data_for_builds.sh to set up checkerboard data for smaller size, minor improvements on gen_checkerboard

* send all the batches, disabled the performance checks for patch_deconvnet

* added comment to enable tests for patch_deconvnet after debugging, renamed gen_checkerboard, added options to new arg per Max's suggestion

* Replace HRNet with SEResNet model in the notebook (#362)

* replaced HRNet with SEResNet model in the notebook

* removed debugging cell info

* fixed bug where resnet_unet model wasn't loading the pre-trained version in the notebook

* fixed build VM problems

* Multi-GPU training support (#359)

* Data flow tests (#375)

* renamed checkerboard job name

* restructured default outputs from test.py to be dumped under output dir and not debug dir

* test.py output re-org

* removed outdated variable from check_performance.py

* intermediate work

* intermediate work

* bunch of intermediate works

* changing args for different trainings

* final to run dev_build"

* remove print statements

* removed print statement

* removed suppressed lines

* added assertion error msg

* added assertion error msg, one intential bug to test

* testing a stupid bug

* debug

* omg

* final

* trigger build

* fixed multi-GPU termination in train.py (#379)

* PR to fix #371 and #372  (#380)

* added learning rate to logs

* changed epoch for patch_deconvnet, and enabled the tests

* removed TODOs

* changed tensorflow pinned version (#387)

* changed tensorflow pinned version

* trigger build

* closes 385 (#389)

* Fixing #259 by adding symmetric padding along depth direction  (#386)

* BYOD Penobscot (#390)

* minor updates to files

* added penobscot conversion code

* docker build test (#388)

* added a new job to test bulding the docker, for now it is daisy-chained to the end

* this is just a TEST

* test

* test

* remove old image

* debug

* debug

* test

* debug

* enabled all the jobs

* quick fix

* removing non-tagged iamges

Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* added missing license headers and fixed formatting (#391)

* added missing license headers and fixed formatting

* some more license headers

* updated documentation to close 354 and 381 (#392)

* fix test.py and notebook issues (#394)

* resolved conflicts for 0.2 release (#396)

* V00.01.00003 release (#356)

* cleaning up files which are no longer needed

* fixes after removing forking workflow (#322)

* PR to resolve merge issues

* updated main build as well

* added ability to read in git branch name directly

* manually updated the other files

* fixed number of classes for main build tests (#327)

* fixed number of classes for main build tests

* corrected DATASET.ROOT in builds

* added dev build script

* Fixes for development inside the docker container (#335)

* Fix the mound command for the HRNet pretrained model in the docker readme

* Properly catch InvalidGitRepository exception

* make repo paths consistent with non-docker runs -- this way configs paths do not need to be changed

* Properly catch InvalidGitRepository exception in train.py

* Readme update (#337)

* README updates

* Removing user specific path from config

Authored-by: Fatemeh Zamanian <Fatemeh.Zamanian@microsoft.com>

* Fixing #324 and #325 (#338)

* update colormap to a non-discrete one -- fixes #324

* fix mask_to_disk to normalize by n_classes

* changes to test.py

* Updating data.py

* bug fix

* increased timeout time for main_build

* retrigger build

* retrigger the build

* increase timeout

* fixes 318 (#339)

* finished 318

* increased checkerboard test timeout

* fix 333 (#340)

* added label correction to train gradient

* changing the gradient data generator to take inline/crossline argument conssistent with the patchloader

* changing variable name to be more descriptive


Co-authored-by: maxkazmsft <maxkaz@microsoft.com>

* bug fix to model predictions (#345)

* replace hrnet with seresnet in experiments - provides stable default model (#343)

Co-authored-by: yalaudah <yazeed.alaudah@microsoft.com>
Co-authored-by: Fatemeh <fazamani@microsoft.com>

* typos

Co-authored-by: yalaudah <yazeed.alaudah@microsoft.com>
Co-authored-by: Fatemeh <fazamani@microsoft.com>

Co-authored-by: yalaudah <yazeed.alaudah@microsoft.com>
Co-authored-by: Fatemeh <fazamani@microsoft.com>
Co-authored-by: Sharat Chikkerur <sharat.chikkerur@microsoft.com>
Co-authored-by: kirasoderstrom <kirasoderstrom@gmail.com>
Co-authored-by: Sharat Chikkerur <sharat.chikkerur@gmail.com>
Co-authored-by: Geisa Faustino <32823639+GeisaFaustino@users.noreply.github.com>
Co-authored-by: Ricardo Squassina Lee <8495707+squassina@users.noreply.github.com>
Co-authored-by: Michael Zawacki <mikezawacki@hotmail.com>
Co-authored-by: Anna Zietlow <annamzietlow@gmail.com>
  • Loading branch information
10 people authored Jul 7, 2020
1 parent 15d45fb commit 080cf46
Show file tree
Hide file tree
Showing 91 changed files with 4,088 additions and 881 deletions.
5 changes: 5 additions & 0 deletions .azureml.example/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"subscription_id": "input_sub_id",
"resource_group": "input_resource_group",
"workspace_name": "input_workspace_name"
}
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BLOB_ACCOUNT_NAME=
BLOB_CONTAINER_NAME=
BLOB_ACCOUNT_KEY=
BLOB_SUB_ID=
AML_COMPUTE_CLUSTER_NAME=
AML_COMPUTE_CLUSTER_MIN_NODES=
AML_COMPUTE_CLUSTER_MAX_NODES=
AML_COMPUTE_CLUSTER_SKU=
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,8 @@ interpretation/environment/anaconda/local/src/cv-lib
# Rope project settings
.ropeproject

*.pth
*.pth

# Seismic data files
*.sgy
*.segy
122 changes: 70 additions & 52 deletions README.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
12 changes: 12 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@ We encourage submissions to the contrib folder, and once they are well-tested, d

Thank you.

#### Azure Machine Learning
If you would like to leverage Azure Machine Learning to create a Training Pipeline with this dataset we have guidance on how do so [here](interpretation/deepseismic_interpretation/azureml_pipelines/README.md)

### HRNet model guidance (experimental for now)

#### HRNet ImageNet weights model

To enable training from scratch on seismic data and to achieve the same results as the benchmarks quoted below you will need to download the HRNet model [pretrained](https://github.com/HRNet/HRNet-Image-Classification) on ImageNet. We are specifically using the [HRNet-W48-C](https://1drv.ms/u/s!Aus8VCZ_C_33dKvqI6pBZlifgJk) pre-trained model; other HRNet variants are also available [here](https://github.com/HRNet/HRNet-Image-Classification) - you can navigate to those from the [main HRNet landing page](https://github.com/HRNet/HRNet-Object-Detection) for object detection.

Unfortunately, the OneDrive location which is used to host the model is using a temporary authentication token, so there is no way for us to script up model download. There are two ways to upload and use the pre-trained HRNet model on DS VM:
- download the model to your local drive using a web browser of your choice and then upload the model to the DS VM using something like `scp`; navigate to Portal and copy DS VM's public IP from the Overview panel of your DS VM (you can search your DS VM by name in the search bar of the Portal) then use `scp local_model_location username@DS_VM_public_IP:./model/save/path` to upload
- alternatively, you can use the same public IP to open remote desktop over SSH to your Linux VM using [X2Go](https://wiki.x2go.org/doku.php/download:start): you can basically open the web browser on your VM this way and download the model to VM's disk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Now you're all set to run training and testing experiments on the F3 Netherlands
### Monitoring progress with TensorBoard
- from the this directory, run `tensorboard --logdir='output'` (all runtime logging information is
written to the `output` folder
- open a web-browser and go to either vmpublicip:6006 if running remotely or localhost:6006 if running locally
- open a web-browser and go to either `<vm_public_ip>:6006` if running remotely or localhost:6006 if running locally
> **NOTE**:If running remotely remember that the port must be open and accessible
More information on Tensorboard can be found [here](https://www.tensorflow.org/get_started/summaries_and_tensorboard#launching_tensorboard).
2 changes: 1 addition & 1 deletion contrib/experiments/interpretation/penobscot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Also follow instructions for [downloading and preparing](../../../README.md#peno
### Monitoring progress with TensorBoard
- from the this directory, run `tensorboard --logdir='output'` (all runtime logging information is
written to the `output` folder
- open a web-browser and go to either vmpublicip:6006 if running remotely or localhost:6006 if running locally
- open a web-browser and go to either `<vm_public_ip>:6006` if running remotely or `localhost:6006` if running locally
> **NOTE**:If running remotely remember that the port must be open and accessible
More information on Tensorboard can be found [here](https://www.tensorflow.org/get_started/summaries_and_tensorboard#launching_tensorboard).
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_all.sh → contrib/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nohup time python train.py \
# wait for python to pick up the runtime env before switching it
sleep 1

cd ../../dutchf3_patch/local
cd ../../dutchf3_patch

# patch based without skip connections
export CUDA_VISIBLE_DEVICES=2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash

# number of GPUs to train on
NGPU=8
NGPUS=$(nvidia-smi -L | wc -l)
if [ "$NGPUS" -lt "2" ]; then
echo "ERROR: cannot run distributed training without 2 or more GPUs."
exit 1
fi
# specify pretrained HRNet backbone
PRETRAINED_HRNET='/home/alfred/models/hrnetv2_w48_imagenet_pretrained.pth'
# DATA_F3='/home/alfred/data/dutch/data'
Expand All @@ -15,9 +19,8 @@ unset CUDA_VISIBLE_DEVICES
# bug to fix conda not launching from a bash shell
source /data/anaconda/etc/profile.d/conda.sh
conda activate seismic-interpretation
export PYTHONPATH=/storage/repos/forks/seismic-deeplearning-1/interpretation:$PYTHONPATH

cd experiments/interpretation/dutchf3_patch/distributed/
cd experiments/interpretation/dutchf3_patch/

# patch based without skip connections
nohup time python -m torch.distributed.launch --nproc_per_node=${NGPU} train.py \
Expand Down
4 changes: 2 additions & 2 deletions scripts/test_all.sh → contrib/scripts/test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nohup time python test.py \
--cfg "configs/${CONFIG_NAME}.yaml" > ${CONFIG_NAME}_test.log 2>&1 &
sleep 1

cd ../../dutchf3_patch/local
cd ../../dutchf3_patch

# patch based without skip connections
export CUDA_VISIBLE_DEVICES=2
Expand Down Expand Up @@ -140,7 +140,7 @@ wait

# scoring scripts are in the local folder
# models are in the distributed folder
cd ../../dutchf3_patch/local
cd ../../dutchf3_patch

# patch based without skip connections
export CUDA_VISIBLE_DEVICES=2
Expand Down
110 changes: 110 additions & 0 deletions contrib/tests/cicd/aml_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# Pull request against these branches will trigger this build
pr:
- master
- staging
- contrib

# Any commit to this branch will trigger the build.
trigger:
- master
- staging
- contrib

jobs:

# partially disable setup for now - done manually on build VM
- job: setup
timeoutInMinutes: 10
displayName: Setup
pool:
name: deepseismicagentpool
steps:
- bash: |
# terminate as soon as any internal script fails
set -e
echo "Running setup..."
pwd
ls
git branch
uname -ra
# TODO: uncomment in the next release to bring back AML
# # setup run environment
# ./scripts/env_reinstall.sh
#
# # use hardcoded root for now because not sure how env changes under ADO policy
# DATA_ROOT="/home/alfred/data_dynamic"
# ./tests/cicd/src/scripts/get_data_for_builds.sh ${DATA_ROOT}
#
# # upload pre-processed data to AML build WASB storage - overwrites by default and auto-creates container name
# azcopy --quiet --recursive \
# --source ${DATA_ROOT}/dutch_f3/data --destination https://${BLOB_ACCOUNT_NAME}.blob.core.windows.net/${BLOB_CONTAINER_NAME}/data \
# --dest-key ${BLOB_ACCOUNT_KEY}
# env:
# BLOB_ACCOUNT_NAME: $(amlbuildstore)
# BLOB_CONTAINER_NAME: "amlbuild"
# BLOB_ACCOUNT_KEY: $(amlbuildstorekey)
#
#
#- job: AML_pipeline_tests
# dependsOn: setup
# timeoutInMinutes: 20
# displayName: AML pipeline tests
# pool:
# name: deepseismicagentpool
# steps:
# - bash: |
# source activate seismic-interpretation
# # TODO: add code which launches your pytest files ("pytest sometest" OR "python test.py")
# # data is in $(amlbuildstore).blob.core.windows.net/amlbuild/data (container amlbuild, virtual folder data)
# # storage key is $(amlbuildstorekey)
# az --version
# az account show
# az login --service-principal -u $SPIDENTITY -p $SPECRET --tenant $SPTENANT
# az account set --subscription $SUB_ID
# mkdir .azureml
# cat <<EOF > .azureml/config.json
# {
# "subscription_id": "$SUB_ID",
# "resource_group": "$RESOURCE_GROUP",
# "workspace_name": "$WORKSPACE_NAME"
# }
# EOF
# pytest interpretation/tests/test_train_pipeline.py || EXITCODE=123
# exit $EXITCODE
# pytest
# env:
# SUB_ID: $(subscription_id)
# RESOURCE_GROUP: $(resource_group)
# WORKSPACE_NAME: $(workspace_name)
# BLOB_ACCOUNT_NAME: $(amlbuildstore)
# BLOB_CONTAINER_NAME: "amlbuild"
# BLOB_ACCOUNT_KEY: $(amlbuildstorekey)
# BLOB_SUB_ID: $(subscription_id)
# AML_COMPUTE_CLUSTER_NAME: "testcluster"
# AML_COMPUTE_CLUSTER_MIN_NODES: "1"
# AML_COMPUTE_CLUSTER_MAX_NODES: "8"
# AML_COMPUTE_CLUSTER_SKU: "STANDARD_NC6"
# SPIDENTITY: $(spidentity)
# SPECRET: $(spsecret)
# SPTENANT: $(sptenant)
# displayName: 'integration tests'

# - job: AML_short_pipeline_test
# dependsOn: setup
# timeoutInMinutes: 5
# displayName: AML short pipeline test
# pool:
# name: deepseismicagentpool
# steps:
# - bash: |
# source activate seismic-interpretation
# # TODO: OPTIONAL! Add a job which launches entire training pipeline for 1 epoch of training (train model for single epoch)
# # if you don't want this then delete the entire job from this file
# python interpretation/deepseismic_interpretation/azureml_pipelines/dev/kickoff_train_pipeline.py --experiment=DEV-train-pipeline-name --orchestrator_config=orchestrator_config="interpretation/deepseismic_interpretation/azureml_pipelines/pipeline_config.json"


2 changes: 2 additions & 0 deletions cv_lib/cv_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
2 changes: 1 addition & 1 deletion cv_lib/cv_lib/event_handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _create_checkpoint_handler(self):
def __call__(self, engine, to_save):
self._checkpoint_handler(engine, to_save)
if self._snapshot_function():
files = glob.glob(os.path.join(self._model_save_location, self._running_model_prefix + "*"))
files = glob.glob(os.path.join(self._model_save_location, self._running_model_prefix + "*"))
name_postfix = os.path.basename(files[0]).lstrip(self._running_model_prefix)
copyfile(
files[0],
Expand Down
2 changes: 2 additions & 0 deletions cv_lib/cv_lib/event_handlers/azureml_handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
9 changes: 5 additions & 4 deletions cv_lib/cv_lib/event_handlers/tensorboard_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from cv_lib.segmentation.dutchf3.utils import np_to_tb
from cv_lib.utils import decode_segmap


def create_summary_writer(log_dir):
writer = SummaryWriter(logdir=log_dir)
return writer
Expand All @@ -20,9 +21,9 @@ def _transform_image(output_tensor):
return torchvision.utils.make_grid(output_tensor, normalize=True, scale_each=True)


def _transform_pred(output_tensor):
def _transform_pred(output_tensor, n_classes):
output_tensor = output_tensor.squeeze().cpu().numpy()
decoded = decode_segmap(output_tensor)
decoded = decode_segmap(output_tensor, n_classes)
return torchvision.utils.make_grid(np_to_tb(decoded), normalize=False, scale_each=False)


Expand Down Expand Up @@ -111,5 +112,5 @@ def log_results(engine, evaluator, summary_writer, n_classes, stage):
y_pred[mask == 255] = 255

summary_writer.add_image(f"{stage}/Image", _transform_image(image), epoch)
summary_writer.add_image(f"{stage}/Mask", _transform_pred(mask), epoch)
summary_writer.add_image(f"{stage}/Pred", _transform_pred(y_pred), epoch)
summary_writer.add_image(f"{stage}/Mask", _transform_pred(mask, n_classes), epoch)
summary_writer.add_image(f"{stage}/Pred", _transform_pred(y_pred, n_classes), epoch)
2 changes: 2 additions & 0 deletions cv_lib/cv_lib/segmentation/dutchf3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
1 change: 0 additions & 1 deletion cv_lib/cv_lib/segmentation/dutchf3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ def git_branch():
def git_hash():
repo = Repo(search_parent_directories=True)
return repo.active_branch.commit.hexsha

1 change: 1 addition & 0 deletions cv_lib/cv_lib/segmentation/models/patch_deconvnet_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,5 @@ def get_seg_model(cfg, **kwargs):
cfg.MODEL.IN_CHANNELS == 1
), f"Patch deconvnet is not implemented to accept {cfg.MODEL.IN_CHANNELS} channels. Please only pass 1 for cfg.MODEL.IN_CHANNELS"
model = patch_deconvnet_skip(n_classes=cfg.DATASET.NUM_CLASSES)

return model
5 changes: 5 additions & 0 deletions cv_lib/cv_lib/segmentation/models/resnet_unet.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import logging
import os

import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision

logger = logging.getLogger(__name__)


class FPAv2(nn.Module):
def __init__(self, input_dim, output_dim):
Expand Down
1 change: 1 addition & 0 deletions cv_lib/cv_lib/segmentation/models/section_deconvnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,5 @@ def get_seg_model(cfg, **kwargs):
cfg.MODEL.IN_CHANNELS == 1
), f"Section deconvnet is not implemented to accept {cfg.MODEL.IN_CHANNELS} channels. Please only pass 1 for cfg.MODEL.IN_CHANNELS"
model = section_deconvnet(n_classes=cfg.DATASET.NUM_CLASSES)

return model
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,5 @@ def get_seg_model(cfg, **kwargs):
cfg.MODEL.IN_CHANNELS == 1
), f"Section deconvnet is not implemented to accept {cfg.MODEL.IN_CHANNELS} channels. Please only pass 1 for cfg.MODEL.IN_CHANNELS"
model = section_deconvnet_skip(n_classes=cfg.DATASET.NUM_CLASSES)

return model
9 changes: 4 additions & 5 deletions cv_lib/cv_lib/segmentation/models/seg_hrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,21 +430,20 @@ def init_weights(

if pretrained and not os.path.isfile(pretrained):
raise FileNotFoundError(f"The file {pretrained} was not found. Please supply correct path or leave empty")

if os.path.isfile(pretrained):
pretrained_dict = torch.load(pretrained)
logger.info("=> loading pretrained model {}".format(pretrained))
model_dict = self.state_dict()
pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict.keys()}
for k, _ in pretrained_dict.items():
logger.info(
'=> loading {} pretrained model {}'.format(k, pretrained))
logger.info("=> loading {} pretrained model {}".format(k, pretrained))
model_dict.update(pretrained_dict)
self.load_state_dict(model_dict)


def get_seg_model(cfg, **kwargs):
model = HighResolutionNet(cfg, **kwargs)
model.init_weights(cfg.MODEL.PRETRAINED)

if "PRETRAINED" in cfg.MODEL.keys():
model.init_weights(cfg.MODEL.PRETRAINED)
return model
1 change: 1 addition & 0 deletions cv_lib/cv_lib/segmentation/models/unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ def forward(self, x):

def get_seg_model(cfg, **kwargs):
model = UNet(cfg.MODEL.IN_CHANNELS, cfg.DATASET.NUM_CLASSES)

return model
3 changes: 1 addition & 2 deletions cv_lib/cv_lib/segmentation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import numpy as np


def _chw_to_hwc(image_array_numpy):
return np.moveaxis(image_array_numpy, 0, -1)


Loading

0 comments on commit 080cf46

Please sign in to comment.