Resource Optimisation using Multithreading in Support Vector Machine

Image processing is one of the most important features for vision-based robotic and being used in various applications to increase productivity. Various researchers reported issues computation problem to detect objects in low cost device such as vision-based robotic car. In the fast-paced development of technology, a system that runs automatically with the right results is essential to the completion of a job. This study aims to propose an effective multithreading for road sign recognition. We implemented multithreading algorithm for train and detector processes in SVM to utilise the multicore CPU and evaluate in various condition on by a Raspberry Pi platform. It aims to solve the real-time computation issue using Pi camera. Experimental results show significant improvement of performance to the detection accuracy. In conclusion multithreading significantly improve the detection performance using Raspberry Pi processors with various image resolution and number of SVM model. Keywords—Robot vision; recognition; multithreading; realtime


I. INTRODUCTION
Image processing is one of the most important features for vision-based robotic and being used in various applications to increase productivity. One of the interesting topic is object recognition which has been evolved drastically. In robotic contexts, the ability to understand the object helps robot to make accurate and better decision [1] [2]. However due to large resource consumption for computation, multithreading method are one the way to optimize using multi-tasking process and fasten the computation in real-time application. Timing is an important factor in image processing because the delay in time or delivery of an image template would cause many issues in the final decision. This lead to adoption the concept of multithreading in low cost computing device such as Raspberry Pi so that the results of recognition are accurate.
In addition, development of intelligent car robot is also a symbol of modernization and development that is rapidly changing [3]. Each features of cars and transportation are created to help in the comfort and safety of everyone. As such, this study focus on about vision-based robotic cars with improvements in multithreading and image processing. A multithreading algorithm is implemented to detect images such as signage with the addition of multithreading to the system for better performance. This method is applied on a machine learning algorithm called Support Vector Machine as for image training and detection process [4] [5]. Evaluations of its performance focused on variation of input, model and resource optimization.
This paper is organized in five sections. Section I provides an overview of issues and research gap. Section II presents the related work on object recognition and multithreading. Section III describes the research methodology implemented in this study. Section IV presents the experimental result and discussion on the finding. Finally, Section V concludes the impact of this study.

II. RELATED WORKS
The use of Intelligent Robotic Car is very efficient when the robot itself will move autonomously as the robot understands each sign. Furthermore, it responds to the detected sign without requiring the user to move it. However, various researchers reported issues computation problem to detect objects in low cost device such as Smart Car Robot [6] [7]. This is due to the Raspberry Pi has four cores but only the use of a single core can be achieved. The use of this single core resulted in the performance of the Raspberry Pi slowing down for the Pi camera detecting the sign [8]. Images that can be detected using the Support Vector Machine algorithm are also limited to fast detection when only a single core is used resulting in performance on the system. The detection using the Pi camera is slower when more images are stored as SVM models [9] [3].
The simplest type of multithreading occurs when a thread runs until it is blocked by an event that usually creates a long latency [10]. Such a stop may be due to the cache having to access the external chip memory, which may take hundreds of CPU cycles for the data to be returned. Instead of waiting for a stop to be completed, the threading processor will switch the implementation to another thread that is ready to run. Only when the data for the previous thread has arrived, will it allow the previous data to be placed on the standby thread list. The purpose of multithreading is to remove all interrupted data dependencies from the implementation pipeline [11,12]. Because one thread is independent of another, there is a possibility of a single instruction in a pipeline that requires output from a longer direction in the planning. Conceptually, it is similar to the primitive multitasking used in operating systems; The analogy is that the time given to each active thread is a CPU cycle. The most advanced type of multithreading applies to superscalar processors. Whereas normal superscalar processors issue multiple commands from one thread per CPU cycle, in simultaneous multithreading *Corresponding Author www.ijacsa.thesai.org (SMT) the superscalar processor can issue commands from multiple threads per CPU cycle. Realizing that any single thread has a limited amount of directive parallelism, this type of multithreading attempts to exploit the parallelism found in the various threads to minimize the rest associated with unused issue slots.
The objectives of this study focused on further evaluation of signal processing using the Pi camera with several variables to test to improve system performance. Furthermore, comparison of single core based Raspberry Pi with multicore via multithreading so that CPU usage and Raspberry Pi memory are analysed.

III. RESEARCH METHODOLOGY
This study is divided into five phases which contains collection of data, annotation, training, detection using SVM and improvement using multithreading procedure. In this phase we considered issues when the increase in the number of images in each SVM model for detection by a Pi camera significantly improves performance to the detection accuracy decreases. During the process of running on the device, the use of 1 core on the Raspberry Pi greatly reduced the memory usage which led to the loss of the stored image because lack of support and storage of multiple images which delayed its performance.

A. Data Collection
This project is about the detection of signage so the collection of signage images is from the source https://github.com/Moataz-E/deeplearning-traffic-signs. Each description used has a different information. The images collected are from a range of resolutions to be set to four resolutions of 160x128, 240x192, 640,480 and 1296x736. Increasing the resolution at each detection will test the system's ability to function efficiently. Performance data during benchmark detection testing were collected and reported for performance evaluation using selected attribute such as resolution and image amount.

B. Support Vector Machine
In machine learning, support vector machine (SVM) is a learning models which integrates learning algorithms related to data analysis used for classification and regression analysis. Since a set of training examples, each labeled as belonging to one or the other of two categories, SVM training algorithms build models that provide new examples to one category or another, they become binary linear classifiers that are nonexistent (though methods like scaling exist to use SVM in probabilistic classification settings). The SVM model is a representation of the samples as points in space, mapped so that the separate categories are divided into as wide a gap as possible as shown in Fig. 1. The new examples are then mapped into the same space and predicted to become categories based on the sides of the gap.
All training image were annotated to set the size limit to the image to be detected. It aims to classify images by dividing hyperplanes into non-linear datasets. Classification of each object by maximizing the margin distance so that the data points can be classified more confidently. SVM is one of the low computation machine learning algorithms which is suitable due to the limitations of the Raspberry Pi in handling high demand process and algorithmic demand.

C. Multithreading
This study focuses more on internal performance than on external performance, which is more on Raspberry Pi's performance in the ability to carry out signage detection with large picture storage and higher resolution images. Pre evaluation were done for each SVM processes to trace the high computation process for multithreading [13,14]. The sign-on process is used to monitor and logged the performance of the Raspberry Pi system for pre and post multithreading evaluation.
In this phase, the detection of the trained signage using the SVM algorithm. Signal detection using the Pi camera and when the trained sign image is detected, green, red, blue or white frames will appear around the image known as the image marker for detected image. In computer architecture, multithreading is the ability of a central processing unit (CPU) (or single core in a multi-core processor) to execute multiple processes or threads simultaneously supported by operating systems. This approach is different from multiprocessing. In multithreaded applications, processes and threads share single or multiple core sources, including computing units, CPU caches, and lookaside translation buffers (TLB). A multiprocessing system includes multiple complete processing units in one or more cores, multithreading is intended to enhance single core use by using thread-level parallelism, as well as command-level parallelism. Because the two techniques complement each other, they are sometimes combined in a multithreading CPU system and with a multicore CPU.
The multithreading algorithm as in Fig. 2 is deployed on existing coding during model detection process. In preevaluation, the image streamed from the Pi camera show lagging issues but not at the capture stage, annotate the image and train the image to the SVM model. This is caused by our very large SVM model files with a very large number of images will cause our computer performance and high CPU memory usage. From a coding standpoint, the use of just one thread per process in the fourth coding which results in overloading of only one CPU memory will result in the accuracy of the tracking results being dropped while we can access all four cores on the Raspberry Pi 3B+ to split memory usage CPU evenly. Due to memory limitations on only one CPU, implementation of multithreading alternatives should improve the tracking performance in real-time.   Fig. 3 shows the original code executed with the performance monitoring taken during the execution of the code. Currently only two processes are running -SVM model detection and performance monitoring that can be seen in the above diagram. From the system monitoring can look at process identifier number 842, CPU usage was 85.3% with 9.4% memory by the coding. On the record it can be stated that 4 CPUs are used. From there the core usage guarantees by looking at the number on us is the usage in the Raspberry Pi core. It can be seen that only one core is used here and subsequent tracking is still ongoing.

A. Comparison of CPU Memory usage in Frame Per Second
In Fig. 4, the output of coding added with multithreading programming is presented. Originally, only one running process is SVM model tracking code. With the use of multithreading, it can be seen that the optimization of resource is achieved show by the usage of the 4 CPU cores in an evenly distributed processes. This is due to every 1 SVM model uses 1 thread to run the process from the original code compared to usage of single thread to run the entire SVM model. Usage of less than 50 with decrement of memory usage from 9.4% to 7.5%. The use of multithreading shows an improvement in computing performance. Table I shows a graph of thread usage on FPS performance. The first experimental test used single thread computation with a recorded 10 frame per second followed by the use of 2 threads resulted in an increased FPS of 15. The FPS in an optimized solution using all 4 threads improved to 30 due to the system's reluctance to run every single thread, containing the process as a separate thread.    Table II shows some of the resolutions used to run tests to evaluate performance I various resolution conditions. The evaluations considered important parameters such as time, memory and CPU Usage which are presented in Table III. The results indicate an improvement over time and memory in various resolutions. Fig. 5 shows the graph increasing with time as resolution increases. The difference between using a thread and not using a thread is a small amount of time recorded but improvements have been made to the system. Time was recorded according to the 5 recorded pictures and the last time the fifth picture was taken to draw the graph. It can be seen that there is a slight increase in graphs using threading compared to no threading.   Table IV shows the use of threading for image processing by increasing the image from 10 to 50 and improving the trained SVM model. Increased processing time for uniform images in 1.3 and 5 models. For the 30 images, time increased drastically on the third model and gradually increased upon the fifth model. For the 50 images, the time increases parallel to capital 1 to 5. Visible in the 5th capital with 50 images using threading is faster than the non-threading detection with 3 models and 30 images per model which is 23.7 tracking time.

V. CONCLUSION
The development of the intelligent robotic system aims to improve the computing performance by optimizing the resources in a Raspberry Pi. Experimental results show a significant improvement achieved using multithreading in SVM processes. Based on the research conducted, there are several suggestions for further improvements, such as deep learning and algorithms like Fractal or any other machine learning approach such as RNN. In conclusion, the study intended to benefit road users so that they can receive information about road signage with high performance.