Clouds Removal
[Random Submission] Cloud Removal
A Random Submission notebook for Cloud Removal Puzzle of BlitzX.
Random Submission for Clouds Removal
Note : Create a copy of the notebook and use the copy for submission. Go to File > Save a Copy in Drive to create a new copy
Setting up Environment¶
Downloading Dataset¶
So we will first need to download the python library by AIcrowd that will allow us to download the dataset by just inputting the API key.
!pip install aicrowd-cli
%load_ext aicrowd.magic
%aicrowd login
# Downloading the Dataset
!rm -rf data
!mkdir data
!aicrowd dataset download -c clouds-removal "*Partial*" -o data
# Unzipping the dataset
!unzip data/train.zip -d data/train >> /dev/null
!unzip data/test.zip -d data/test >> /dev/null
Importing Libraries¶
# Importing Libraries
import os
from natsort import natsorted
from glob import glob
import cv2
from tqdm.notebook import tqdm
Generate Random Submission¶
In this section we will be generating a random submission. We will read all of the files from the tesing directroy and save the same video in clear
directory for submsision.
# Creating a clear directory
!rm -rf clear
!mkdir clear
# Random submission function
def random_submission(data_directory):
# List of all videos
video_files = natsorted(glob(data_directory))
# Groung through each video
for idx, img_file in enumerate(tqdm(video_files)):
# Saving a new video file
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(os.path.join("clear", f"clear_{idx}.mp4"), fourcc, 24.0, (512,512))
# Reading the video
img_video = cv2.VideoCapture(img_file)
# Going through each frame
ret=True
while ret:
# Reading the frame
ret, frame = img_video.read()
# ANY PREPROCESSIG FUNCTION
# Adding the frame to video writer
out.write(frame)
# Running the function
random_submission("data/test/cloud*")
Submitting Results 📄¶
Uploading the Results¶
!aicrowd notebook submit -c clouds-removal -a clear --no-verify
Don't be shy to ask question related to any errors you are getting or doubts in any part of this notebook in discussion forum or in AIcrowd Discord sever, AIcrew will be happy to help you :)
Also, wanna give us your valuable feedback for next blitz or wanna work with us creating blitz challanges ? Let us know!
Content
Comments
You must login before you can post a comment.