Exploring Hub:>Activeloop A tale of Uploading Pokemon Data

Image for post
Image for post
Pokemon types by Google Images

What is Hub ?

Image for post
Image for post
image from Activeloop Hub
Image for post
Image for post
image from saggle
Image for post
Image for post
image by Activeloop
pip install hub

How I upload my Pokemons to hub:

Before two sections are for the basic knowledge ,from here begins the tale.I know about the activeloop and hub in the hacktoberfest while searching for the repositories to contribute.When found I think about how to use it and contribute to this awesome community,after some days I joined the activeloop/hub slack community workspace which is a good place to start your contribution in machine learning.

Image for post
Image for post
image by wikipedia

Importing all libraries and preparing Schemas for the dataset:

Now I imported the required libraries for the reading and formatting data.The libraries are numpy,opencv,hub.

import numpy as np
import os
from cv2 import imread
from hub import schema,Dataset
from hub.schema import ClassLabel,Image
all_labels =    [‘bug’,’dark’,’dragon’,’electric’,’fairy’,’fighting’,’fire’,’flying’,’ghost’,’grass’,’ground’,’ice’,’normal’,’poison’,’psychic’,’rock’,’steel’,’water’]
classlabel = ClassLabel(names=[‘bug’,’dark’,’dragon’,’electric’,’fairy’,’fighting’,’fire’,’flying’,’ghost’,’grass’,’ground’,’ice’,’normal’,’poison’,’psychic’,’rock’,’steel’,’water’])
schema = {

“labels”: classlabel,

Loading Images to dictionary and upload to the hub:

I wrote this following code to load the images to the memory,take a look:

store = []
store_label = []
store_name = []
root = ‘/home/debo/uploadhub/pokemon-images-dataset-by-type’for i in sorted(os.listdir(root)):
for j in sorted(os.listdir(root+’/’+i)):
image = imread(root+’/’+i+’/’+j)
classlabel = ClassLabel(names=[‘bug’,’dark’,’dragon’,’electric’,’fairy’,’fighting’,’fire’,’flying’,’ghost’,’grass’,’ground’,’ice’,’normal’,’poison’,’psychic’,’rock’,’steel’,’water’])schema = {

“labels”: classlabel,
ds = Dataset(
for i in range(len(store_label)):
ds[‘image’,i] = store[i]
ds[‘labels’,i] = classlabel.str2int(store_label[i])
print(“uploaded succesfully”)ds.commit()

Some Words….

Now the dataset you can check https://app.activeloop.ai/dataset/darkdebo/pokemon_data.

Image for post
Image for post
image by Author

cs student pre final year,Open source contributor,AI && ML,DS & ALGO

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store