Noob question about the Change Detection notebook and using the model #2119
Replies: 2 comments 8 replies
-
What does the For further debugging, you may try plotting a sample chip from the raster source to see if that looks correct.
I assume you're trying to use the rastervision run inprocess "config2.py" bundle -a out_dir "blog_1/" This will create a "blog_1/bundle/model-bundle.zip" file. This is what needs to be passed to the Also, as you realized, it's not possible to use this command with a scene_config = SceneConfig(
raster_source=MultiRasterSourceConfig(....),
label_store=SemanticSegmentationLabelStoreConfig(...),
)
pred_opts = SemanticSegmentationPredictOptions(...)
scene_config.to_file('scene_config.json')
pred_opts.to_file('pred_opts.json') rastervision predict_scene --predict_options_uri "pred_opts.json" "blog_1/bundle/model-bundle.zip" "scene_config.json" To do this in a notebook or script instead of the CLI: from rastervision.core.predictor import ScenePredictor
scene_config = Scene(
raster_source=MultiRasterSource(....),
label_store=SemanticSegmentationLabelStore(...),
)
pred_opts = SemanticSegmentationPredictOptions(...)
predictor = ScenePredictor("blog_1/bundle/model-bundle.zip", pred_opts)
predictor.predict_scene(scene) LMK if you run into any problems. |
Beta Was this translation helpful? Give feedback.
-
@MarkoTukiainen Let me also take this opportunity to plug a Geospatial Machine Learning with Cloud Services workshop that I will be conducting next month (May 15). The workshop is fully virtual and will heavily focus on using Raster Vision. Please consider registering if this is something that could be useful for you. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the updated address for the Change Detection notebook. I was able to port the code to be compatible with the current version, and was able to train some sort of a (dumb) model with it.
I'm afraid I'm very unfamiliar with python, pytorch and rastervision - but one's got to start somewhere?
Anyway, using the pipeline process to create predictions I'm getting some output from the validation cities (so this one):
rastervision run inprocess "config2.py" predict eval -a out_dir "blog_1/"
This creates labels.tif files which I can open in QGIS, and while the colors are reversed, the predictions are still there and usable.
However I'm kind of stumped as to how to a) either use the pipeline process for some specific images or b) use the model in the library mode to do the same. I've scoured the documentation, examples and the discussions but so far I've just come up with various slightly incompatible ways of doing something in that vein, and of course there's the fact that this is for change detection (as opposed to say object detection) - so I'll need to input two images (or a multirastersource?). And of course there's the whole 13 channels per image thing.
For the pipeline mode I run into errors immediately when trying to call rastervision pipeline with the model-bundle parameter and an infile and an outfile. (I even gdal_merged the 13 bands to a single geotiff to try this.) It always complains that "Could not read /opt/data/tmp/tmp_jr8nt_p/bundle/pipeline-config.json" or something similar.
For the library mode, here's what I've tried. I'm trying to detect changes in the beirut images. This of course does not work:
While it creates the labels.tif it's just a single black block in QGIS.
I feel like I'm missing some obvious, easy way of using the model in inference mode.
Beta Was this translation helpful? Give feedback.
All reactions