Loading

ORIENT Rubiks Cube

Getting Started Notebook for Orient Rubik's Cube

A getting started notebook with random submission for the challenge.

ashivani

Getting Started Notebook for Orient Rubik's Cube Challenge

This notebook creates a random prediction for the test data and takes you through the workflow of how to download data and submit directly via the notebook.

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

Download the files 💾

Downlad AIcrowd CLI

We will first install aicrowd-cli which will help you download and later make submission directly via the notebook.

In [ ]:
!pip install aicrowd-cli
%load_ext aicrowd.magic
Requirement already satisfied: aicrowd-cli in /usr/local/lib/python3.7/dist-packages (0.1.10)
Requirement already satisfied: tqdm<5,>=4.56.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (4.62.3)
Requirement already satisfied: toml<1,>=0.10.2 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (0.10.2)
Requirement already satisfied: click<8,>=7.1.2 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (7.1.2)
Requirement already satisfied: pyzmq==22.1.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (22.1.0)
Requirement already satisfied: requests<3,>=2.25.1 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (2.26.0)
Requirement already satisfied: GitPython==3.1.18 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (3.1.18)
Requirement already satisfied: requests-toolbelt<1,>=0.9.1 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (0.9.1)
Requirement already satisfied: rich<11,>=10.0.0 in /usr/local/lib/python3.7/dist-packages (from aicrowd-cli) (10.13.0)
Requirement already satisfied: typing-extensions>=3.7.4.0 in /usr/local/lib/python3.7/dist-packages (from GitPython==3.1.18->aicrowd-cli) (3.10.0.2)
Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.7/dist-packages (from GitPython==3.1.18->aicrowd-cli) (4.0.9)
Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.7/dist-packages (from gitdb<5,>=4.0.1->GitPython==3.1.18->aicrowd-cli) (5.0.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2.10)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2.0.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (1.24.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.25.1->aicrowd-cli) (2021.10.8)
Requirement already satisfied: colorama<0.5.0,>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (0.4.4)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (0.9.1)
Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /usr/local/lib/python3.7/dist-packages (from rich<11,>=10.0.0->aicrowd-cli) (2.6.1)

Login to AIcrowd ㊗

In [ ]:
%aicrowd login
Please login here: https://api.aicrowd.com/auth/ydFscNeITTiKiLSNOkOdbP5StTzXRJzsqgEvNhXU5Ow
API Key valid
Saved API Key successfully!

Download Dataset and Unzip

We will create a folder name data and download and unzip the files there.

In [ ]:
# Downloading the Dataset
!rm -rf data
!mkdir data
%aicrowd ds dl -c orient-rubiks-cube -o data
Error in downloading dataset https://datasets.aicrowd.com/aicrowd-practice-challenges/public/orientme/v0.2/sample_submission.csv
Error in downloading dataset https://datasets.aicrowd.com/aicrowd-practice-challenges/public/orientme/v0.2/training.tar.gz
In [ ]:
!unzip data/train_images -d data/train_images > /dev/null
!unzip data/test_images -d data/test_images > /dev/null

Generating Random Submission ⚙️

Making a submission with random predictions. We will randomly select a number from 0 to 360 for each image in test set.

In [ ]:
# Imporitng libraries
import pandas as pd
import os
import random

random.seed(42)
In [ ]:
# Making a list containing all unique classes in the training set

testing_img_ids = [f"00{i}.jpg" if len(str(i)) <= 4  else f"0{i}.jpg" for i in range(5000, 10001)]

# Creating a list containing random classes of size equal of no. of samples in test data
random_test_predictions = [random.randint(0, 360) for i in range(len(testing_img_ids))]
In [ ]:
# Converting the list to dataframe

predictions_df = pd.DataFrame({"filename" : testing_img_ids, "xRot": random_test_predictions})
predictions_df
Out[ ]:
filename xRot
0 005000.jpg 209
1 005001.jpg 56
2 005002.jpg 61
3 005003.jpg 189
4 005004.jpg 292
... ... ...
4996 009996.jpg 154
4997 009997.jpg 140
4998 009998.jpg 234
4999 009999.jpg 103
5000 010000.jpg 51

5001 rows × 2 columns

In [ ]:
# Saving the dataframe to csv
predictions_df.to_csv("submission.csv", index=False)

Submitting the predictions to AIcrowd

In [ ]:
# Submitting the Predictions

!aicrowd submission create -c orient-rubiks-cube -f submission.csv
submission.csv ━━━━━━━━━━━━━━━━━━━━ 100.0%75.1/73.4 KB590.7 kB/s0:00:00
                                                   ╭─────────────────────────╮                                                    
                                                   │ Successfully submitted! │                                                    
                                                   ╰─────────────────────────╯                                                    
                                                         Important links                                                          
┌──────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  This submission │ https://www.aicrowd.com/challenges/aicrowd-blitz-may-2020/problems/orientme/submissions/165117              │
│                  │                                                                                                             │
│  All submissions │ https://www.aicrowd.com/challenges/aicrowd-blitz-may-2020/problems/orientme/submissions?my_submissions=true │
│                  │                                                                                                             │
│      Leaderboard │ https://www.aicrowd.com/challenges/aicrowd-blitz-may-2020/problems/orientme/leaderboards                    │
│                  │                                                                                                             │
│ Discussion forum │ https://discourse.aicrowd.com/c/aicrowd-blitz-may-2020                                                      │
│                  │                                                                                                             │
│   Challenge page │ https://www.aicrowd.com/challenges/aicrowd-blitz-may-2020/problems/orientme                                 │
└──────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
{'submission_id': 165117, 'created_at': '2021-11-15T11:27:47.176Z'}
In [ ]:


Comments

You must login before you can post a comment.

Execute