Live Blog: Training an Object Detection Faster R-CNN from The Scratch
First published on my old blog, The Silent Monk’s Retreat.
I am training a Faster R-CNN Tensorflow API to detect windmills from satellite images as part of my Summer internship, wherein I created my own dataset from scraping the web
Proper and expansive details about the project will be given in subsequent blog posts.
Real men train their neural networks from scratch rather than transfer learning . Real men use Xavier’s initialisation (Though I am not sure if this API does so :P). Anyways I decided to train an image detection model on my custom tiny dataset for satellite images of windmills my summer project from the scratch. It is interesting how the detector evolves and become more refine in the more latest iterations. It is funny how you can observe the CNN filters figure out the low level features which you can deduce from certain observations. When I got the Idea of writing this post I had already trained my classifier 18592 steps with several check points on the way, I will post them first and keep updating as I move along. I think I will stop at a mere 50000 iterations which will span over a week or so on Nvidia GTX 1060 as I have other stuff to do with my Laptop too.
There was another framework named Tensorbox which was run on RRSC-W’s server machine with Nvidia Quadro K2200 and transfer learning and was able to go through 250000 iterations in one night, I do not know how (O_O). We will see compare the final results with it in the end.
Let me give you a taste of our dataset:
The dataset are satellite images




We had 1288 images out of which we annotated 455 and used 226 images for training.
(WARNING: TRAINING DEEP NETWORKS WITH SMALL DATASETS WITHOUT TRANSFER LEARNING CAN LEAD TO OVERFITTING)
Which was crudely annotated by us to like:




with annotated bounding boxes stored in xml files.
We are actually detecting windmills shadows here. I will use the term windmill and windmill shadow interchangeably unless explicitly specified..
these are the images on which we will test our model:




The first and the third images are zoomed out images of an area where out test set is taken from although not the same windmills. ( DO NOT do this in commercial practice).
The second image is one of the images from our validation set.
The fourth and the final image is an image from a totally different area (in Finland) with background being green ( because of trees and grass) unlike outr dataset which is black and grey and brown. This image is given here to see how much does the background colour affect the detection. In the already complete Tensorbox version of our project we found out that it does not matter.
Results after various iterations:
- After iteration 7982




This is barely a detector right now as you can see that the detector is not able to detect windmills in a zoomed out image. This might be because the Region proposal network (RPN) are not trained properly yet. This can also be attributed to the fact that the classifier is less than 50% sure about the object.
- After iteration 12008




Image 1,2,3 : It seems like the RPN is getting better. But wait! Why are there so many boxes? RPN proposes different regions and then they are sent to classifier to tell whether it is a windmill or not. There can be various region proposals containing the same object and this is why we use something called as Non maximum suppression (NMS) (Thanks Sethu Iyer for pointing it out!) most used type of NMS is basically a greedy algorithm that greedily selects high scoring detections and deletes close-by less confident neighbours since they are likely to cover the same object. Our NMS should get better as classification gets more accurate
Image 4: This is where things get exciting, The network is detecting a part of image 4 as windmill but not the actual windmills 😥 . We can however see that the part which is detected is much like the shadow of windmill, but white. this might be because Gabor functions in low level filters and the subsequent who only concerned about the edges and pole like features rather than the colors.
- After iteration 13751




There are zero (nil, nada, zephyr, shunya) changes from 12008.
- After iteration 15894




Image 1. Seems like Both Classifier and the RPN has improved. also I am getting a single region proposal for a given object. also both the windmills are detected 🙂
Image 2: This seems like an overkill, way too many region proposals. Atleast it is detecting the windmill. however there is also a region proposal with vast empty space.
Image 3: I see that the Proposal region has improved quite a bit
Image 4: seems like the low-level colour filters have overtaken the low level Gabor functions
- After iteration 18592




Image 1: We can see that the classifier has improved its accuracy, its surety has improved.
Image 2: Better region proposals can be observed.
Image 3: more classifier accuracy.
Image 4: A bit confused over here, 2 out of the 3 region proposals do not take the windmill into account. The one which does has a huge Proposal region on which the actual windmill is at an upper corner.
- Loss Graphs (till step 18592)





Note: In this post specifically in the data collection and the project part, I is referring to my team compromising of Ashutosh Purohit, Vidhan Jolly and me (Pranav Garg)
I will soon update this post with my observations on various iterations.
This post will be updated with new results at iteration 22000, Which might take some time because:
I have a dual booted Laptop with GTX – 1060 and I am working on a lot of projects. my windmill detection problem statement has been completed on RRSC-W’s machine using Tensorbox ( with some pretty accurate and surprising results). However I will train this network whenever my machine is free. The Training also needs some supervision as I get an error that the loss tensor is NaN ( maybe someone forgot to add a small number to the softmax causing this error) and needs to be restarted when this error occurs.
If I forgot to add something or made an error, or if you have a suggestion please mail it to me at pranavgarg@gmail.com
Edit: This Live Blog has been shelved because of a possiblity of publication,which I will update here when it happens.
Edit