Closed AmitMY closed 5 years ago
You'll need to use the develop
branch or quay.io/azavea/raster-vision:cpu-latest
which has that bug fix. (We're long overdue for a bug fix release.) Also, that test image you're using is too low resolution to detect the cars, and models tend to not generalize too well on different datasets which are too different from the training set. I would use the provided sample image at https://s3.amazonaws.com/azavea-research-public-data/raster-vision/examples/model-zoo/xview-vehicle-od/1677.tif
Here is the output I got in QGIS:
Thanks, that works. I wanted to verify this works on JPEGs as well, it does! :)
Correction, now the xView and COWC models work, but not others.
I tried running all models on the same JPEG and I get:
rastervision predict /app/packages/ISPRS_Potsdam.zip example.jpg output.json
/usr/local/lib/python3.5/dist-packages/pluginbase.py:439: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
. fromlist, level) 2019-03-06 09:19:14.059121: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA /usr/local/lib/python3.5/dist-packages/rasterio/init.py:217: NotGeoreferencedWarning: Dataset has no geotransform set. The identity matrix may be returned. s = DatasetReader(path, driver=driver, kwargs) Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/opt/src/rastervision/main.py", line 17, inrv.main() File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke return callback(args, kwargs) File "/opt/src/rastervision/cli/main.py", line 240, in predict predictor.predict(image_uri, output_uri, export_config) File "/opt/src/rastervision/predictor.py", line 131, in predict scene = scene_config.create_scene(self.task_config, self.tmp_dir) File "/opt/src/rastervision/data/scene_config.py", line 36, in create_scene raster_source = self.raster_source.create_source(tmp_dir) File "/opt/src/rastervision/data/raster_source/geotiff_source_config.py", line 70, in create_source y_shift_meters=y_shift_meters) File "/opt/src/rastervision/data/raster_source/geotiff_source.py", line 46, in init super().init(raster_transformers, temp_dir, channel_order) File "/opt/src/rastervision/data/raster_source/rasterio_source.py", line 69, in init test_chip = test_chip[:, :, self.channel_order] IndexError: index 3 is out of bounds for axis 2 with size 3
rastervision predict /app/packages/Spacenet_Vegas_Roads.zip example.jpg output.json
or
rastervision predict /app/packages/Spacenet_Vegas_Buildings.zip example.jpg output.json
/usr/local/lib/python3.5/dist-packages/pluginbase.py:439: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
. fromlist, level) 2019-03-06 09:15:57.030828: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA /usr/local/lib/python3.5/dist-packages/rasterio/init.py:217: NotGeoreferencedWarning: Dataset has no geotransform set. The identity matrix may be returned. s = DatasetReader(path, driver=driver, kwargs) 2019-03-06 09:15:57:rastervision.task.semantic_segmentation: INFO - Making predictions for scene Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/opt/src/rastervision/main.py", line 17, inrv.main() File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke return callback(args, kwargs) File "/opt/src/rastervision/cli/main.py", line 240, in predict predictor.predict(image_uri, output_uri, export_config) File "/opt/src/rastervision/predictor.py", line 144, in predict scene.prediction_label_store.save(labels) File "/opt/src/rastervision/data/label_store/semantic_segmentation_raster_store.py", line 90, in save transform = self.crs_transformer.transform AttributeError: 'IdentityCRSTransformer' object has no attribute 'transform'
The reason it crashed using the Potsdam package was because that was trained using a channel_order
of [3, 0, 1]
(to use the infrared band) but the image you used only has 3 bands. The solution is to pass --channel-order "0 1 2"
to the predict command. But this didn't work as expected as documented here https://github.com/azavea/raster-vision/issues/706. There's a workaround mentioned at the bottom of that issue that you can use to set the channel order. Also, I made an issue to improve the error message for the case : https://github.com/azavea/raster-vision/issues/709
A separate issue is that saving predictions for semantic segmentation with non-georeferenced imagery (like a JPG file) is broken. This PR https://github.com/azavea/raster-vision/pull/708 should fix that issue.
Thanks for hitting some edge cases that we normally don't run up against!
I tried the most basic experiment, with the latest docker version:
And ran:
as an example image for quick testing:
And: (I tried multiple models)
I get:
Why? How can I fix this?