<jupyter_start><jupyter_text>Installing Hub<jupyter_code>!pip3 install hub --quiet

# Run below cells and restart the runtime
# if you are running it in colab
# import os
# os.kill(os.getpid(), 9)<jupyter_output><empty_output><jupyter_text>Download raw dataset<jupyter_code>from IPython.display import clear_output
import os
from glob import glob
from PIL import UnidentifiedImageError
from hub.util.exceptions import SampleCompressionError
!wget https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip
!unzip kagglecatsanddogs_3367a.zip
clear_output()<jupyter_output><empty_output><jupyter_text>Creating dataset on hub **Activeloop API** : https://docs.activeloop.ai/api-basics<jupyter_code>import hub
# Login to ActiveLoop

%env BUGGER_OFF=True
!activeloop login -u username -p password
!activeloop reporting --off
base_path = 'PetImages'
hubname = 'hub://<username>/kaggle-cats-dogs'
ds = hub.dataset(hubname)

class_labels = ['Cat', 'Dog']
with ds:

    ds.create_tensor('images', htype='image', sample_compression='jpg')
    ds.create_tensor('labels', htype='class_label', class_names=class_labels)

    for index, label in enumerate(class_labels):
        files = glob(os.path.join(base_path, label, '*.jpg'))
        for path in files:
            try:
                ds.images.append(hub.read(path))
                ds.labels.append(index)
            except UnidentifiedImageError:
                print('Image Error ->', path)
            except SampleCompressionError:
                print('Compression Issue ->', path)<jupyter_output>Your Hub dataset has been successfully created!
The dataset is private so make sure you are logged in!
This dataset can be visualized at https://app.activeloop.ai/activeloop/kaggle-cats-dogs.
Image Error -> PetImages/Cat/666.jpg
Image Error -> PetImages/Dog/11702.jpg
Compression Issue -> PetImages/Dog/11285.jpg
Compression Issue -> PetImages/Dog/7514.jpg
{'fraction_non_alphanumeric': 0.1082184788157223, 'fraction_numerical': 0.02450229709035222, 'mean_word_length': 4.254691689008043, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '648273', 'license': 'Apache-2.0', 'n_tokens_mistral': 677, 'n_tokens_neox': 630, 'n_words': 147, 'path': 'Cats&Dogs/KaggleCats&Dogs.ipynb', 'repo_name': 'SaiNikhileshReddy/examples', 'size': '1959'}