robosat icon indicating copy to clipboard operation
robosat copied to clipboard

Implements topology-aware loss function; resolves #133

Open daniel-j-h opened this issue 6 years ago • 6 comments

First try at a topology-aware loss function

  • https://arxiv.org/abs/1712.02190
  • https://arxiv.org/abs/1603.08155

The idea is to optimize for topology like connectivity directly instead of just for pixel-wise loss.

Here is an high-level example from the first paper of what we want to achieve:

  • left: pixel-wise loss only
  • right: combined weighted pixel-wise and topology loss

top-loss

Here's a quick rundown of how it works:

  • a perceptual loss compares vgg feature map differences
  • we treat the segmentation predictions as "images"
  • we treat the segmentation masks as "images"
  • we compare the perceptual loss between prediction and mask "images"
  • the vgg feature maps pick up higher-level features like delineations, not only pixel-based

This is a bit experimental right now; we need to

  • [ ] refine this first implementation
  • [ ] find good vgg blocks and weights for the loss function itself
  • [ ] find good weights for the combined pixel-wise and topology-aware loss
  • [ ] run tests on multiple features
  • [ ] think about how to expose it to users (if at all)

This could be interesting to you @DragonEmperorG and @ocourtin since you've been contributing the road extraction and the recent loss function changes, respectively.

daniel-j-h avatar Oct 23 '18 18:10 daniel-j-h

I have a dataset to test this on now; need to tune it some more and run the tasks listed above out.

roads

daniel-j-h avatar Nov 02 '18 13:11 daniel-j-h

Daniel,

Would it be possible to publish your roads dataset online ? (anyhow having a common dataset to compare results with would be great. For buildings the INRIA one is good enough, but dunno anything related, with same quality for roads)

And as you could imagine would be interesting to compare with the others losses (mIoU and Lovasz)

ocourtin avatar Nov 02 '18 14:11 ocourtin

Hey I'm currently not allowed to push internal data outside.

That said you can create such a dataset on your own using the rs extract road handler and the Mapbox satellite endpoint to fetch aerial imagery tiles for cities in North America via https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.webp?access_token=.

daniel-j-h avatar Nov 02 '18 15:11 daniel-j-h

Well, the point for a decent roads extraction opendataset is less the imagery than the labels :)

ocourtin avatar Nov 02 '18 15:11 ocourtin

To be honest right now for trying things out I'm really just using the road extractor on OpenStreetMap data.

daniel-j-h avatar Nov 02 '18 16:11 daniel-j-h

Another idea I had is to optimize graph based connectivity directly in the loss function as in: set up floyd warshall all-pair shortest path as a loss function and let's optimize the adjacency matrix to change graph based edge weights for edges where there are roads.

Sketched out in https://gist.github.com/daniel-j-h/7b8c43fcdb9ddacaf0f490efe614d717

daniel-j-h avatar Oct 23 '19 23:10 daniel-j-h