Skip to main content

A library to apply some data augmentations in semantic segmentation problems

Reason this release was yanked:

old release

Project description

semantic_segmentation_augmentations

Data augmentation is a regularisation technique that generates new training samples from the original dataset by applying colour or geometric transformations. Although this technique has been applied in other computer vision fields, such as image classification or object detection, the application of this technique in semantic segmentation is not yet widespread.

This library groups some data augmentation techniques for semantic augmentation, such as CutOut or CutMix.

Install

To install the library, run:

pip install semantic_segmentation_augmentations

How it works

This data augmentation techniques are defined as fastai callbacks. Given this fact, you need to train your models using fastai’s API to use them.

As these techniques modifies the input image changing some pixels regions for something else, those callbacks have been defined as the union of two subcomponents: the HoleMakerTechnique, that defines how to make the hole (how to select the region to replace) and the HolesFilling, that defines how to fill the region defined below (the way to fill the region gives the name to the technique used).

The HoleMakerTechnique can be replaced in order to change the behavior of the selection of the region to replace. Doing so, you can use a CutOut technique that select the region randomly or based on the information bounded in that region.

You can also define your custom techniques defining how to fill a hole. You just need to extend the HolesFilling class and define the before_bacth (remember: we are using callbacks from fastai) abstract method. You will have two methods to simplify the process: the make_hole function, that uses the selected HoleMakerTechnique to make the hole and returns two slices (the region boundaries) and the fill_hole function, that fills the hole with something.

How to use it

In order to use these techniques, you just need to define the Learner from fastai with the Callbacks that represents the techniques that you want to use.

For example, if you want to create an U-net Leaner with resnet18 backbone and use the CutOut technique with HoleMakerRandom as region selection techinique (which is the default one), you just need to to add to your learner:

learner = unet_learner(dls, resnet18, cbs = CutOutRandom(hole_maker = HoleMakerRandom()))

In the next sections we explain all the details of those components.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semantic_segmentation_augmentations-0.0.9.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file semantic_segmentation_augmentations-0.0.9.tar.gz.

File metadata

File hashes

Hashes for semantic_segmentation_augmentations-0.0.9.tar.gz
Algorithm Hash digest
SHA256 cc54a9eb358aa36144b6ddfe4210f8f29bff0a7ab2dd906cdfd561e4ac5fa271
MD5 1e6b1ccced696c19165bf43e865e34cc
BLAKE2b-256 34c40465ab98948b5d7d93fd992eddd4071e612a556cdd95772045e60479b637

See more details on using hashes here.

File details

Details for the file semantic_segmentation_augmentations-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for semantic_segmentation_augmentations-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 dfaff476333a397e5e6b3b05aec0d5e2108306688348eca4d77aaea4b25400ec
MD5 7941239dd81deeb4ed6e8b4d216ae3b0
BLAKE2b-256 541cb09e206ad1b52db29f2ecf8ab5cf012bd2d912e9c58c4df062e5d281cf55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page