In this lab, you use the Oracle Cloud Infrastructure (OCI) Data Science service to build a machine learning model to classify chest x-ray images. Each image is of a patient that is suspected of having pneumonia. The machine learning model will classifies an image as having the presence or absence of the disease.
The lab will demonstrate how one can tackle real-world artificial intelligence problems from end to end. To do this, you will build a complete machine learning pipeline to detect pneumonia. Pneumonia affects about a million Americans a year and causes about 50,000 deaths. This makes it one of the top ten leading causes of death in the United States. It's estimated the US will have a shortage of more than 100,000 physicians by the year 2030. Machine learning will help fill this gap by assisting diagnosis, letting us detect pneumonia earlier, with less reliance on medical specialists.
The notebook makes connections to other OCI resources. This is done using resource principals. If you have not configured your tenancy to use resource principals then you can do so using the instructions that are here. Alternatively, you can use API keys. The preferred method for authentication is resource principals.
Your notebook needs internet access.
- Open a Data Science Notebook session (i.e. JupyterLab).
- Open a file terminal by clicking on File -> New -> Terminal.
- In the terminal run the following commands:
odsc conda install -s mlcpuv1
to install the General Machine Learning for CPUs conda.conda activate /home/datascience/conda/mlcpuv1
to activate the conda.pip install oci
to install the OCI Python SDK.pip install scikit-image
pip install keras
pip install tensorflow
- Copy the
notebooks
folder into the notebook session. - Copy the
data
folder into the notebook session. - Open the notebook
notebook/ChestXrays_Train.ipynb
. - Change the notebook kernel to
Python [conda env:mlcpuv1]
. - Read the notebook and execute each cell. The data will be stored in a folder called
./data
and a model artifact is created under./model_artifact
. - Before you
prepare()
the artifact, publish your conda environment. In the terminal, run the commandodsc conda publish -s xray-demo
. - To confirm that the conda was published, click on File -> New Launcher and look for the conda environment.
- Complete the rest of the notebook.
- Open the notebook
notebook/ChestXrays_Validate.ipynb
. - Change the notebook kernel to
Python [conda env:mlcpuv1]
. - Read the notebook and execute each cell.