# CIMI: Classify and Itemize Medical Image System for PFT Big Data Based on Deep Learning
## 3 System Architecture
### Major Function Specifications  
In this section, the major functions of PFT image classification, data extraction, and database creation are explained. The PFT image classification is shown in Figure 2. For the PFT image classification, the standards of the types were set by an actual professional clinician. Any type of test sheet that does not contain texts (for example, only graphs) were classified as \"Unknown\". The backbone of the CIMI classification algorithm was developed using the \"keyword and coordinates\" method according to the standard. The best representative keyword (Figure 2a) was set for each type and was unique to the classified  
Figure 1: Flowchart of the overall classification and itemization medical image (CIMI) system; (**a**) PFT sheet classification systems; (**b**) PFT sheet preprocessing and PFT text extraction system; (**c**) PFT excel generation system. type, so that the word does not overlap with other types' keywords. After this keyword was set, the coordinates (Figure 2b,c) of this keyword were extracted by dragging the keyword's location with CIMI's mouse handler. Next, any random images that are input were classified according to the \"keywords and coordinates\". As long as this keyword's coordinates match, incoming image results were classified as the same type. The practical implementation results of this first function are shown in Section 4. The data extractor functional process is shown in Figure 3. The first step of this functional algorithm is to extract images and coordinate values from the original PFT test sheets (Figure 3a). Next, the CIMI machine learning algorithm processes images into text (Figure 3b) and inputs the text into the newly created database according to column and row (Figure 3c,d, in this case as Excel). Finally, the steps are repeated from a to d until all data in the sheet are extracted. Although Tesseract is a widely used solution with high accuracy, it was found that its accuracy further increases when pre-processed. There are several pre-processing methods such as de-noise, thresholding, dilate, erode, open, canny, and deskew. The CIMI AI's unique algorithm based on Tesseract technology was modified to maximize reading accuracy. Several methods were selectively converged in this proposed research to provide the best outcome optimized for PFT results sheets. Mainly, CIMI converged the gray scale method and rescale method. The proposed original pre-processing algorithm is shown in Figure 4. First, the original image was resized to twice the original size, and then, it was gray-scaled. Originally developed whitelists were applied per field, considering the characteristics of PFT that its test results normally do not contain special characters and mostly contain only alphabet characters. The related performance results will be further discussed in the results and discussion section. Figure 2: Keyword and coordinates; (**a**) the best representative keyword; (**b**) x coordinate values at the beginning and end of the keyword; (**c**) y coordinate values at the beginning and end of the keyword. The PFT image big data (sheets) are very dynamic in the sense that these data vary in types even if it is the same prescription. Additionally, PFT results contain numerous data (texts) per sheet. Therefore, an algorithm that automatically classifies and extracts big data texts within the big data sheets is essential. However, the speed of processing image data is much slower than the speed of processing text data. This issue is especially important in the case of processing PFT test results, because by nature, PFT test result sheets are numerous image files that take up a large memory space. Moreover, OCR itself takes a lot of central processing units (CPUs), memory, and disk space [31]; therefore, it is very important to use CPU parallel computing technology in order to maximize processing speed.