Comments (1)
This fixed it for me. Give me (limited) permission and I can create a PR.
Author: Matt Drees <[email protected]> 2022-06-06 12:21:58
Committer: Matt Drees <[email protected]> 2022-06-06 12:21:58
Parent: 060eb9f9be1d7f7e2d7e103a29a01386723c22fe (Merge pull request #28 from robertlacok/patch-1)
Child: 0000000000000000000000000000000000000000 (Local uncommitted changes, not checked in to index)
Branch: fix_two_phase_predictions_ipynb
Follows:
Precedes:
Fixes for two_phase_predictions.ipynb.
Fixes:
* "audio" -> "audio_spectros" path
* "image_batch" variable not found.
* fit_generator() method deprecated, prefer fit().
* Moved the *.png files so redownload them.
Tested by re-running the notebook from scratch.
------------------ 05_resilience/two_phase_predictions.ipynb ------------------
index dbd3383..fb3243d 100644
@@ -701,7 +701,7 @@
},
"outputs": [],
"source": [
- "data_dir = pathlib.Path(os.getcwd() + '/audio')\n",
+ "data_dir = pathlib.Path(os.getcwd() + '/audio_spectros')\n",
"class_names = ['not_instrument', 'instrument']"
]
},
@@ -897,7 +897,7 @@
},
"outputs": [],
"source": [
- "feature_batch = mobilenet(image_batch)"
+ "feature_batch = mobilenet(val_image)"
]
},
{
@@ -1045,9 +1045,9 @@
},
"outputs": [],
"source": [
- "model.fit_generator(train_data_gen, \n",
- " validation_data=val_data_gen,\n",
- " steps_per_epoch=STEPS_PER_EPOCH, epochs=10)"
+ "model.fit(train_data_gen,\n",
+ " validation_data=val_data_gen,\n",
+ " steps_per_epoch=STEPS_PER_EPOCH, epochs=10)"
]
},
{
@@ -1366,6 +1366,24 @@
"Create directories for each instrument label. We'll use this later when we load our images with Keras's `ImageDataGenerator` class."
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 1000
+ },
+ "colab_type": "code",
+ "id": "IsipOIHWaFQW",
+ "outputId": "76542e83-ec27-4dfd-c3f9-d3402faf99e2"
+ },
+ "outputs": [],
+ "source": [
+ "# Moved them so have to download them again.\n",
+ "!gsutil -m cp -r gs://ml-design-patterns/audio_train_spectro ."
+ ]
+ },
{
"cell_type": "code",
"execution_count": 299,
@@ -1512,7 +1530,7 @@
}
],
"source": [
- "feature_batch = vgg_model(image_batch)\n",
+ "feature_batch = vgg_model(image_instrument_train)\n",
"global_avg_layer = tf.keras.layers.GlobalAveragePooling2D()\n",
"feature_batch_avg = global_avg_layer(feature_batch)\n",
"print(feature_batch_avg.shape)"
@@ -1604,7 +1622,7 @@
"metadata": {},
"outputs": [],
"source": [
- "instrument_model.fit_generator(\n",
+ "instrument_model.fit(\n",
" train_data_instrument, \n",
" validation_data=val_data_instrument,\n",
" steps_per_epoch=STEPS_PER_EPOCH, epochs=10)"
@@ -1694,4 +1712,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
\ No newline at end of file
+}
from ml-design-patterns.
Related Issues (20)
- Chapter 5: Continued Evaluation - Model Creation HOT 1
- Chapter 6: Transform
- Chapter 6: Pipeline Build
- Chapter 6: Model Versioning
- Chapter 6: Storm Reports HOT 3
- Chapter 7: Responsible AI HOT 3
- Dataflow Batch job creates a Zero Byte TensorFlow record file
- chapter 7 - access to gs bucket denied HOT 1
- chapter 7: Explainability shap.DeepExplainer fails "Can't convert non-rectangular Python sequence to Tensor". HOT 1
- Chapter 2 embeddings last cell - change request
- Chapter 2 : Feature Cross - Error in explaining text
- Chapter 2 Feature Cross BQML with L2 worse rmse than without ...
- Chapter 3 : multilabel : unable to get the dataset
- Chapter 3 : Cascade evaluate ValueError: The pyarrow library is not installed HOT 1
- Chapter 4 : checkpointing : callback not used in the fit() method
- Chapter 5 : continuous evaluation
- Chapter 5: Up the patience to at least 5?
- Chapter 5: Evaluation job not available?
- Chapter 6: How should I determine a number of bridging?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ml-design-patterns.