Skip to main content

Sensitivity of model to input resolution

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

def resample_image_in_place(self, image_path, new_res, resample_image):
args = gdal.WarpOptions(
xRes=new_res,
yRes=new_res
)
gdal.Warp(resample_image, image_path, options=args)

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 20cm resolution:


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

Popular posts from this blog

GSoC Final Report

GSoC Final Report My journey on the Google Summer of Code project passed by so fast, A lot of stuff happened during those three months, and as I’m writing this blog post, I feel quite nostalgic about these three months. GSoC was indeed a fantastic experience. It gave me an opportunity to grow as a developer in an open source community and I believe that I ended up GSoC with a better understanding of what open source is. I learned more about the community, how to communicate with them, and who are the actors in this workflow. So, this is a summary report of all my journey at GSoC 2022. Name : Ansh Dassani Organization:   NumFOCUS- Data Retriever Project title : Training and Evaluation of model on various resolutions Project link:  DeepForest Mentors :  Ben Weinstein ,  Henry Senyondo , Ethan White Introduction                                        DeepForest is a python package for training and predicting individual tree crowns from airborne RGB imagery. DeepForest comes with a prebuil

GSOC Project

DeepForest This project aims to make the model which would already be trained for the classification of species and detection of alive and dead, trees or birds using transfer learning on the current release model which is based on object detection, only detecting trees and birds, for now, It also involves improving the user interface for working with the multi-class model for a better understating of the species. Basic Understanding of project Through initial understanding and contribution to DeepForest, I have grasped a basic understanding that DeepForest uses Retinanet as a one-stage object detection model that utilizes a focal loss function to address class imbalance during training and which is composed of a backbone network. Backbone Network The backbone is responsible for computing a convolutional feature map over an entire input image and is an off-the-self convolutional network to predict individual tree crowns and birds from airborne RGB images. The pre-built model uses a semi

Deep Learning

What is deep learning? Deep learning is one of the subsets of machine learning that uses deep learning algorithms to implicitly come up with important conclusions based on input data. Genrally deeplearning is unsupervised learning or semi supervised learning and is based on representation learning that is a set of techniques that allows a system to automatically discover the representations needed for feature detection or classification from raw data. This replaces manual feature engineering and allows a machine to both learn the features and use them to perform a specific task, it learns from representative examples. For example: if you want to build a model that recognizes trees, you need to prepare a database that includes a lot of different tree images. The main architectures of deep learning are: -Convolutional neural networks -Recurrent neural networks -Generative adversarial networks -Recursive neural networks I'll be talking about them more in later part of this blog. Diffe