In me previous post, I presented a brief introduction to the theory and methods of active learning. The next step on the path to active learning is implementation. In this post, I share my journey toward a complete automated tube of active learning.
Initially, like other motivated algorithm developers, so do I.athe chosen active learning method is implemented. I wasn’t thinking about the next steps and the “bigger picture”. On the other hand, it got me pretty quickly into a working (technically) implementation. On the other hand, it complicated the next steps. In my case, I had two parallel next steps, which raises three different questions:
- How do I build an active learning tube?
- How will the pipeline be built modularly and in general?
- How to include several different tasks in the pipeline?
The first active implementation of the learning process was semi-automatic. Each cycle is performed fully automatically, but it is performed manually. The most important addition for this is the data selector.
The data selector tells you the purpose of active learning – consciously selecting the next images to capture. Its input is a set of currently unlabeled data and its output is a noted subset.
The data selector can be an extra neural network, a classical algorithm, a database query, or any other method that suits you.
In each section, the data selector is based on the best model from the previous cycle. Its starting set is added to the training set of the previous cycle (after marking it).
Why is a semi-automatic not good enough?
In addition to performing each cycle manually, which takes time, the semi-automatic tube requires monitoring. By observation, I mean that we have to remember to run a cycle that stores the status of the previous cycle, manually selecting the inference model for the previous cycle, and much more. This process has a high potential for errors, mistakes, and confusion. Ideally, we want a fully automated pipeline, which is the subject of our next section.
I have several templates for several different tasks. One day I found myself copying from one file to four other files over and over again. At this point, I decided that something needs to change and it is time for standardization.
The training tube component is the most important for software design. Maintaining a modular and standard architecture with your training tube can save you a lot of trouble the next time you deploy a new network.
Inspired This model, I created my own in-depth learning code architecture with three main components – the data loader, the diagram, and the agent.
Data Loader – like called implicitly Data Loader encapsulates everything we need to create a data load object.
Chart – The chart includes our network model and other components needed for training, such as optimizer, timing, and loss.
Defining a diagram makes it easier to reuse shared components. For example, I have two segmentation tasks that use the same loss function. Your own Graph superclass includes an implementation of the loss function, and each task is executed from a Graph class inherited from the Graph superclass.
Agent – The agent is our school class. Each specific task is inherited from the Agent Super Class and must implement train and eval methods. A general training circuit is implemented in the agent super class, and all other classes that inherit from it can expand it.
To return to active learning, we finally reach the final stage. To create a fully automated pipeline, we need to close the loop. First, each episode must load the status of the previous state and save its current state. Second, we must automatically select the best conclusion model to use. This is done with the model selection module.
Model selector– Upon completion of the training session, we have several saved patterns at different points in the training loop. The model selector selects the best model using a specific criterion.
This model will be used as a data selection model in the next section (for relevant methods) and as a new production model.
Do we always want to train our network for a new selected unmarked lot? Probably not. We want to retrain our model when we notice a decline in performance. To do this, we use the Compare module.
The comparison module is quite simple and works as follows:
- Transfer the new tagged images to the Data Selector module.
- Measure the quality of the results and compare them to a key performance indicator (KPI).
- Meets KPI – no need to retrain.
- Does not meet KPI retraining.
The reference module can be eliminated during the development phase. In the development phase, we want to prove that our active learning method works. To this end, we use well-known fully commented material and demonstrate that we can consciously select our next training samples. For more information, see the previous post.
It’s time to put together and condense the whole architecture. In the following diagram, you will find an automated pipeline with all modules and their connections.
Now we all know the steps towards creating a great active learning tube.
It took me a while to arrange all my current codes to fit this pipe architecture. But once that was done, adding a new task or changing the Data Selector method became much easier.