Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Start raster-vision predict job #30

Merged
merged 2 commits into from
Oct 11, 2017
Merged

Start raster-vision predict job #30

merged 2 commits into from
Oct 11, 2017

Conversation

lewfish
Copy link
Contributor

@lewfish lewfish commented Oct 10, 2017

This PR adds a method to the Project class that starts a raster-vision predict job on AWS Batch. This job will download the image files associated with the project, and then run object detection on them. To test this PR, you can run the following snippet which will start a job in the R&D account, and will place the predictions for the Oakland project in s3://raster-vision/results/detection/predict/lhf_test/predictions.json. You can then view the output along with the original TIFF file in QGIS. To get the URI for the TIFF file, you can run proj.get_image_source_uris().

from rasterfoundry.api import API
token = ''
api = API(refresh_token=token)
proj = api.projects[0]

proj.start_predict_job(
    's3://raster-vision/results/detection/train/lhf_ships_neg0/train/inference_graph.pb',
    's3://raster-vision/datasets/detection/ships_label_map.pbtxt',
    's3://raster-vision/results/detection/predict/lhf_test/predictions.json')

Closes #29

The module name was incorrect
@lewfish
Copy link
Contributor Author

lewfish commented Oct 10, 2017

The build is failing because the Project class now tries to create a Batch client, and the AWS region isn't set. Any ideas on how to get around this?

@lewfish lewfish requested a review from notthatbreezy October 10, 2017 21:29

class Project(object):
"""A Raster Foundry project"""

TILE_PATH_TEMPLATE = '/tiles/{id}/{{z}}/{{x}}/{{y}}/'
EXPORT_TEMPLATE = '/tiles/{project}/export/'
batch_client = boto3.client('batch')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create the batch client in the function call. Not all Raster Foundry users will have AWS credentials set up or necessarily know about AWS (this is kind of an advanced feature). I don't think this is going to be called enough for a single project that the performance benefit will be noticeable.

This should also fix the build then the client won't be created during tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

@lewfish lewfish merged commit b1045ec into develop Oct 11, 2017
@lewfish lewfish deleted the lf/start-rv branch October 11, 2017 15:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants