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

Add method to post annotations for project #42

Merged
merged 5 commits into from
Jan 26, 2018

Conversation

lewfish
Copy link
Contributor

@lewfish lewfish commented Jan 19, 2018

This PR adds a method to posts annotations for a project that are stored in a JSON file on S3. This will be called by the Lambda function in https://github.com/azavea/raster-foundry-deployment/pull/115. This also makes some other changes to stay in sync with the latest RV and removes some methods which are not useful and annoying to maintain.

To test making a prediction, run the following commands:

from rasterfoundry.api import API
token = 'XXX'
api = API(refresh_token=token)

from rasterfoundry.utils import RasterVisionBatchClient

rv_batch_client = RasterVisionBatchClient(
    branch_name='lf/rfint', job_queue='raster-vision-cpu',
    job_definition='raster-vision-cpu')

from rasterfoundry.models.project import Project

uuid = 'de3780a1-9f3e-4fa3-a811-ad3060b64866'
proj = api.client.Imagery.get_projects_uuid(uuid=uuid).result()
proj = Project(proj, api)

inference_graph_uri = 's3://raster-vision-lf-dev/detection/trained-models/cowc-potsdam/5cm/inference-graph.pb'
label_map_uri = 's3://raster-vision-lf-dev/detection/configs/label-maps/cowc.pbtxt'
predictions_uri = 's3://raster-vision-lf-dev/detection/predictions/cowc-potsdam/5cm/de3780a1-9f3e-4fa3-a811-ad3060b64866.json'

proj.start_predict_job(rv_batch_client, inference_graph_uri, label_map_uri,
                       predictions_uri, channel_order=[0, 1, 2])

To test posting predictions, run the following after clearing the annotations in the UI at https://app.rasterfoundry.com/projects/edit/de3780a1-9f3e-4fa3-a811-ad3060b64866/annotate

proj.post_annotations(predictions_uri)

Connect #41

Previously I was in the habit of adding a method for each RV script, but
it's too much work to keep these up to date, and they aren't very useful.
The only method we need is one that corresponds to making predictions.
If we can create project config files which represent a set of projects and
their associated files, then I can train and eval models using RV without needing anything
further from this Python client, which simplifies things.
@lewfish lewfish requested a review from notthatbreezy January 19, 2018 22:58
@lewfish lewfish force-pushed the feature/lf/post-predictions branch from 3170c3e to 9597250 Compare January 19, 2018 23:20
@lewfish
Copy link
Contributor Author

lewfish commented Jan 25, 2018

Note: I need to make a release containing this PR.

x-top-matter:
- title: Introduction
level: 1
content: |
The Raster Foundry API allows developers to find, view, and analyze geospatial data in Raster Foundry. As the name implies, it's especially useful for working with large raster datasets like satellite imagery.
content: >
Copy link
Contributor

Choose a reason for hiding this comment

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

pretty sure this will break things in the spec - the swagger.io editor defaults to swagger 3.0, and we're using 2.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it. I'll use the 2.0 Editor for now on.

This also has the Polygon definition added which should be added to the spec.yml
in the RF repo. I have a note in an issue to do this.
@lewfish lewfish force-pushed the feature/lf/post-predictions branch from 9597250 to b9c4d84 Compare January 26, 2018 14:59
@lewfish
Copy link
Contributor Author

lewfish commented Jan 26, 2018

Can we try to get this reviewed soon? It's blocking me on https://github.com/azavea/raster-foundry-deployment/pull/115

Copy link
Contributor

@Lknechtli Lknechtli left a comment

Choose a reason for hiding this comment

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

LGTM
My main concern is hardcoding in rastervision settings

@@ -1,4 +1,4 @@
RV_CPU_QUEUE = 'raster-vision-cpu'
RV_CPU_JOB_DEF = 'raster-vision-cpu'
RV_PROJ_CONFIG_DIR_URI = 's3://raster-vision-od/configs/projects'
RV_PROJ_CONFIG_DIR_URI = 's3://raster-vision-lf-dev/detection/configs/projects/rf-generated'
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't these kinds of settings be stored in a gitignored file with an example placeholder file committed? We do something similar in RF

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 point. I have too much other stuff do right now, so I made an issue to do that: #43

@lewfish lewfish merged commit 53f8803 into develop Jan 26, 2018
@lewfish lewfish deleted the feature/lf/post-predictions branch January 26, 2018 18:01
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