Commit 6a9e3ca9 authored by David Maxence's avatar David Maxence
Browse files

maj de loading et entrainement sans fold ~ 85% sur test(sur6000 data)

parent d0414aa7
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 1,
"id": "israeli-hometown",
"metadata": {},
"outputs": [],
......@@ -16,28 +16,20 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 4,
"id": "waiting-today",
"metadata": {},
"outputs": [],
"source": [
"samplerate, data = wavfile.read('./7061-6-0-0.wav')"
"samplerate, data = wavfile.read('../UrbanSound8K/audio/fold1/7061-6-0-0.wav')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"id": "computational-europe",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:absl:Lingvo does not support eager execution yet. Please disable eager execution with tf.compat.v1.disable_eager_execution() or proceed at your own risk.\n"
]
}
],
"outputs": [],
"source": [
"import leaf_audio.frontend as frontend\n",
"\n",
......@@ -50,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 6,
"id": "disciplinary-brain",
"metadata": {},
"outputs": [
......@@ -60,7 +52,7 @@
"numpy.ndarray"
]
},
"execution_count": 13,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
......@@ -71,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 7,
"id": "compound-diesel",
"metadata": {},
"outputs": [],
......@@ -81,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 8,
"id": "sustained-default",
"metadata": {},
"outputs": [
......@@ -91,7 +83,7 @@
"dtype('float64')"
]
},
"execution_count": 15,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
......@@ -102,10 +94,59 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 9,
"id": "developmental-lounge",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Layer leaf is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because its dtype defaults to floatx.\n",
"\n",
"If you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n",
"\n",
"To change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Layer leaf is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because its dtype defaults to floatx.\n",
"\n",
"If you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n",
"\n",
"To change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Layer mel_filterbanks_1 is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because its dtype defaults to floatx.\n",
"\n",
"If you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n",
"\n",
"To change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Layer mel_filterbanks_1 is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because its dtype defaults to floatx.\n",
"\n",
"If you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n",
"\n",
"To change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n",
"\n"
]
}
],
"source": [
"leaf_representation = leaf(data)\n",
"melfbanks_representation = melfbanks(data)"
......@@ -113,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 10,
"id": "fuzzy-helmet",
"metadata": {},
"outputs": [
......@@ -123,7 +164,7 @@
"tensorflow.python.framework.ops.EagerTensor"
]
},
"execution_count": 19,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
......@@ -134,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 11,
"id": "funny-emperor",
"metadata": {},
"outputs": [],
......@@ -145,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 12,
"id": "raising-stephen",
"metadata": {},
"outputs": [
......@@ -174,7 +215,7 @@
" -11.512925, -11.512925]]], dtype=float32)>>"
]
},
"execution_count": 36,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
......@@ -185,9 +226,123 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "dressed-present",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<tf.Tensor: shape=(99225, 1, 40), dtype=float32, numpy=\n",
"array([[[0.20780897, 0.20780897, 0.20780897, ..., 0.20780897,\n",
" 0.20780897, 0.20780897]],\n",
"\n",
" [[0.20780897, 0.20780897, 0.20780897, ..., 0.20780897,\n",
" 0.20780897, 0.20780897]],\n",
"\n",
" [[0.20780897, 0.20780897, 0.20780897, ..., 0.20780897,\n",
" 0.20780897, 0.20780897]],\n",
"\n",
" ...,\n",
"\n",
" [[0.21767402, 0.2243576 , 0.2243576 , ..., 0.2582096 ,\n",
" 0.26002145, 0.26086974]],\n",
"\n",
" [[0.22921395, 0.23622298, 0.23621511, ..., 0.24876428,\n",
" 0.2451222 , 0.23672509]],\n",
"\n",
" [[0.20780897, 0.20780897, 0.20780897, ..., 0.20780897,\n",
" 0.20780897, 0.20780897]]], dtype=float32)>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"leaf_representation\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "painful-location",
"metadata": {},
"outputs": [],
"source": [
"X = np.stack(leaf_representation.numpy())"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "alike-enhancement",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897,\n",
" 0.20780897, 0.20780897, 0.20780897, 0.20780897, 0.20780897]],\n",
" dtype=float32)"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X[1]\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "terminal-tulsa",
"metadata": {},
"outputs": [],
"source": [
"X.shape\n",
"X_dim = (128,128,1)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "associate-conservative",
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "cannot reshape array of size 3969000 into shape (128,128)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-25-d4a67893f50d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mX_dim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mValueError\u001b[0m: cannot reshape array of size 3969000 into shape (128,128)"
]
}
],
"source": [
"X = X.reshape( X_dim)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "taken-kentucky",
"metadata": {},
"outputs": [],
"source": []
}
......
This diff is collapsed.
model_checkpoint_path: "."
all_model_checkpoint_paths: "."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment