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

Decrease semseg memory usage #630

Merged
merged 5 commits into from Dec 19, 2018
Merged

Decrease semseg memory usage #630

merged 5 commits into from Dec 19, 2018

Conversation

@lewfish
Copy link
Contributor

@lewfish lewfish commented Dec 18, 2018

Overview

This PR decreases memory usage on semantic segmentation problems. Previously, we were rasterizing the entire scene, which would lead to running out of memory on large scenes. Now, we rasterize on the fly for individual chips which allows us to chip large scenes.

The predict and eval steps still store the entire label array in RAM, which will be fixed in another PR. (See unchecked bullet points in #616) But, as a step forward this PR switches to using uint8's to store the labels, and avoids some redundant copies.

Testing

  • Using the Spacenet Vegas example, I verified that it produced uint8 prediction GeoTIFFs. I also timed it on chip to make sure that it didn't get slower as a result of this change.
export ROOT_URI=/opt/data/lf-dev/rv-output/vegas-spacenet
time rastervision run local -e spacenet.vegas \
    -a test True \
    -a use_remote_data False \
    -a root_uri ${ROOT_URI} \
    -a target buildings \
    -a task_type semantic_segmentation \
    -r chip

vegas with this PR:
real	0m42.827s
user	0m32.920s
sys	0m1.840s

vegas using develop branch:
real	0m45.460s
user	0m35.560s
sys	0m1.790s
  • I verified that the chip command ran successfully on a large ~8GB scene that previously failed. I also timed it, and it ran slightly faster with these changes which was a little surprising since for each chip, it has to intersect geoms for the whole scene with the chip extent. (This was done on a private project and doesn't need to be replicated, but details are available upon request.)

Closes #629
Connects #616

lewfish added 3 commits Dec 17, 2018
In order to avoid running out of memory, do rasterization on the fly for
individual chips and not on whole scene.
I don't think we'll ever have more than 256 classes and this will cut
memory and disk usage by 4x.
@lewfish lewfish added the review label Dec 18, 2018
@lewfish lewfish force-pushed the lf/seg-mem branch from 91c5635 to b9f268a Dec 18, 2018
@lewfish lewfish requested a review from jamesmcclain Dec 18, 2018
@lewfish lewfish changed the title WIP: Decrease semseg memory usage Decrease semseg memory usage Dec 18, 2018
Copy link
Member

@jamesmcclain jamesmcclain left a comment

Looks good to me.

@lewfish lewfish merged commit 0efe56e into develop Dec 19, 2018
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
@lewfish lewfish deleted the lf/seg-mem branch Dec 19, 2018
@lewfish lewfish removed the review label Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants