Sensitivity of the model to resolution
The Deepforest model was trained on 10cm data at 400px crops is way too sensitive to the input resolution of images and quality of images, and it tends to give inaccurate results on these images and it's not possible to always have images from drones from a particular height that is 10cm in our case, so we have to come up with a solution for how to get better results for multiple resolutions of data.
So we have two solutions to get better predictions, which can be preprocessing of data and retraining the model on different input resolutions. In preprocessing what we can do is to try to get nearby patch size to give better results as the resolution of the input data decreases compared to the data used to train the model, the patch size needs to be larger and we can pass the appropriate patch size in ```predict_tile``` function, but retaining of the model on different resolutions can be more amount of work but yes we tried to achieve it by evaluating images on different resolutions regularly.
Resampling of an image on a particular resolution
Resampling refers to changing the cell values due to changes in the raster cell grid. This can occur during reprojection. Even if the projection is not changing, we may want to change the effective cell size of an existing dataset.
Upsampling refers to cases where we are converting to higher resolution/smaller cells. Downsampling is resampling to lower resolution/larger cell sizes.
There are many ways to resample our image such as Rasterio and Gdal as a python library and we can also use QGis to wrap our image in a particular resolution, I used Gdal to make it work, here is snippet for it
where image_path is the path to the raster which has to be resampled, resample_image is the destination of the wrapped or resoluted raster which is our result and new_res is the resolution argument that signifies the resolution of the output raster and decides whether the raster should be upscaled or downscaled.
Below is an example of a raster on different resolutions for better visulization:
The image on 10cm resolution on which model is pretrained:
The image on 50cm resolution:
The image on 100cm resolution:
It's pointless to see after 100cm resolution as the image gets so much blurry that we won't be able to look at anything properly and won't be able to differentiate anything from our eyes so how can the model predict trees in it.
After getting rasters on the different resolutions we also calculated the evaluation score on these rasters which we can cover in our next blog that how to do so and what are the results for it.
After we have these images all we want is to train our model on these rasters so that our model can be robust to any type of input resolution. In long term, we will want to try curriculum learning/cross-training across different spatial resolutions for it to work.
Comments
Post a Comment