Part I. Model Building & Traning Pipeline

Step 1:Load the necessary Libraries

Let’s first import all the necessary libraries which are required for both clip model & Catboost model.

Python3




# Importing Libraries
 
import os, cv2, gc, itertools, pickle
from PIL import Image
import numpy as np
import pandas as pd
 
import albumentations as A
import matplotlib.pyplot as plt
 
import torch, timm, clip
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from tqdm.autonotebook import tqdm
from transformers import DistilBertModel, DistilBertConfig, DistilBertTokenizer
 
from sklearn.metrics import r2_score, mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from catboost import CatBoostRegressor


Step 2: Load the dataset

Python3




# Importing skycam .csv Data: The label i.e. text feature is generated from the numeric cloud coverage.
folder = 'SkyCam'
df = pd.read_csv(folder+"/cloud_data_cleaned1.csv")
df = df[['image_name', 'label', 'opaque_clouds']]
df.columns = ['image', 'caption', 'cloudcover']
print(df.head())


Output:

                    image                                            caption  \
0  20160101075000.raw.jpg  Image has No Cloud Coverage. Image has 7% of o...   
1  20160101080000.raw.jpg  Image has No Cloud Coverage. Image has 7% of o...   
2  20160101081000.raw.jpg  Image has No Cloud Coverage. Image has 7% of o...   
3  20160101082000.raw.jpg  Image has No Cloud Coverage. Image has 7% of o...   
4  20160101083000.raw.jpg  Image has No Cloud Coverage. Image has 7% of o...   
   cloudcover  
0           7  
1           7  
2           7  
3           7  
4           7  
  • The Data consists of skycam image name, caption which I have generated while building this csv.
  • Caption is generated from the third feature shown above i.e. cloudcover which is in percentage.
  • Our Aim is to calculate cloud cover given a skycam image.
  • This is a typical Classical Machine Learning Regression Problem with integration of Computer Vision.

Let’s check an image

Python3




img_folder =os.path.join(folder, 'Extracted Images', 'Extracted Images')
#img_filename = os.listdir(img_folder)[0]
img_path = os.path.join(img_folder, df['image'].iloc[777])
 
img = Image.open(img_path)
plt.imshow(img)
plt.show()


Output:

Skycam Image

Cloud Coverage Prediction using Skycam Images

Cloud coverage prediction is critical in weather forecasting and a variety of applications such as solar energy generation, aviation, and climate monitoring. Accurate forecasts help decision-makers and sectors plan for and adapt to changing weather conditions. The advancement of artificial intelligence and computer vision techniques in recent years has created new opportunities for enhancing cloud coverage forecasts.

One promising approach is the use of SkyCam images.

  • In the face of rapidly changing global climate patterns, there is an urgent need for innovative tools and technologies to better understand and predict weather-related phenomena.
  • One crucial aspect of climate analysis is the assessment of cloud coverage, which plays a pivotal role in influencing weather conditions and climate trends.
  • Experts may not always be available to monitor climatic shifts. Therefore, developing an automated weather monitoring system is crucial for various applications, including agriculture and disaster management.

The purpose of this research is to estimate the opaque Cloud Coverage from a Skycam Image using AI/ML methodologies.

Cloud Coverage Prediction using Skycam Images

Table of Content

  • Cloud Coverage Prediction using SkyCam Images
  • Implementations Cloud Coverage Prediction using SkyCam Images
  • Cloud Coverage Prediction Models:
  • Part I. Model Building & Traning Pipeline
  • A. Clip Model Finetuning
  • B. Catboost Regressor Model Building
  • Part II. UI Inference Codes for Deployed Model
  • Results:

Similar Reads

Cloud Coverage Prediction using SkyCam Images

...

Implementations Cloud Coverage Prediction using SkyCam Images

The integration of Computer Vision and Machine Learning, leading to regression and classification use cases, has been one of the major trending research areas. The purpose of this research is to estimate cloud coverage using SkyCam images and Computer Vision techniques. We hope to develop a system that can deliver real-time or short-term forecasts of cloud cover percentages by training predictive algorithms. This predictive skill has the potential to improve existing weather forecasting models and decision-making in industries such as energy production and transportation....

Cloud Coverage Prediction Models:

System Architecture for the project:...

Part I. Model Building & Traning Pipeline

1. CLIP Model & its working:...

A. Clip Model Finetuning

Step 1:Load the necessary Libraries...

B. Catboost Regressor Model Building

...

Part II. UI Inference Codes for Deployed Model

...

Results:

...