... | ... | @@ -78,10 +78,12 @@ I1205 10:33:48.405846 26502 sgd_solver.cpp:105] Iteration 700, lr = 0.00950522 |
|
|
```
|
|
|
|
|
|
How long this takes highly depends on your hardware, especially whether you use a GPU or a CPU.
|
|
|
However, this is proof, that everything is set up correctly and your net is actually learning something (the loss decreases while the accuracy increases). If something goes wrong here, please refer to the *Caffe* documentation to fix any problems.
|
|
|
However, this is proof that everything is set up correctly and that your net is actually learning something (the loss decreases while the accuracy increases). If something goes wrong here, please refer to the *Caffe* documentation to fix any problems.
|
|
|
|
|
|
You can stop the training by pressing `Ctrl+C`.
|
|
|
|
|
|
**Note:** If you do not have a CUDA-compatible GPU or have built Caffe in a CPU-only version, you need to change the device parameter in the solver file to `cpu` instead of `gpu`.
|
|
|
|
|
|
|
|
|
## Install Barista <a id="Install"></a>
|
|
|
So, finally we can start and have a look at *Barista*. First thing we have to do is clone the repository. If you want to have a look at it first, you can look at the repository [webpage](https://go.wwu.de/barista).
|
... | ... | @@ -97,16 +99,16 @@ Before trying to run *Barista*, make sure you have python, pip, qt5 and pyqt ins |
|
|
sudo apt-get install python python-pip
|
|
|
sudo apt-get install python-pyqt5 qt5-default
|
|
|
|
|
|
*Barista* needs a few python packages being installed, that can be done automatically, using PIP:
|
|
|
*Barista* needs a few python packages being installed. This can be done automatically using PIP:
|
|
|
|
|
|
cd Barista
|
|
|
pip install -r requirements.txt
|
|
|
|
|
|
If you get arror messages because you don't have write permissions, you can try to add the `--user` flag to the command, so packages are installed for the current user, only.
|
|
|
If you get error messages because you don't have write permissions, you can try to add the `--user` flag to the command, so packages are installed for the current user, only.
|
|
|
|
|
|
By the way, the file `requirements.txt` is human readable, hence you can easily check what dependencies do currently exist.
|
|
|
|
|
|
If you did not see any error messages you are now ready to start *Barista* for the first time.
|
|
|
If you did not see any error messages, you are now ready to start *Barista* for the first time.
|
|
|
|
|
|
## Start Barista <a id="Barista"></a>
|
|
|
To run *Barista* start the file `main.py` in BARISTA_ROOT. You can either do this in your favorite file manager or from a terminal:
|
... | ... | @@ -118,10 +120,10 @@ The first message you will see will look like this: |
|
|
|
|
|
![Caffepath](Caffepath.png)
|
|
|
|
|
|
In order for *Barista* to run properly, it needs to know where your *Caffe* installation is. From this the available layers and solver types as well as all the parameters will be extracted. Please select the CAFFE_ROOT folder and click `Save and start Barista`.
|
|
|
If you selected an invalid folder, you will see a warning. Please make sure, that you provide the path to a valid *Caffe* installation.
|
|
|
In order for *Barista* to run properly, it needs to know where your *Caffe* installation is. From this, Barista will extract available layers and solver types as well as all of the parameters. Please select the CAFFE_ROOT folder and click `Save and start Barista`.
|
|
|
If you selected an invalid folder, you will see a warning. Please make sure that you provide the path to a valid *Caffe* installation.
|
|
|
|
|
|
**Note:** If, for some reason, you move your installation of *Caffe* to a different directory, *Barista* will notify you on the next start. The Current default path will be displayed, hopefully reminding you, what you have changed. Just provide the new CAFFE_ROOT and everything should be alright.
|
|
|
**Note:** If, for some reason, you move your installation of *Caffe* to a different directory, *Barista* will notify you on the next start. The current default path will be displayed, hopefully reminding you of what you have changed. Just provide the new CAFFE_ROOT and everything should be alright.
|
|
|
|
|
|
The next window you will see, is the startup dialog:
|
|
|
|
... | ... | @@ -130,80 +132,82 @@ The next window you will see, is the startup dialog: |
|
|
This dialog is always the first thing you will see when starting up Barista (and your *Caffe* installation did not change).
|
|
|
Barista stores networks and training results on a project basis, hence you have to set up a project first. We suggest to create a folder `barista-projects` where you can then create a new directory for every project. However, you are completely free in your choice.
|
|
|
|
|
|
So, click on `New Project` and select the project root folder. Then select the project name at the bottom of the dialog. A new directory will be created within the project root folder with exactly the same name. If later on you want to copy all your training to another machine or show it to a colleague or friend, all you have to do is copy the project folder. We have chosen `myFirstProject` as the name.
|
|
|
So, click on `New Project` and select the project root folder. Then select the project name at the bottom of the dialog. A new directory will be created within the project root folder with the project name. If later on you want to copy all your training to another machine or show it to a colleague or friend, all you have to do is copy the project folder. We have chosen `myFirstProject` as the name.
|
|
|
|
|
|
Now you've made it to the main window of Barista. For now, you will only see an empty network and and invalid session on the right:
|
|
|
|
|
|
![empty project](BaristaEmptyProject.png)
|
|
|
|
|
|
Any *Barista* project contains at least one session. A specific network design, solver settings and training results are saved in a separate session, making sure you do not loose any results when trying out different topologies and settings.
|
|
|
On the left hand side, the list of available layers is displayed. You can drag and drop them to the canvas in the center. Add Blobs to them and build your own Network from scratch. However, we would first like to give you an impression of a working network.
|
|
|
Any *Barista* project contains at least one session. A specific network design, solver settings, as well as training results are saved in a separate session, making sure you do not lose any results when trying out different topologies and settings.
|
|
|
On the left hand side, the list of available layers is displayed. You can drag and drop them to the canvas in the center. Add blobs to them and build your own network from scratch. However, we would first like to give you an impression of a working network.
|
|
|
|
|
|
|
|
|
## Load the Network Design and Solver <a id="Import"></a>
|
|
|
|
|
|
Looking at the Session list at the right side, you can see, that the current session is invalid because we have not defined any solver parameters, yet. When hovering over the session status, you will get some more detailed information, giving some guidance what you can do now.
|
|
|
Looking at the Session list at the right side, you can see that the current session is invalid because we have not defined any solver parameters, yet. When hovering over the session status, you will get some more detailed information, giving some guidance what you can do now.
|
|
|
|
|
|
We are now importing the solver for the mnist lenet network. Select File --> Import Solver. In the new dialog, browse to CAFFE_ROOT and further on to `examples/mnist` in there, select the `lenet_solver.prototxt`.
|
|
|
We are now importing the solver for the MNIST LeNet network. Select File --> Import Solver. In the new dialog, browse to CAFFE_ROOT and further on to `examples/mnist`. In there, select the `lenet_solver.prototxt`.
|
|
|
Once confirmed, *Barista* loads all solver settings. It also recognizes, that the solver is linked to a specific network, hence you can directly import this network as well.
|
|
|
|
|
|
![import solver](BaristaImport.png)
|
|
|
|
|
|
You can click on `Show Details...` if you want to see what network you are importing and how it looks like in prototxt. As we want to get started fast, we select `Yes` to import the referenced network.
|
|
|
You can click on `Show Details...` if you want to see what network you are importing and what it looks like in prototxt form. As we like to get started quickly, we select `Yes` to import the referenced network.
|
|
|
|
|
|
You will now see the Lenet network topology on the canvas, different layer types are color coded to make larger nets a bit easier to browse. Data flows through the net from left to right, hence the data layers are on the left while loss and accuracy are calculated on the outer right.
|
|
|
You will now see the LeNet network topology on the canvas, different layer types are color coded to make larger nets easier to browse. Data flows through the net from left to right, hence the data layers are on the left while loss and accuracy are calculated on the outer right.
|
|
|
|
|
|
![LeNet no input](BaristaLenetNoInput.png)
|
|
|
|
|
|
You can also see the inputs and outputs of the layers being connected via blobs. A bottom blob automatically gets its name from the top blob it is connected to. Hence, if you want to change the naming, just adjust the name of the top blob in the producing layer. You can do this via layer properties.
|
|
|
You can also see the inputs and outputs of the layers being connected via blobs. A bottom blob (Caffe's name for an input which is shown in Barista at the left side of a layer) automatically receive its name from the top blob (i.e., a Caffe output of a layer) it is connected to. Hence, if you want to change the naming, just adjust the name of the top blob in the producing layer. You can do this via layer properties.
|
|
|
|
|
|
If you select the `Layer Properties` tab on the right hand dock, and then click on the conv1 layer, you will see all its properties:
|
|
|
If you select the `Layer Properties` tab on the right hand dock, and then click on the conv1 layer, you will see all of its properties, i.e. parameters:
|
|
|
|
|
|
![layer properties](LayerProperties.png)
|
|
|
|
|
|
###Outlook:
|
|
|
If you would want to change the output blob name, you could do it right at the bottom. If you do so, you can also observe, that the input of the following layer (`pool1`) automatically changes its name.
|
|
|
If you would want to change the output blob name, you could do it right at the bottom. If you do so, you can also observe that the input of the following layer (`pool1`) automatically changes its name.
|
|
|
|
|
|
Below the current settings overview, you can also add new properties. You can select from all available parameters and parameter groups, hence you do not have to memorize all available parameters. However, it is not possible to automatically derive what settings make sense, so especially on the upper level, the list of available parameter groups is pretty large. Very often the name of the parameters and groups give a good hint if you should apply them to the current layer.
|
|
|
Below the current settings overview you can also add new properties. You can select from all available parameters and parameter groups, hence you do not have to memorize all available parameters. However, it is not possible to automatically derive which settings make sense, so especially on the upper level, the list of available parameter groups is relatively large. Very often the name of the parameters and groups give a good hint if you should apply them to the current layer.
|
|
|
|
|
|
Very often you will build your net from layers with similar settings. To speed up your design phase, you can Copy&Paste layers on the canvas and only adjust the settings you want.
|
|
|
You will frequently build your net from layers with similar settings. To speed up your design phase, you can Copy&Paste layers on the canvas and only adjust the settings you want to change.
|
|
|
|
|
|
## Load the Databases <a id="Databases"></a>
|
|
|
When looking back at the Session list, you can see, that the current session is still invalid because the data layers cannot find the databases. Nothing to worry, we can do something about that as well.
|
|
|
When looking at the session list, you will notice that the current session is still invalid because the data layers cannot find the databases. Nothing to worry, we can do something about that as well.
|
|
|
|
|
|
In the menu bar, select `Edit` -> `Input Manager` (or press Ctrl+I or click on the Input Manager icon in the menu bar). the Input Manager appears and does not show any available data sources:
|
|
|
In the menu bar, select `Edit` -> `Input Manager` (or press Ctrl+I or click on the Input Manager icon in the menu bar). The Input Manager will appear, does not show any available data sources:
|
|
|
|
|
|
![input manager empty](InputManEmpty.png)
|
|
|
|
|
|
Now select Add new Database, and Browse to CAFFE_ROOT`/examples/mnist`. In this folder you will find the two directories we created [before](#Data). Select the `mnist_test_lmdb` directory and add `data.mdb` as input. Repeat those steps for `mnist_train_lmdb`.
|
|
|
|
|
|
Now, you have two data sources named LMDB Database. By clicking on the pencil icon, you can change the name to something more meaningfull, like `MNIST Train` and `MNIST Test`. Your Input Manager should now look like this:
|
|
|
Now, you have two data sources named LMDB Database. By clicking on the pencil icon, you can change the name to something more meaningful, like `MNIST Train` and `MNIST Test`. Your Input Manager should now look like this:
|
|
|
|
|
|
![input manager MNIST](InputManMNIST.png)
|
|
|
|
|
|
As a final step you can now click on the arrow pointing right to assign each database to a data layer. All available data layers are shown in a list and you cann just double-click to assign. In brackets you can also see the training [phases](https://github.com/BVLC/caffe/wiki/Excluding-Layers:-Train-and-Test-Phase) they are assigned to.
|
|
|
As a final step you can now click on the arrow pointing right to assign each database to a data layer. All available data layers are shown in a list and you can just double-click on a layer to assign the database to it. In brackets you can also see the training [phases](https://github.com/BVLC/caffe/wiki/Excluding-Layers:-Train-and-Test-Phase) they are assigned to.
|
|
|
|
|
|
After assignment, you wil find the name of the layer and it's phase next to the arrow you've just clicked.
|
|
|
After assignment, you will find the name of the layer and its phase next to the arrow you have just clicked.
|
|
|
|
|
|
You can now close the Input Manager again.
|
|
|
|
|
|
## Start Training <a id="Training"></a>
|
|
|
Finally we have everything we need to train our Neural Network. This is indicated by the ready status in the session list, colored in blue:
|
|
|
Finally we have everything we need to train our neural network. This is indicated by the ready status in the session list, colored in blue:
|
|
|
|
|
|
![session ready](SessionReady.png)
|
|
|
|
|
|
Now, just click the play button and let the training begin. The Status label turns green and shows `Running`.
|
|
|
Now, just click the play button and let the training begin. The status label turns green and shows `Running`.
|
|
|
|
|
|
If the label turns red and shows `Failed` it is worth checking the console output on the lower left, since most probably something went wrong within *Caffe*. If you ever have a failed session, you cannot bring it back to life again. This is because something is wrong with this session but *Barista* can not determine what it is. Hence, it would again be set to `Ready` and most probably fail for the same (yet unknown) reason whenever you try to run it again. Of course your work was not in vain. If you have determined and solved the problem, you can select your failed session and click the `New` Button on top of the session list. This will create a new session for you, which will be set to `Ready` and you can start it again - hopefully with more success this time.
|
|
|
|
|
|
If the label turns red and shows `Failed` it's worth checking the console Output on the lower left, most probably something went wrong within *Caffe*. If you ever have a failed session, you cannot bring it back to life again. This is because something is wrong with this session but *Barista* can not determine what it is. Hence, it will again be set to `Ready` and most probably fail for the same (yet unknown) reason whenever you try to run it again. Of course your work was not in vain. If you have determined and solved the Problem, you can select your failed Session and click the `New` Button on top of the session list. This will create a new session for you, which will be set to `Ready` and you can start it again. Hopefully with more success this time.
|
|
|
**Note:** If you do not have a CUDA-compatible GPU or have built Caffe in a CPU-only version, you need to change the device parameter in the solver properties to `CPU`-mode. This can be done directly via the solver properties dock in Barista.
|
|
|
|
|
|
Assuming everything worked fine, please pause your training again using the very same button you have just clicked, which now shows a pause symbol. We are doing this because training MNIST usually is pretty quick and we want to show you some more things you can do.
|
|
|
|
|
|
Please note, that *Barista* automatically saves a snapshot of the training status whenever you pause a session. Hence, you can always resume the training from where you've been.
|
|
|
Please note that *Barista* automatically saves a snapshot of the training status whenever you pause a session. Hence, you can always resume the training from where you have been.
|
|
|
|
|
|
## Watch the progress <a id="Plotter"></a>
|
|
|
In the [Data Section](#Data) we have already seen how the training output looks like on the console for a running session. As you can imagine it is pretty hard to keep track of whats going on during training and to decide when to stop.
|
|
|
In the [Data Section](#Data) we have already seen how the training output looks like on the console for a running session. As you can imagine, it is relatively hard to keep track of whats going on during training and to decide when to stop.
|
|
|
|
|
|
The Plotter offers a more comprehensible representation of the training progress. By default, the plotter can be found in the bottom right corner. There you can find a settings button. Here you can decide what should be plotted.
|
|
|
The plotter offers a more comprehensible representation of the training progress. By default, the plotter can be found in the bottom right corner. There you can find a settings button. Here you can decide what should be plotted.
|
|
|
|
|
|
After clicking on `Settings` you will see the following options:
|
|
|
![plotter settings](PlotterSettings.png)
|
... | ... | @@ -213,9 +217,9 @@ Sessions are added automatically when they are started. The Keys are all deselec |
|
|
Now, the potter area shows the course of accuracy and loss over training iterations:
|
|
|
![plotter](Plotter.png)
|
|
|
|
|
|
If you now click the play button in the session list again, you will see how the plot is updated in real tim during training.
|
|
|
If you now click the play button in the session list again, you will see how the plot is updated in real time during training.
|
|
|
|
|
|
Furthermore, you can select the weight visualization option to get a basic 2D visualization of the weights of each layer. This helps in spotting overfitting, or wrong gradient descent directions. Visualized weights are only available for snapshots taken by caffe. This can be done using the snapshot button (camera symbol next to play/pause), pausing the session or automatically by setting the snapshot property for the solver.
|
|
|
Furthermore, you can select the weight visualization option to get a basic 2D visualization of the weights of each convolutional layer. This helps in spotting overfitting, or wrong gradient descent directions. Visualized weights are only available for snapshots taken by Caffe. This can be done using the snapshot button (camera symbol next to play/pause), pausing the session or automatically by setting the snapshot property for the solver.
|
|
|
|
|
|
|
|
|
## Networking <a id="Hosts"></a>
|
... | ... | |