Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic Segmentation #657

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions contrib/segmentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Semantic Segmentation using PyTorch and Azure Machine Learning

This subproject contains a production ready training pipeline for a semantic segmentation model using PyTorch and Azure Machine Learning.

## Installation

To install the Azure ML CLI v2, [follow these instructions](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-configure-cli)

To install the last set of known working python dependencies run

```bash
pip install requirements.txt
```

Note that this project utilizes [pip-tools](https://github.com/jazzband/pip-tools) to manage its dependencies. Direct dependencies that the project requires are specified in `requirements.in` and may be upgraded to greater versions than that of `requirements.txt` at your own risk.
Empty file.
42 changes: 42 additions & 0 deletions contrib/segmentation/config/augmentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing import Tuple
import albumentations as A


def _preprocessing(patch_dim: Tuple[int, int] = (512, 512)):
transform = A.Compose(
[
# This allows meaningful yet stochastic cropped views
A.CropNonEmptyMaskIfExists(patch_dim[0], patch_dim[1], p=1),
A.RandomRotate90(p=0.5),
A.HorizontalFlip(p=0.5),
A.VerticalFlip(p=0.5),
A.Blur(p=0.25),
A.ColorJitter(p=0.25),
A.GaussNoise(p=0.25),
A.CoarseDropout(p=0.5, max_holes=64, max_height=8, max_width=8),
A.RandomBrightnessContrast(p=0.25),
],
)
return transform


def _augmentation(patch_dim: Tuple[int, int] = (512, 512)):
transform = A.Compose(
[
# This allows meaningful yet stochastic cropped views
A.CropNonEmptyMaskIfExists(patch_dim[0], patch_dim[1], p=1),
A.RandomRotate90(p=0.5),
A.HorizontalFlip(p=0.5),
A.VerticalFlip(p=0.5),
A.Blur(p=0.25),
A.ColorJitter(p=0.25),
A.GaussNoise(p=0.25),
A.CoarseDropout(p=0.5, max_holes=64, max_height=8, max_width=8),
A.RandomBrightnessContrast(p=0.25),
],
)
return transform


preprocessing = _preprocessing()
augmentation = _augmentation()