Skip to main content

Start of the Coding Period

Start of the Coding Period

After the admission to the GSoC program, there is a time period to get started with the project, contact the mentors and so on. After this, the Coding Period starts. This year, it started on May 27th. In my case, I had already contributed to DeepForest, so I had already set up my working environment even before the proposal submission. Thus, I dedicated this period to add detail to my proposal and to discuss with my mentors who were actually very helpful and were always ready to guide and discussed how to tackle the different tasks.

I started by checking some papers on multi class object detection and how Resnet works, similar projects and going issue by issue in DeepForest to find all feature requests related to my project. Afterwards I outlined a list of all the methods with their priority and workflow for the whole project which was then discussed with my mentors. I immediately started with a pull request on making the model able to interact with multiple classes, trying to extend the functionality to all use cases I could think about in the most simple and natural way (for now natural to me, once the code is reviewed and used by other people, hopefully natural to everybody).

The first problem I came across that the use_bird_release model has 1 class 'Bird', imagine a user wants to start from that model, but has 5 classes of birds ('flamingo', 'ibis', 'egret','duck', 'goose'). We want them to start from a model that can make predictions of 'birds', but learn new classes.

So how it can be tackled is in init, we will load the regression head to the newly created 5 class model. I might also change the name, because its not that we care if the user freezes or not, its that we want them to start from the release model for regression weights which can be attained by few lines of code.

 
model=main.deepforest(num_classes=len(train.label.unique())
                                                          ,label_dict=label_dict)

# Use the backbone and regression head from the global bird detector to transfer
# learning about bird detection and bird related features 
 
global_bird_detector = main.deepforest()
global_bird_detector.use_bird_release()
 
model.model.backbone.load_state_dict(global_bird_detector.model.backbone
.state_dict())

model.model.head.regression_head.load_state_dict(global_bird_detector.model
.head.regression_head.state_dict())
 

 So basically no model training was needed. To create a DeepForest model, there is a classes argument.

 
def __init__(self, num_classes=1, label_dict = {"Tree":0}, transforms=None,
config_file='deepforest_config.yml'): 
 

so user know at time of model creation how many classes are desired. So I didn't made that from scratch. So we want to give the user an opportunity to load a baseline model, which has just a single class, and then replace the classification head. The snippet above is the implementation for this.

 And I started the research on wrapping of raster files on certain resolutions and how it can be evaluated taking results into consideration 

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 pytho...

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...

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 evalu...