This tutorial introduces a simple CNN with keras and tensorflow to classify remote sensing images from the UC Merced dataset.
- Clone this repository to your local machine. In your terminal type:
git clone https://github.com/langnico/DL_tutorial_RS.git
- Download the data and pre-trained models from this link:
Move the directories into the code directory DL_tutorial_RS/
. The directory tree should look like this:
- DL_tutorial_RS/
- data/
- pretrained_model_simpleCNN/
We are going to execute the code in a jupyter notebook and use keras with a tensorflow backend.
Therefore, we need to install:
- python3
- jupyter
- tensorflow
Further we will need the python packages/modules:
- sklearn
- numpy
- matplotlib
- keras
We propose to install python via anaconda.
-
Install Anaconda and read the Anaconda tutorial (20min)
-
Create a new environment:
conda create --name DLenv python=3.6
-
Activate the new conda environment (for conda 4.6 and later versions)
- Windows:
conda activate DLenv
- Linux and macOS:
conda activate DLenv
For versions prior to conda 4.6, use:
- Windows:
activate DLenv
- Linux, macOS:
source activate DLenv
--> now your terminal prompt should start with (DLenv)
- Windows:
-
Install the following packages in your activated DLenv:
conda install jupyter conda install scikit-learn conda install matplotlib conda install keras
-
Install tensorflow with pip in the activated anaconda environment (DLenv).
For example install the current stable release for CPU-only:
pip install tensorflow
Alternatively, install tensorflow with GPU support using:
tensorflow-gpu
. For the GPU version you might have to follow the official tensorflow installation instructions or check the anaconda installation instructions.
-
In the activated DLenv type
which jupyter
. This should point to the python installation in your conda env e.g./username/anaconda3/envs/DLenv/bin/jupyter
-
Open a terminal and go to the location of the file:
installation_check.ipynb
Then open this jupyter notebook with:
jupyter notebook installation_check.ipynb
NOTE: If this does not automatically open a browser showing the notebook, then open a browser (Firefox, Chrome) and type:
http://localhost:8888/notebooks/installation_check.ipynb
Then select the first cell containing the imports and click on the
> Run
Button. If your installation was successful, the output should be something like this:Using TensorFlow backend. successfully imported keras version: 2.2.4
- https://github.com/tgjeon/Keras-Tutorials
- https://github.com/flyyufelix/cnn_finetune
- Nico Lang