Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE]: Enable masking of unlabeled portions of imagery during model training

See original GitHub issue

This was a topic raised by an attendee at a workshop at FOSS4G International 2019 and is something we should consider implementing.

At the moment, we assume that all pixels in the input imagery are labeled when creating pixel masks and training models. Any unlabeled portion is assumed to have no objects of interest in it. There are some use cases where only a portion of an input image is labeled, and the user only wants the model to learn based on the labeled portion. There are a few ways we could support this:

  1. Enable selective tiling where unlabeled portions are filled with nodata values;
  2. Enable selective masking where unlabeled portions of masks are filled with NaN or something like that;
  3. Find a way to have loss functions have NA values in specific regions of the images so those get ignored during model training.


  1. is good though if there’s some bias in the labels near the edges of the labeled area, it could introduce bias in the model (it may learn that near nodata values some targets are more/less likely to occur).
  2. Is good but would be hard;
  3. Is good but would be really hard, particularly as we’d have to re-write every loss function anytime we added a new one. To some degree we’d have to do the same for 2., though it would just be with how to handle NaN inputs.

I’m inclined to go with 1. or 2. if we implement this. We’d definitely need tests implemented to make sure it works.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

rbaverycommented, Jan 14, 2020

Got it, should have made it clear that what I’m discussing is a separate problem from filling nodata areas outside of an unlabeled boundary. To be more clear, I was discussing how to handle the case where labels are present but no valid image values exist (either due to edge effects or cloud masking). I’ve made a separate issue here:

nrweircommented, Apr 5, 2020

I don’t think this actually fully solves the intention of this request - specifically, to find a way to mask out areas from contributing to the loss function. So I’ll leave it open for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image segmentation: leaving some pixels unlabeled?
Short version: Is it possible to leave some pixels unlabeled when training a segmentation model? If so, how would I specify “unlabeled” when...
Read more >
Fine-Tune a Pretrained Deep Learning Model - Esri
In this blog post, we will cover how to fine-tune Esri's existing pretrained deep learning models to fit to your local geography, imagery,...
Read more >
Semi-Supervised Learning for Forest Fire Segmentation Using ...
By taking into account the unique characteristics of UAV-acquired imagery of forest fire, the proposed method first uses occlusion-aware data ...
Read more >
Export Training Data For Deep Learning (Image Analyst)
The model generates bounding boxes and segmentation masks for each instance of an object in the image. This format is based on Feature...
Read more >
Self-supervised machine learning for live cell imagery ... - Nature
Pixels that exhibit FD in between these regimes remain unlabeled (gray pixels). e, f Supervised learning via self-labeled training data. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found