Skip to content

Instantly share code, notes, and snippets.

@lossyrob
Created August 30, 2018 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lossyrob/1702ece54e1375093372244e2b945008 to your computer and use it in GitHub Desktop.
Save lossyrob/1702ece54e1375093372244e2b945008 to your computer and use it in GitHub Desktop.
Raster Vision API 0.8 Example
import rastervision as rv
def get_scenes_to_labels():
""" Construct a list of tuples of S3 URI's to scenes, and the S3 URI to the label GeoJSON
"""
pass
def split_scenes(scenes_to_labels, test_ratio=0.8):
""" Read in the scenes_to_labels, read GeoJSON labels and split according to the
ratio. Returns a tuple of lists (train, val)
"""
pass
class NaipExperiments(rv.Experiments):
def exp_naip_center_pivot_mobilenet(self, num_steps=20):
(train_scenes, val_scenes) = split_scenes(get_scenes_to_labels())
task = rv.TaskConfig.builder(rv.OBJECT_DETECTION) \
.with_classes(["pivot"]) \
.with_chip_size(300) \
.build()
dataset = rv.DatasetConfig.builder() \
.with_task(task) \
.with_train_scenes(rv.SceneConfig.build_from(train)) \
.with_val_scenes(rv.SceneConfig.build_from(val)) \
.build()
backend = rv.BackendConfig.builder(rv.TFOD) \
.with_task(t) \
.with_model(rv.SSD_MOBILENET_V1_COCO) \
.build()
e = rv.ExperimentConfig.builder() \
.with_task(tasks) \
.with_dataset(dataset) \
.with_backend(backend)
return e.with_name("NAIP center pivot - mobilenet") \
.with_root("s3://raster-vision-rob-dev/naip/center-pivot/") \
.build()
if __name__ == "__main__":
rv.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment