This hands-on lab builds a neural network to predict an input image as that of coffee, donut or a mug.
The workshop provides you with all the data and assets you need to create the classifier on IBM Cloud. To get started, you can clone this github repo or simply download the sample file under assets/coffee-donut.zip. You do not need to unzip the file, but simply upload it to Watson Studio as explained in the steps below. The zip file contains the following assets
assets
├── data_asset
│ ├── Coffee\ Bag\ 2.jpg
│ ├── Coffee.jpg
│ ├── Donut.jpg
│ ├── Mug.jpg
│ └── coffee-donuts-segregated.zip
└── notebook
└── notebook:Train_a_simple_classifier_dam9_4_n1.ipynb
- data_asset/coffee-donuts-segregated.zip - this is your training data
- data_asset/*.jpg - test images used to predict with the model
- Train_a_simple_classifier_dam9_4_n1.ipynb - this is the sample notebook that is used to train your image classifier.
- This workshop assumes you have an IBM Cloud account. Please ask the workshop facilitator for the URL to sign up. If you don't have a unique URL, you can register here - https://ibm.biz/Bdq2TN
- Download assets/coffee-donut.zip file that will be used as a template in this workshop.
- IBM Watson Studio - helps data scientists and analysts prepare data and build models at scale
- IBM Cloud Object Storage - stores large volumes of unstructured data while still ensuring scalability, security, availability, reliability, manageability, and flexibility.
- Jupyter Notebooks - provides a collaborative environment and runtimes that enables Python, Scala, and R notebooks
-
Search for Watson Studio service on IBM Cloud in the Catalog or using the search bar as shown here
-
Create a Watson Studio instance
-
Click on
Launch in IBM Cloud Pak for Data
to launch Watson Studio -
Create a Project
inside Watson Studio -
Create a project from a sample or file
-
Create a new storage service
-
You can leave the defaults and click on
Create
-
Upload the sample file to create the new project. You can find the sample zip file under assets/coffee-donut.zip
-
Finish uploading file and create a new project
-
Once the project has been created, view project to see details
-
Open
Assets
tab. This is where you will find the data and notebooks -
Scroll down to
Notebooks
and open theTrain a sample classifier
notebook -
If your notebook is in read-only mode, use the pencil button to edit the notebook
-
This will instantiate a new runtime for you to run the notebook
-
You can now run the cells to create the neural network! Click on the first cell to focus on it and then hit the run button on the top bar. Click on the run button again to go to the next cell and keep going till the end to finish the workshop. You can click on the cell itself to edit the content. The two steps below ask you to add your cloud object storage credentials to download the training data file.
-
In order to use the data from the cloud object store in the notebook, use the
0100
data tab on the right side as show in the image below. You can useinsert credentials
link from thecoffee-donuts-segregated.zip
asset. This will insert some code in the notebook that provide you access to the credentials as a dictionary. -
The credentials generated in the cell above will be stored in a variable with a name like
credentials_<number>
. The number gets incremented every time you run this cell. Assign it tocredentials
variable in the next cell. Thiscredentials
variable will be used in the rest of the notebook.