Machine Learning For Rooftop Detection and Solar Panel Installment

Machine Learning For Rooftop Detection and Solar Panel Installment

By Harshita Chopra


Solar energy is a promising and freely available resource for managing the forthcoming energy crisis, without hurting the environment. Unlike conventional fossil fuels, it won’t run out anytime soon.

Fact — There’s enough solar energy hitting the Earth every hour to meet all of humanity’s power needs for an entire year.

Let’s face it, what’s cooler than the sun powering your home? And that is quite literally true.

Fun fact — Solar panels also act as “roof shades” to keep buildings cool. They absorb the sun’s rays, directing them away from the roof, whereas a roof without panels would allow heat to penetrate into the building.

As people around the world look for ways to “go green” and protect the earth, solar panels provide an excellent option. But the utility industry needs smart systems that can help improve the integration of renewables in an effective way.

Solar AI, a Singapore based startup incubated as a part of ENGIE Factory, collaborated with Omdena, to pull off a mission to hyper-scale the deployment of distributed solar and the transition towards 100% renewables by modernizing the way rooftop solar is sold.


The problem statement

The rooftop solar assessment process can be time consuming and expensive, taking anywhere between 1 hour to 2 full days to calculate the solar potential of each rooftop. In the solar industry, this has resulted in the cost of sales taking up to 30–40% of total project costs, significantly worsening the unit economics of solar projects.

By automating these evaluations with Artificial Intelligence, Solar AI aims to drastically reduce the cost of this process and make this information easily available for both building owners as well as solar energy companies.

So we had a mission to accomplish within eight weeks:

Combining multiple models that can automatically identify rooftops and detect rooftop features using machine learning like obstacles, material, slopes and area from high-resolution satellite imagery.


The solution

Solar AI provided us with high-resolution satellite imagery in Singapore. With these huge and detailed images in hand, we had a list of tasks to perform.

The 2 GB size of one image fascinated me enough, to begin with pre-processing and creating thousands of smaller tiles out of it — using just a few lines of code bundled up in a function.


Snapshot of a few tiles created from the huge image / Source:



The power of annotations

Even the most technically advanced algorithms cannot address or solve a problem without the right data. We know having access to data is quite valuable, but having access to data with a learnable structure is the biggest competitive advantage nowadays. That’s the power of data annotation.


A quirky image with hundreds of rooftops / Source:


Our wonderful team of collaborators volunteered to annotate thousands of rooftops in 500+ tiles. We pulled off a smarter method of annotating the buildings, by mapping the OSM data on the raster layer (TIF format tile) in the QGIS software.

The consistent determination of the annotators resulted in a perfectly labeled dataset for Supervised Machine Learning algorithms.

The food for models was ready!


Scanning images of rooftops via machine learning 

The major task was to detect rooftops in a given image using machine learning & computer vision models.

Not just this, we also had to determine their type/structure such as Flat-roof, Hip-roof, Shed-roof, or any other. Hence, this became an instance segmentation problem.

We tried out a number of models such as Mask R-CNN, YOLACT (You Only Look At CoefficienTs), Dectectron2, and more. After training on different batches of annotations as they were delivered, we kept seeing improvement in results. Eventually, the best performing model was selected to go ahead with other tasks.




Zooming in on your rooftops 

Now that we had the bounding boxes and mask contours of various rooftops, trapped properly in a data frame, we were ready to start the analysis of individual rooftops. After extracting and zooming into masks of each detected roof, we needed the following attributes:

  • Obstacle Detection
  • Area of the roof (excluding obstacles)
  • The material of the roof
  • Detecting faces of Hip/Shed roof
  • The orientation of individual slopes


Calculating “Area Available” for panels

For the calculation of a rooftop’s effective area, the area occupied by obstacles has to be subtracted from the whole. So that gives rise to the task of identifying obstacles.

Due to the lack of labeled data for obstacle detection, our genius team shifted their thought process towards an unsupervised approach of edge detection and creating contours. By setting a threshold on contour colors, obstacles were distinguished from plain area to a great extent.

An effective area was therefore mathematically calculated as the difference between total area and obstacle area in terms of pixels, which was then converted into meters squared.


Roof Materials / Source:


Quality of the roof

Because solar panels are installed on your home’s rooftop, it is important to understand how different roof materials may influence this process.

Generally, they range from concrete, metal, roof tiles, eternit to composite shingles.

This task also required a labeled dataset, so I decided to jump in to find a solution where we could skip annotations per se. Using Open Street Maps, we created a small but fruitful dataset labeled with roofs and their materials. A deep learning-based Image Classification model was then created which identifies the material of the roof and gives the probability scores for each class.


Which way do solar panels face?




Orientation, or the direction your roof faces, may have a large impact on how productive roof-mounted solar panels will be. Your system will generate the most energy when it gets as many hours of light exposure per day as possible. In most places, the ideal power generation angle is 30–40 degrees.




The task of identifying many faces of a hip roof was a challenging one. After multiple attempts with different approaches, the task team managed to create an appreciable mathematical model that could identify the facets as well as the angles they’re inclined on, using some constructive utility functions. The output was the orientation of different roof facets.


Conclusion: Putting it all together

The outputs of all the tasks were captured systematically in a data frame. Keeping in mind that we computed various attributes based on pixel values, we converted them back to geographic coordinates at the end. This allowed us to project the data on satellite images of a particular CRS (Coordinate Reference System).

After merging everything into an automated pipeline and many rounds of reviews, evaluation, fixing bugs, and testing — our software was ready to be delivered.

Solar AI is extremely happy with the final deliverables, and this is something that makes the experience even more worthwhile. As CEO Bolong Chew puts its:

“This work went beyond our wildest expectations and we’re extremely happy. We set the bar really high and the team delivered. It was an amazing experience.”

Demo Day Insights | Accelerating the Clean Energy Transition | World Energy Council

Demo Day Insights | Accelerating the Clean Energy Transition | World Energy Council

By Rosana de Oliveira Gomes

Two Omdena teams with a total of 50 AI experts and data scientists from 25 countries collaborated with the World Energy Council and the Nigerian NGO RA365 in carrying out data-driven analyses and providing AI solutions to address the Global Transition to Clean Energy.

At a recent Omdena Demo Day, team members Amardeep Singh, Julia Wabant, and Simon Mackenzie shared the results and insights gained from these two projects.


The Topic: Energy Transition

One of the Sustainable Development Goals adopted by all United Nations Member States in 2015 aims to ensure access to affordable, reliable, sustainable, and modern clean energy for all by 2030.

Transitioning into a society with cleaner energy is crucial for fighting climate change. Different parts of the world are currently facing different stages of the energy transition. This can be noted both on the implementation of solutions in specific regions as well as in the cultural perception of such transition by societies. Both topics are addressed in the following two Omdena use cases.


1. Use Case: AI for Renewable Energy in Nigeria


Clean Energy 


Nigeria is one of the countries in the world facing the most severe energy challenges. Over half of the country’s population — 100 million people — lack access to electricity. Some of the problems faced by Nigerians include precarious electricity systems, unstable electricity supply, and electricity available only in certain locations.

An alternative to these problems is investing in local and renewable power solutions. Renewable Africa RA365 is an NGO with the mission to end energy poverty in Nigeria by leveraging innovative clean energy solutions and focusing on providing solar energy to vulnerable populations. In this project, the Omdena team partnered up with RA365 with the goal of identifying communities where solar panels would add the most value.

The first task in this challenge was to define what these areas should be: groups of about 4000 people living within a radius of about 500 m, and that are located more than 15 km away from a power grid. Regions close to schools, healthcare centers, and water locations were considered to have a higher ranking of priority, as they can benefit even more from renewable energy implementation.

One of the biggest challenges in the project was the lack of data for population density, making it hard to identify where people need assistance. In order to find out how the population is distributed in Nigeria and determine who is without access to electricity, the team compared nighttime satellite imagery from NASA Black Marble VIIRS against the geographic location of the population using the Demographic and Health Surveys (DHS) program, ground surveys from WorldPop, and the GRID3 dataset. Also, for identifying the national grid location and, therefore, find regions where people live in relation to existing power lines, the team applied Machine Learning techniques on satellite images from the HV grid from Development Seed/World Bank.


Clean Energy

Combined two satellite data information on average over a large number of nights and seasons.


Clean Energy


Finally, the team finally worked on finding, among all these towns without electricity supply, which ones would be suitable for the criteria established for the implementation of a local solar energy system. This was done by clustering 4000 people in a 500 m radius using the DbScan clustering technique, leading to the identification of over a thousand high-potential regions.


Clean Energy


Clusters of towns with populations between 4–15 thousand people which are suitable for potential off-grid solar navigation in the North of Nigeria.

The Omdena’s team deliverable for this project: A prototype interactive map of the whole of Nigeria identifying the regions with a high demand for electricity and a high potential for solar.

The next steps for this project include a detailed survey for the top target areas in order to identify which locations are most suitable both in terms of infrastructure and cost for implementation of solar systems.

A detailed description of this project and its documentation are available in other Omdena publications. See more about the background of this project in this Omdena article.


The Impact

The initiative taken by Omdena and Renewable Africa RA365 has the potential of enabling data-driven investments and policy-making that can change the lives of many people in Nigeria and other African countries.

The data and prototype of this project have been shared with the Lagos State Government agency for solar systems, which is now willing to start the process of mass production already in 2020.

“In order to get this job done, it is not all about providing solutions to these people. We want to make sure that the solutions get to the right people at the right places, and Omdena has really helped us to achieve that.”

Joseph Itopa, Machine Learning Engineer at Renewable Africa RA365


2. Use Case: Sentiment Analysis on Energy Transition

The transition away from dependency on CO2 to a more sustainable society dominates the news headlines worldwide, exposing conflicting opinions and political measures driving towards a future with cleaner energy sources. Understanding the clean energy transition at a human-level is crucial to the effectiveness of whatever steps are taken in the direction of a carbon-free society.

Commissioned by the World Energy Council, the world’s leading member-based global energy network, Omdena explored applications of AI in understanding how people in different regions of the world perceive the energy transition and their role in it.

Using natural language processing (NLP) techniques, the team created tools to collect, scrape, and analyze text about the clean energy transition found on different social media sources (Twitter, YouTube, Facebook, Reddit, and famous newspapers). This text data was analyzed using varying methods, such as sentiment analysis, topic modeling, and clustering to reveal the challenges, reactions, and attitudes of citizens around the world.


Sentiment Analysis Reddit

Topic “Energy transition” for the USA on Reddit.


Visualizations of the results allow for comparisons of sentiments across nations and societies. The analysis was first focused on English speaking countries, as this provides a common basis for comparing text. For this, the countries representative of different continents and development backgrounds were: USA (America), UK (Europe), Nigeria (Africa), and India (Asia).


Renewable Energy

Data Analysis of Twitter data.


The word cloud representation of the results shows that among the 4 countries investigated, only Nigeria has prominent tweets about “electricity supply”. Similarly, “gas prices” are specific to the USA. However, “renewable energy” is present in all 4 countries.

A part of the analysis was also expanded to other countries and languages, gathering and analyzing tweets related to complaints about “renewable energy cost” in more than 20 countries. The results revealed how local conditions and culture can differ significantly from different places. For example, “technology” was the most relevant concern in the complaint tweets in Brazil and France, whereas in Nigeria these tweets were focused solely on “policy”.


Energy Transition

Complaints about Energy Transition


Other short and detailed discussions about this project can be found in Omdena publications.


The Impact

Though broad conclusions cannot be drawn from these isolated collections of data, the results point to models and data sets that are promising for further development. The analysis carried out by the Omdena team allowed for a better understanding of how natural language processing techniques can be used to capture the opinions and concerns of people worldwide about the clean energy transition.

“The Council has been interested in how public sentiment on energy issues might be tracked, or if this were even possible. That is where this project came in — the team at Omdena explored the broad brief and have proven that the conceptual idea is possible.”

Martin Young, Senior Director at the World Energy Council


The demo day recording



Collaborators from this project

We thank our partner organizations, Renewable Africa 365 and the World Energy Council. as well as all Omdena collaborators (listed below) who made the project a success.


Omdenda team members, on the Renewable Energy Nigeria project:

  • Anastasis Stamatis, Greece
  • Daniil Khodosko, Canada
  • Peace Bakare, Nigeria
  • John Wu, Australia
  • Siddharth Srivastava, India
  • Simon Mackenzie, UK
  • Hoa Nguyen, Vietnam
  • Takashi Daido, Japan
  • Jessica Alecci, Netherlands/Italy
  • Jack David, UK
  • Shubham Bindal, India
  • Deborah David, France
  • Qi Han, Singapore
  • Stefan Hrouda-Rasmussen, Denmark
  • Varun G P, India
  • Ifeoma Okoh (Ify), Nigeria
  • Suraiya Khan, Canada
  • Ivan Tzompov, Bulgaria
  • Henrique Mendonca, Switzerland
  • Himadri Mishra, India
  • Sai Praveen, India
  • Jaikanth J, India
  • Krithiga Ramadass, India


Omdena team members, on the Energy Transition Social Sentiment project:

  • Syed Hassan, UAE
  • Julia Jakubczak, Poland
  • Marek Cichy, Poland
  • Krithiga Ramadass, India
  • Abhishek Deshpande, India
  • Julia Wabant, France
  • Simon Mackenzie, UK
  • Alejandro Bautista Ramos, Mexico
  • Irune Lansorena Sanchez, Spain
  • Vishal Ramesh, India
  • Elizabeth Tishenko, Poland
  • Shashank Agrawal, India
  • Ilias Papadopoulos, Greece
  • Aqueel Jivan, USA
  • Nicholas Musau, Kenya
  • Matteo Bustreo, Italy
  • Mahzad Khoshlessan, USA
  • Yamuna Dulanjani, Sri Lanka
  • Fiona, USA
  • Murindanyi Sudi, Rwanda
  • Raghhuveer Jaikanth, India
  • Abhishek Gupta, USA
  • Aboli Marathe, India
  • Momodou B Jallow, China
  • Jordi Frank, USA
  • Amardeep Singh, Canada
  • Julie Maina, Kenya

More About Omdena

Omdena is an innovation platform for building AI solutions to real-world problems through the power of bottom-up collaboration.

Geographical Data Science to Identify the Most Impactful Areas for Solar Installation in Africa

Geographical Data Science to Identify the Most Impactful Areas for Solar Installation in Africa

Data-driven decision making and signal processing with Google Earth Engine to meet the electricity and water demand in Nigeria.

The Nigerian NGO Renewable Africa #RA365 has the mission to install off-grid solar containers to mitigate the lack of electricity access in the country, where only half of the population of 198 million has stable access to the power supply. We came up with the solution to by using Solar Data Science concept.


The demand – A known Problem

The Demographic and Health Surveys (DHS) provide a large amount of data on African and other developing countries.


Nigerian Electricity Supply 2015

Exploring DHS data on Nigerian Electricity Demand in 2015: Github


This dataset has been used by several researchers and plots similar to the above can be found throughout the internet and literature.

However, the dataset in Nigeria is based on a 2015 survey of about only 1000 households per state, without specifying their precise geographic location within each state. Nevertheless, it shows the critical state of energy access in Nigeria. For example, from the 1194 sampled households in Sokoto state, only 20% (239) had access to electricity in 2015.


Our approach — Nighttime images

We quickly came up with the idea of comparing nighttime satellite imagery against the geographic location of the population.


Night sky image seen through Google Earth Engine

Night sky image in Google Earth Engine


Although the nightlights seem quite straightforward to use, we still needed to find where all the Nigerian houses are located, and then check if they are lit up at night or not (demand).

We initially thought of using a UNet-like model to detect or segment the house roofs from the sky. This has been done already in several machine learning competitions, however, we came across the population dataset from WorldPop, which is also available in Google Earth Engine and uses ground surveys and machine learning to fill the gaps.

GRID3 is another dataset from the same group, which has been validated during vaccination campaigns and provides much higher resolution and precision.

With both datasets in hand, the math seems easy: demand = population and no lights.

// GRID3 population data
var img_pop3 = ee.ImageCollection('users/henrique/GRID3_NGA_PopEst_v1_1_mean_float')
// Nigerian nightlights (1Y median)
var nighttime = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
                  .filter('2018–09–01', '2019–09–30'))
// Demand layer
var demand = img_pop3.gte(pop_threshold) // threshold population
                     .multiply(nighttime.lte(light_threshold)) // population without lights

Here is the code snippet link.


Some challenges to overcome

However, we first have to take into consideration the noise present in each one of the datasets. And secondly, find the optimal places for Installation of the Solar containers by using Geographical Data Science, within the immense sea of electricity demand in Nigeria, Africa.

We also used a few sample villages (where the electricity supply was known) to calibrate the thresholds of minimal population density and minimal light levels to consider into the algorithm.


Omuo, Ekitn region satellite image

The region around Omuo, Ekiti


Gaussian Convolutional Filter for nighttime lights over the region of Omuo, Ekiti

Overlay with both NOAA datasets VIIRS (blue) and DMSP-OLS (orange) nighttime lights, smoothed by a Gaussian convolutional filter


Overlay data using GRID3 population

Overlay with GRID3 population data (green)


Building the location heatmap

A large part of the container installation cost is due to the wiring and distribution of the electricity. This cost has a nonlinear relationship to the distance between the panel and the house to be supplied with energy, in the way that it is much cheaper to supply to nearby houses.

For example, a house 200m away from the energy source should cost more than 2x the cost of one at 100m.

We assume the optimal solar panel location in relation to a household will approximately follow a Gaussian distribution due to the wiring cost. Therefore both noisy nightlights and the electricity demand itself can be smoothed out by applying Gaussian convolutional filters in order to find the best spots for the solar panel installation.


heatmap of Omuo, Ekiti

Demand heatmap


Finally, we tried several image segmentation techniques to capture the clusters of demand, however, the best technique in GEE turned out to be the very simple “connected Components algorithm”.

// GMeans Segmentation
var seg = ee.Algorithms.Image.Segmentation.GMeans(, 3, 50, 10);
Map.addLayer(seg.randomVisualizer(), {opacity:0.5}, 'GMeans Segmentation');
// SNIC Segmentation
var snic = ee.Algorithms.Image.Segmentation.SNIC(, 30, 0, 8, 300);
Map.addLayer(snic.randomVisualizer(), {opacity:0.5}, 'SNIC Segmentation');

// Uniquely label the patches and visualize.
var patchid =
                    .connectedComponents(, 256);
Map.addLayer(patchid.randomVisualizer(), {opacity:0.5}, 'Connected Patches');


Here is the code snippet link for GEE Algorithms for Image Segmentation



Additionally, we can sum the population density of each area to estimate the total population on each cluster.

// Make a suitable image for `reduceConnectedComponents()`
// by adding a label band to the `img_pop3` image.
img_pop3 = img_pop3.addBands('labels'));

// Calculate the total population in demand area
// defined by the previously added "labels" band
// and reproject to original scale
var patchPop = img_pop3.reduceConnectedComponents({
  reducer: ee.Reducer.sum(),
  labelBand: 'labels',
Here is the code snippet link.

GEE allows you to export the raster as a TIF, which can then be worked on GeoPandas to find their contour and centroids and link it back to google maps for further exploration.


Locations marked in blue landmarks for population greater than 4000

Interactive map using Folium and leaflet.js on Jupyter (all potential locations with a population above 4000)




We showed how to combine satellite imagery and population data to create an interactive map and a list of the top Nigerian regions with high demand for electricity by the usage of Solar containers Installation, via Geographical Data Science.

The NGO Renewable Africa will use those tools to survey and validate the locations before installing the solar panels. This should have a real impact on the lives of thousands of people in need. Additionally, this report can also be used to show where the demand lies and help to pressure the local government into action.

We also hope that the initiative is followed by the neighboring and other developing countries, as all the methodology and code used here can be easily transferred to other locations.


The Code

Source code for both GEE and the Colab notebook is available here.



More about Omdena

Omdena is an innovation platform for building AI solutions to real-world problems through the power of bottom-up collaboration.


Increasing Solar Adoption in the Developing World through Machine Learning and Image Segmentation

Increasing Solar Adoption in the Developing World through Machine Learning and Image Segmentation


The problem

How to Increase Solar Adoption in the developing world through Image Segmentation? Applied in India.


The solution

Step 1: Identification of the Algorithm: Image Segmentation

We initially started with the goal of increasing Solar Adoption using Image Segmentation algorithms from computer vision. The goal was to segment the image into roofs and non-roofs by identifying the edges of the roofs. Our first attempt was to use the Watershed image segmentation algorithm. The Watershed algorithm is especially useful when extracting touching or overlapping objects are in the images. The algorithm is very fast and computation inexpensive. In our case, the average computing time for one image was 0.08 sec.

Below are the results from the Watershed algorithm.

Images of rooftops in Delhi, India

Original image(left). The output from the Watershed model(right)


As you can see the output was not very good. Next, we implemented Canny Edge Detection. Like Watershed, this algorithm is also widely used in computer vision and tries to extract useful structural information from different visual objects. In the traditional Canny edge detection algorithm, there are two fixed global threshold values to filter out the false edges. However, as the image gets complex, different local areas will need very different threshold values to accurately find the real edges. So there is a technique called auto canny, where the lower and upper bound are automatically set. Below is the Python function for auto canny:



Snippet of the code for Image Segmentation



The average time taken by a Canny edge detector on one image is approx. 0.1 sec, which is very good. And the results were better than the Watershed algorithm, but still, the accuracy is not enough for practical use.

Image of Delhi rooftops for understanding the algorithm

The output from the Canny Edge detection algorithm


Both of the above techniques use Image Segmentation and work without understanding the context and content of the object we are trying to detect (i.e. rooftops). We may get better results when we train an algorithm with the objects (i.e. rooftops) looks like. Convolutional Neural Networks are state-of-the-art technology to understand the context and content of an image and are being used here to increase Solar Adoption Awareness using Image Segmentation technique.

As mentioned earlier, we want to segment the image into two parts — a rooftop or not a rooftop. This is a Semantic segmentation problem. Semantic segmentation attempts to partition the image into semantically meaningful parts and to classify each part into one of the predetermined classes.

Explaining what segmentation is using a basic example

Semantic Segmentation (picture taken from


In our case, each pixel of the image needs to be labeled as a part of the rooftop or not.

Differentiating image into two segments, Roof and Non roof part

We want to segment the image into two segments — roof and not roof(left) for a given input image(right).


Step 2: Generating the Training Data

To train a CNN model we need a dataset with rooftops satellite images with Indian buildings and their corresponding masks. There is no public dataset available for Indian buildings’ rooftops images with masks. So, we had to create our own dataset. A team of students tagged the images and created masked images (as below).

And here are the final outputs after masking.


Roof top satellite images converted into image segmented photo


Although the U-Net model is known to work with fewer images for data but to begin with, we had only like 20 images in our training set which is way below for any model to give results even for our U-Net. One of the most popular techniques to deal with less data is Data Augmentation. Through Data Augmentation we can generate more data images using the ones in our dataset by adding a few basic alterations in the original ones.

For example, in our case, any Rooftop Image when rotate by a few degrees or flipped either horizontally or vertically would act as a new rooftop image, given the rotation or flipping is in an exact manner, for both the roof images and their masks. We used the Keras Image Generator on already tagged images to create more images.

Augmenting Data

Data Augmentation


Step 3: Preprocessing input images

We tried to sharpen these images. We used two different sharpening filters — low/soft sharpening and high/strong sharpening. After sharpening we applied a Bilateral filter for noise reduction produced by sharpening. Below are some lines of Python code for sharpening

Code for Low Sharpening Filter

Low sharpening filter

Code for high sharpening filter

High sharpening filter



And below are the outputs.


Satellite view of buildings


Google Images


Step 4: Training and Validating the model

We generated training data of 445 images. Next, we chose to use U-Net architecture. U-net was initially used for Biomedical image segmentation, but because of the good results it was able to achieve, U-net is being applied in a variety of other tasks. is one of the best network architecture for image segmentation. In our first approach with the U-Net model, we chose to use RMSProp optimizer with a learning rate of 0.0001, Binary cross-entropy with Dice loss (implementation taken from here). We ran our training for 200 epochs and the average(last 5 epochs) training dice coefficient was .6750 and the validation dice coefficient was .7168

Here are the results of our first approach from the Validation set (40 images):

Predicted and Targeted Image

Predicted (left), Target (right)


Predicted (left), Target (right)



As you can see, in the predicted images there are some 3D traces of building structure in the middle and corners of the predicted mask. We have found out that this is due to the Dice loss. Next, we used Adam optimizer with a learning rate 1e-4 and a decay rate of 1e-6 instead of RMSProp. We used IoU loss instead of BCE+Dice loss and binary accuracy metric from Keras. The training was performed for 45 epochs. The Average(last 5 epochs) training accuracy was: 0.862 and the average validation accuracy was: 0.793. Below are some of the predicted masks on the Validation set from the second approach:


And here are the results form the test data:



Test data




Test data



More About Omdena

Omdena is an innovation platform for building AI solutions to real-world problems through the power of bottom-up collaboration.

Rooftop Detection on Low-Resolution Images with Mask R-CNN Model

Rooftop Detection on Low-Resolution Images with Mask R-CNN Model

The problem

The complexity of the task is increased due to the quality of satellite images from India (and most of the developing world). Similar solutions like the Google Sunroof project work only on high-resolution images and are not usable in the majority of the developing world.

Mask R-CNN was built by the Facebook AI research team. The working principle of Mask R-CNN is quite simple. The researchers combined two previously existing models together and played around with the linear algebra. The model can be divided into two parts — a region proposal network (RPN) and a binary mask classifier. Step one is to get a set of bounding boxes that possibly contain an object of relevance. The second stage is to color the boxes.

Our goal of using this model is to segment or separate each roof-top instance in an image.


Example of outputs

Our challenges started with the lack of data as there are no datasets with rooftops.

We used weights from Mask R-CNN network trained over “coco” dataset that was originally trained to recognize 80 classes but did not have a roof, as a starting point for our model. Resnet 101 was used as a backbone architecture. We started with training our model for “heads” layers, i.e. the RPN, classifier and mask heads of the network; because training the entire network would need a lot of data and since it was pre-trained model over many different classes, it would be a good start. Then to see the difference it made in prediction, we moved up to training till stage 4 and 5 of Resnet 101 architecture.

We also tried different variations. Image size was changed from 1024X1024 to 320X320 because our training image size is 300X300 and padding didn’t seem a good idea to increase it up to 1024.


Rooftop detection

Multiple models that we used with changing image size and processing

Results from input images



Original Image (1)



We compared results from another 20 rooftops and our results show that often the model 4 performs best.

We then tried changing the minimum detection confidence threshold, from 0.9 to 0.7. Regions of Interest(ROIs) below this value will be skipped. It was done because for detecting roofs, 0.9 seemed a very high threshold when it can just be reduced enough to predict any region as a rooftop, as roofs aren’t intricate, well-defined and very specific regions; so any region that can be a good candidate for rooftop should be considered. At 0.7 we had a lot more regions but it also presented us with many overlapped regions as roofs whereas, for 0.9 value, we had a few big blobs taking all of the adjacent roofs as one region.


Detection confidence 0.7

Detection confidence 0.7


Mask RCNN Rooftops

Detection confidence 0.9


Other than this, we were trying to train the model by changing the optimizer from Stochastic Gradient Descent(SGD) to Adam optimizer.

Here are the result images for models trained with SGD and Adam optimizer. Training is done with 70% and 90% confidence. Testing is done with 70% and 90% confidence for each of the trained models.


Adam Optimizer Rooftops

Adam Optimizer 0.7 threshold



SDG Rooftops

SGD 0.7 threshold



Adam Optimizer Rooftops

Adam Optimizer threshold 0.7

SDG Rooftops

SGD threshold 0.7

Our Findings

1. Adam optimizer trained models are not able to predict all the instances and they are not able to differentiate between the adjacent roofs as compared to SGD trained models.

2. SGD trained models predict sharper masks than the Adam trained models. This shows SGD is better for our models, and we’ll continue with it.

About SGD variations:

1. Training the model with 70% confidence is increasing the number of masks, as it has been trained to consider low probability roofs too which leads to overlapped masks. Whereas training with 90% is giving cleaner and fewer masks. So, training with 90% seems a better option.

2. Now, to predict masks with 70% confidence or with 90% confidence? 90% is too precise and might remove other options whereas 70% will include them as seen in images 4 and 7. So, after training for more number of images(currently trained over 95 images), we will be able to see which one can be used finally.

As a final step to identify the individual rooftops we did some post-processing. We created regular shapes from the odd colored shaped. The post-processing was done on a dataset of 607 images.


Individual rooftops

Individual rooftops






More about Omdena

Omdena is an innovation platform for building AI solutions to real-world problems through the power of bottom-up collaboration.

Tackling Energy Poverty in Nigeria Through Artificial Intelligence

Tackling Energy Poverty in Nigeria Through Artificial Intelligence

Can AI help to address energy poverty in Nigeria where more than 100m people lack stable access to electricity?


By Laura Clark Murray 


A staggering 1 billion people on Earth live in energy poverty

Without stable access to electricity, families can’t light their homes or cook their food. Hospitals and schools can’t dependably serve their communities. Businesses can’t stay open.

Energy poverty shapes and constrains nearly every aspect of life for those who are trapped in it. As the Global Commission to End Energy Poverty puts it, “we cannot end poverty without ending energy poverty.” In fact, energy poverty is considered to be one of humanity’s greatest challenges of this century.

In Nigeria, Africa’s most populous country, more than half of the 191 million citizens live in energy poverty. And though governments have been talking for years about extending national electricity grids to deliver energy to more people, they’ve made little progress.


With such a vast problem, what can be done?

Rather than focusing on the national electricity grid, Nigerian non-profit Renewable Africa 365, or RA365, is taking a different approach. RA365 is working with local governments to install mini solar power substations, known as renewable energy microgrids. Each microgrid can deliver electricity to serve small communities of 4,000 people. In this way, RA365 aims to address Nigerian energy poverty community-by-community with solar installations.

To be effective, RA365 needs to convince local policymakers of the potential impact of a microgrid in their community. For help they turned to Omdena. Omdena is a global platform where AI experts and data scientists from diverse backgrounds collaborate to build AI-based solutions to real-world problems. You can learn more here about Omdena’s innovative approach to building AI solutions through global collaboration.


Which communities need solar microgrids the most?

Omdena pulled together a global team of AI experts and data scientists. Working collaboratively from remote locations around the globe, the team set about identifying the regions in Nigeria where the energy poverty crisis is most dire and where solar power is likely to be effective. 

To determine which regions don’t have access to electricity, our team looked to satellite imagery for the areas of the country that go completely dark at night. Of those locations, they prioritized communities with large populations that incorporate schools and hospitals. Also the collaborators looked at the distance of those communities from the existing national electricity grid. In reality, if a community is physically far from the existing grid, it’s unlikely to be hooked up anytime soon. In this way, by analyzing the satellite data with population data, the team identified the communities most in crisis.

In any machine learning project, the quality and quantity of relevant data is critical. However, unlike projects done in the lab, the ideal data to solve a real-world problem rarely exists.  In this case, available data on the Nigerian population was incomplete and inaccurate. There wasn’t data on access to the national electricity grid. Furthermore, the satellite data couldn’t be relied upon. Given this, the team had to get creative. You can read how our team addressed these data roadblocks in this article from collaborator Simon Mackenizie. 


What’s the impact?

The team built an AI system that identifies regional clusters in Nigeria where renewable energy microgrids are both most viable and likely to have high impact on the community. In addition, an interactive map acts as an interface to the system.

AI in Nigeria

Heatmap with most suitable spots for solar panel installments

RA365 now has the tools it needs to guide local policymakers towards data-driven decisions about solar power installation. What’s more, they’re sharing the project data with Nigeria Renewable Energy Agency, a major funding source for rural electrification projects across Nigeria. 

With this two-month challenge, the Omdena team delivered one of the first real-world machine learning solutions to be deployed in Nigeria. Importantly, our collaborators from around the globe join the growing community of technologists working to solve Nigeria’s toughest issues with AI.

Ademola Eric Adewumi, Founder of Renewable Africa 365, shares his experience working with the Omdena collaborators here. Says Adewumi, “We want to say that Omdena has changed the face of philanthropy by its support in helping people suffering from electrical energy poverty. With this great humanitarian help, RA365 hopes to make its mission a reality, bringing renewable energy to Africa.”


About Omdena

Building AI through global collaboration

Omdena is a global platform where changemakers build ethical and inclusive AI solutions to real-world problems through collaboration.

Learn more about the power of Collaborative AI.

Stay in touch via our newsletter.

Be notified (a few times a month) about top-notch articles, new real-world projects, and events with our community of changemakers.

Sign up here