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

Implements topology-aware loss function; resolves #133 #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daniel-j-h
Copy link
Collaborator

@daniel-j-h daniel-j-h commented Oct 23, 2018

First try at a topology-aware loss function

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 daniel-j-h force-pushed the issue/133 branch 4 times, most recently from 6c282db to 424b91f Compare October 24, 2018 10:08
@daniel-j-h
Copy link
Collaborator Author

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

roads

@ocourtin
Copy link
Contributor

ocourtin commented Nov 2, 2018

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)

@daniel-j-h
Copy link
Collaborator Author

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=.

@ocourtin
Copy link
Contributor

ocourtin commented Nov 2, 2018

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

@daniel-j-h
Copy link
Collaborator Author

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

@daniel-j-h
Copy link
Collaborator Author

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

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

Successfully merging this pull request may close these issues.

2 participants