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

Save all-background mask in rs rasterize for hard-negative mining #43

Open
2 tasks
daniel-j-h opened this issue Jun 18, 2018 · 0 comments
Open
2 tasks

Comments

@daniel-j-h
Copy link
Collaborator

At the moment rs rasterize generates masks which always have a feature in them.

When we initially train on these masks and their corresponding images, we don't have background-only images in the training set. The images come with background pixels near the features, but the model might still pick up false positives.

Once we have a model trained on this initial dataset we use it to predict on tiles we know don't have a feature in their image and use false positives to feed them back into the dataset (it's important to put them into all splits, not just the training dataset).

This is called hard-negative mining where we "mine" for model mistakes a couple of times, put false positives back into the dataset, and then re-train, and repeat until we have a solid dataset.

Another option is to start with random negatives which is easier to do but the dataset then can get pretty big and often contains images which do not really help the model to train.

In both cases we need to background images. And we need to add them back into the dataset with a corresponding all-background mask. We don't provide such a mask at the moment.

Task

  • write out a all-background mask for users to do hard negative mining
  • document hard-negative mining process and how rs compare and rs subset helps

Workaround:

import numpy as np
from PIL import Image
from robosat.colors import make_palette

bg = np.zeros(shape=(512,512), dtype=np.uint8)                                                         
img = Image.fromarray(bg, mode='P')
img.putpalette(make_palette('denim', 'orange'))                                                      
img.save('bg.png', optimize=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant