Commit 8efcb328 authored by David Maxence's avatar David Maxence
Browse files

chargement data

parent 1018dee2
%% Cell type:code id:smart-nerve tags:
``` python
import numpy as np
import os
import pandas as pd
from scipy.io import wavfile
```
%% Cell type:code id:religious-module tags:
``` python
US8K_audio = os.path.abspath('/home/maxence/Documents/INSA/ASI4/s8/DL/UrbanSound8K/audio/')
US8K_metadata = os.path.abspath('/home/maxence/Documents/INSA/ASI4/s8/DL/UrbanSound8K/metadata/UrbanSound8K.csv')
```
%% Cell type:code id:bizarre-visiting tags:
``` python
metadata = pd.read_csv(US8K_metadata)
```
%% Cell type:code id:biblical-embassy tags:
``` python
metadata
```
%% Output
slice_file_name fsID start end salience fold \
0 100032-3-0-0.wav 100032 0.000000 0.317551 1 5
1 100263-2-0-117.wav 100263 58.500000 62.500000 1 5
2 100263-2-0-121.wav 100263 60.500000 64.500000 1 5
3 100263-2-0-126.wav 100263 63.000000 67.000000 1 5
4 100263-2-0-137.wav 100263 68.500000 72.500000 1 5
... ... ... ... ... ... ...
8727 99812-1-2-0.wav 99812 159.522205 163.522205 2 7
8728 99812-1-3-0.wav 99812 181.142431 183.284976 2 7
8729 99812-1-4-0.wav 99812 242.691902 246.197885 2 7
8730 99812-1-5-0.wav 99812 253.209850 255.741948 2 7
8731 99812-1-6-0.wav 99812 332.289233 334.821332 2 7
classID class
0 3 dog_bark
1 2 children_playing
2 2 children_playing
3 2 children_playing
4 2 children_playing
... ... ...
8727 1 car_horn
8728 1 car_horn
8729 1 car_horn
8730 1 car_horn
8731 1 car_horn
[8732 rows x 8 columns]
%% Cell type:code id:noble-round tags:
``` python
np.unique(metadata['class'])
```
%% Output
array(['air_conditioner', 'car_horn', 'children_playing', 'dog_bark',
'drilling', 'engine_idling', 'gun_shot', 'jackhammer', 'siren',
'street_music'], dtype=object)
%% Cell type:markdown id:identical-elephant tags:
Nous avons donc 10 classes dans le dataset qui sont : air_conditioner', 'car_horn', 'children_playing', 'dog_bark','drilling', 'engine_idling', 'gun_shot', 'jackhammer', 'siren','street_music'
%% Cell type:code id:ignored-thursday tags:
``` python
metadata['class'].value_counts()
```
%% Output
dog_bark 1000
air_conditioner 1000
street_music 1000
children_playing 1000
jackhammer 1000
drilling 1000
engine_idling 1000
siren 929
car_horn 429
gun_shot 374
Name: class, dtype: int64
%% Cell type:code id:solved-alaska tags:
``` python
```