PUTvision / qgis-plugin-deepness

Deepness is a remote sensing plugin that enables deep learning inference in QGIS
https://www.buymeacoffee.com/deepness
Apache License 2.0
99 stars 23 forks source link

Strange edge effects with segmentation and super-resolution models #122

Open Saareem opened 10 months ago

Saareem commented 10 months ago

Super resolution, edge effects

Road segmentation, edge effects

As seen in the pictures above, the plugin produces weird edge artifacts on the top and right borders of the image. There is most likely one pixel missing from the output mask (top and right), but I'm not able to locate the exact place in code. This occurs with the X2 super-resolution model and road segmentation model from the Deepness Model ZOO as well with some of my own models.

The edge effects reduce the usability of the results a lot as those on the edges can not be trusted.

Saareem commented 10 months ago

Blue pen is my own annotation, of course.

przemyslaw-aszkowski commented 10 months ago

Hi, Does it happen when the processed area is unlimited or when the processed area is exactly as the orthophoto? I can't see it on your image, but when I run the road segmentation model from ZOO it looks good (see below) image

If there is no more data in your orthophoto, it may be just the actual model output, as the model output is often not stable at the edges. Otherwise please provide detailed instructions on how to reproduce it.

By the way, there indeed is an issue with "off by one pixel" #123, but in your screenshot, it looks like dozens of pixels.

Cheers Przemek

Saareem commented 10 months ago

I was using "Entire layer" option. There seems to be one pixel missing from the full output but only on the right edge... The edge effect is there still. image

The same happens when I use "Visible part" option image

It might be partly because my spatial resolution (25 cm/px) is slightly off the model default resolution (21 cm/px). So I tried resampling:

image

It did not help at all. I can share the resampled raster for tests. https://drive.google.com/file/d/1t4HNe2D8-Qvla7rRvqqMQmRcUte6oJrX/view?usp=sharing

Saareem commented 10 months ago

image

There's definitely something strange going on the edges. The background layer and road layer are the only layers reaching to the whole processing extent. The other layers are cut off entirely. I'm using the default settings for the DeebLabV3_landcover4c model from the metadata. However, that 40% overlap seems excessive. With 0 px overlap I get this: image

It's better in a way but then the only layer reaching the whole processing extent (the raster) is the background layer.

przemyslaw-aszkowski commented 10 months ago

Thanks for the detailed description. We will be looking into the issue once we have some time. In the meantime, if you want, you can help investigate this issue. Cheers Przemek