Transforming feedback control systems on whiteboard into Matlab via a deep learning based intelligent system
Year: 2020
Type: dissertation
Abstract: In control theory, some concepts can be better grasped with further visualization. Some core concepts such as the transient and steady-state behavior of a system or the interval at which it is stable can be better expressed using plots in time and frequency domains. The introduction of these visual aids has an important place in control lectures. In the classroom environment, instructors usually draw the corresponding graphs about a system by hand after presenting its control diagram. Hand drawing a plot is a difficult and time-consuming process and it is not possible to correctly scaled graphs this way. In order to correctly analyze a system, a simulation environment like Matlab® should be preferred. In this thesis, we have proposed a deep learning based pipeline that can recognize and transfer a block diagram on the whiteboard to the Matlab® environment. This way, control systems drawn by the lecturers can be properly analyzed with computer-generated plots without redefining them in the Matlab®. Generally, feedback control architectures are covered in control system lectures. These architectures can be visually represented with block diagrams. In a block diagram, transfer blocks are shown as rectangles and the connections between these blocks are indicated with arrows. The arithmetic operations like summation and subtraction between the signals are also shown inside small circles. A feedback control system may contain transfer functions for the filter or noise dynamics along with the controller and the plant. The number and the location of these transfer functions, their connection schemes, the number of forward or backward paths separates an architecture from another. In order to transfer a handwritten block diagram to Matlab® these informations must be extracted first using computer vision techniques. Then, the contents of each transfer function must be found in order to represent them in Matlab®. An architecture with known connections and transfer functions can be easily expressed in the Matlab® environment. If desired, a simulation model can be created Simulink™ or analyzed with Control System Designer App™. The control architecture from a given picture can be found with different approaches. A possible one is to handle the recognition task as a classification problem. In classification problems, inputs are assigned to one of the pre-defined classes by calculating a similarity ratio. In the context of feedback control architecture recognition, frequently used architectures can be selected as the class set, and the corresponding class can be found by examining the input image. Classification problems usually require a feature extraction method. These methods transfer the inputs to a feature space and the classification is done between the points in that space. The accuracy of the classification task depends on the selected feature extraction method and finding a proper method is the main challenge in classification problems. An ideal feature extraction method should not be affected by the uncertainties in the input image. Lighting condition is among the most common uncertainties in image processing problems. The intensity of the light can cause dark areas to appear brighter and can cause information loss. Also, the quality of the lecturer's handwriting quality can cause further uncertainties in our handwritten architecture recognition problem. Long sessions may deteriorate the lecturer's handwriting quality or different handwritings among various lecturers can harm the generalizability of the classification model. Various feature extraction algorithms exist in the computer vision literature, but a majority of them are not robust to transformations or noises in the input images. Therefore, structures that automatically extract features such as neural networks are preferred. In this thesis, recognition of a handwritten feedback control architecture is handled as a classification task where the classes are the 6 feedback control architectures defined in the Control System Designer App™. In order to accomplish the classification task, we have trained a deep Convolutional Neural Network (CNN). For the training, we have collected images of handwritten feedback architectures with the help of various lecturers. Although we have gathered as many samples as we can, constructing a dataset is a time-consuming process. To avoid problems that may arise from the lack of data, we have adopted the transfer learning approach. With the transfer learning approach, a deep network trained on large datasets like ImageNet can be adapted to new classification tasks by replacing its last layers. As the base network for our CNN, we have selected ResNet-50 since it shows high classification accuracies in benchmark tests and doesn't suffer from a common problem called gradient vanishing. The next step in our deep learning based pipeline is to construct the transfer functions. To create the mathematical expressions of the transfer functions, characters in the input images must first be recognized. Besides, we need to be able to determine which characters belong to which transfer function. If the location and the dimensions of each transfer function block in the input image are known, the corresponding characters can be searched inside these regions. Considering the transfer functions are represented as rectangles in block diagrams, we continued our pipeline with a rectangle detection step in this context. First, the input image is binarized with a thresholding algorithm. Possible noises caused by illuminations are then filtered from the binary image. After the filtering operation, an edge detection algorithm is applied and the outermost edge is removed from the binary image. With a filling method that fills closed contours, we ended up with regions as candidate rectangles. Using the connected component analysis and inspecting the rectangularity of each region, actual rectangles and their locations are found. At this point, the architecture and the transfer functions it contains are already known. Starting from the upper-left one, rectangles are then matched with the transfer functions by comparing their locations. Following the rectangle detection step, regions belonging to the transfer functions are cropped from the filtered binary image. Then the characters are detected in these cropped regions using the connected component analysis. In order to label the detected characters, we have trained another CNN using a pre-trained ResNet-50 as a base network. There are 20 possible labels for a character consisting of the arithmetic operators, parentheses, digits, and the 's' character. We have also constructed a second dataset for the character classification task. After detecting the transfer function blocks and recognizing the characters they contain, symbolic expressions for each transfer function can be constructed. A transfer function can be defined in Matlab® by finding the coefficients of its numerator and denominator. The coefficients can easily found from the symbolic expressions with the functions provided by Matlab®. For this purpose, the characters in each block are first sorted by their horizontal positions. Using the vertical position of the character that represents the fraction sign, the remaining ones are then separated as numerator and denominator. By concatenating the labels of the ordered characters, equation strings are generated. From the equation strings, symbolic expressions are constructed and the required coefficients are found. Thus, all the information necessary to transfer the feedback architecture drawn on the board to the Matlab® environment was obtained. At the end of the deep learning based pipeline, the recognized architecture can easily be transferred to the Control System Designer App™. The application requires the type of the feedback control architecture and the expressions of the transfer functions to create a new analysis, which is already present at this point. Alternatively, a Simulink™ model can be generated by defining the connections and transfer functions. To test the real-time capabilities of our pipeline, we finally created a test application that uses our pipeline. It processes images gathered from a live camera and creates a Simulink™ model if it detects a suitable feedback control architecture.
Author: Dorukhan Erdem
Institution: Istanbul Technical University
Language: English
Subfield: Computer Vision and Pattern Recognition
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W3126414977
