how to put kaggle dataset Toronto emotional speech set (TESS) in google colab Toronto…
- User
how to put kaggle dataset Toronto emotional speech set (TESS) in google colab Toronto emotional speech set (TESS)
- Assistant
how to put kaggle dataset Toronto emotional speech set (TESS) in google colab Toronto emotional speech set (TESS)
To use the Toronto Emotional Speech Set (TESS) dataset from Kaggle in Google Colab, follow the step-by-step guide below. This process involves setting up Kaggle's API in Colab, downloading the dataset, and extracting it for use in your projects.
Create a Kaggle Account: If you haven't already, sign up for a Kaggle account at Kaggle Sign Up.
Generate Kaggle API Token:
kaggle.json containing your API credentials.[image: Kaggle API Token] open
Open a New Colab Notebook: Go to Google Colab and create a new notebook.
Upload kaggle.json to Colab:
Run the following code to upload your kaggle.json file:
from google.colab import files
files.upload()
kaggle.json file you downloaded earlier.[image: Upload kaggle.json] open
Configure Kaggle Credentials in Colab:
Execute the following commands to set up Kaggle in your Colab environment:
# Create a .kaggle directory
!mkdir -p ~/.kaggle
# Move the kaggle.json file to the .kaggle directory
!cp kaggle.json ~/.kaggle/
# Change the permissions of kaggle.json to be read-only
!chmod 600 ~/.kaggle/kaggle.json
# Install Kaggle Package if not already installed
!pip install kaggle
Note: Running
!pip install kaggleensures that the Kaggle API is available in your environment. It’s usually pre-installed in Colab, but this guarantees the latest version.
Before downloading, you need the exact identifier of the TESS dataset on Kaggle. Assuming the TESS dataset is available on Kaggle, here’s how to find and download it:
Search for TESS Dataset on Kaggle:
Obtain the Dataset Identifier:
username/dataset-name.https://www.kaggle.com/datasets/user/tess, then the identifier is user/tess.If TESS is not available on Kaggle: If you cannot find TESS on Kaggle, you might need to download it from its official website or another repository. In such cases, adjust the download method accordingly (covered later).
Assuming the dataset identifier is user/tess, use the following command to download it:
# Replace 'user/tess' with the actual dataset identifier
!kaggle datasets download -d user/tess
Example:
!kaggle datasets download -d gallantbrainstoll/toronto-emotional-speech-set-tess
Tip: If you're unsure about the dataset identifier, navigate to the dataset's Kaggle page and copy the path from the URL.
After downloading, the dataset is typically in a compressed .zip format. Use the following commands to unzip and inspect the dataset:
import zipfile
import os
# Replace 'tess.zip' with the actual filename if different
zip_file = 'tess.zip'
# Unzip the dataset into a folder named 'tess_data'
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
zip_ref.extractall('tess_data')
# Verify the contents
for root, dirs, files in os.walk('tess_data'):
for name in files:
print(os.path.join(root, name))
Note: Replace
'tess.zip'with the actual name of the downloaded zip file if it's different.
Now that the dataset is extracted, you can proceed to use it in your machine learning or data analysis projects. Here's an example of how to load and preview some audio files using librosa and IPython.display:
Install Required Libraries:
!pip install librosa
Load and Play an Audio File:
import librosa
import librosa.display
from IPython.display import Audio
import matplotlib.pyplot as plt
# Path to an example audio file
audio_path = 'tess_data/audio_examples/example.wav' # Update the path accordingly
# Load the audio file
y, sr = librosa.load(audio_path)
# Display the audio waveform
plt.figure(figsize=(14, 5))
librosa.display.waveshow(y, sr=sr)
plt.title('Audio Waveform')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.show()
# Play the audio
Audio(audio_path)
Ensure: Replace
'tess_data/audio_examples/example.wav'with the actual path to an audio file in your dataset.
If the TESS dataset isn't available on Kaggle, you can download it directly from its official source and upload it to Colab. Here's how:
Download TESS Dataset:
Upload to Google Drive (Optional but Recommended):
Upload the dataset to your Google Drive for easier access.
Mount Google Drive in Colab:
from google.colab import drive
drive.mount('/content/drive')
Copy Dataset from Google Drive to Colab Environment:
# Replace the path with the actual path to your dataset in Google Drive
!cp /content/drive/MyDrive/path_to_tess.zip .
# Unzip the dataset
!unzip tess.zip -d tess_data
Proceed with Data Processing:
librosa to work with audio files.Storage Limitations: Google Colab has limited storage. Ensure that the dataset size doesn't exceed Colab's capacity. If necessary, use Google Drive to store large datasets and access them from Colab.
Runtime Persistence: Remember that Colab's runtime is temporary. If you restart the runtime, you'll need to re-establish connections or re-download data unless it's stored in Google Drive.
Privacy and Security: Keep your kaggle.json file secure. Avoid sharing notebooks that contain your API credentials.
By following these steps, you should be able to successfully integrate and utilize the Toronto Emotional Speech Set (TESS) dataset within your Google Colab environment for your projects.
Not yet included in a published release.