# Deep Learning-Based Flap Detection System Using Thermographic Images in Plastic Surgery
## 2 Materials and Methods
### Data Collection  
In order to obtain a comprehensive dataset, thermographic photography was performed at each stage of the surgical procedure. Thus, preoperative thermographic photography aims to identify the particularities of the area of interest by identifying the vasculature at this level and the presence of a perforating artery (identified thermographically by a small circular area with increased temperature compared to the adjacent area). Intraoperatively, the thermographic camera confirms the cutaneous perfusion of the flap after it has been placed in its new location. However, the purpose of this study is postoperative photography, which is performed according to the type of flap used. Thus, for local or pedicled flaps, photographs were taken at the end of surgery and then every 12 h for 5-7 days. If the patient was discharged during this period, the photographs were taken at the daily subsequent consultation. For free flaps, photographs were taken at the end of surgery and every hour for the first 24 h, then every 4 h for the next 48 h and every 12 h for the next 4-7 days.  
Throughout the duration of the study, the thermographic camera used was a Flir E50, with a resolution of 240 \(\times\) 180 pixels and a thermal sensitivity of less than 0.05 \({}^{\circ}\)C. This manufacturer provides the ability to use multiple color modes of temperature data either through the device's software or a separate application. Furthermore, the software enables the user to modify the color mode of a digital image even after the photograph has been captured. Our device features the following modes: Ironbow, Rainbow, Rainbow High Contrast, and Grayscale. After a period of careful consideration, it was unanimously agreed that the Ironbow mode should be used for all images. Any images that had been created using an alternative mode were subsequently modified to comply with this decision. Thismode provides the optimal results for our intended purpose, offering a more restricted color palette and the potential to develop a more efficient algorithm. To further correlate the data, a portable thermographic camera, Flir One Pro, was used at the same time, but the images obtained from it were not used in the proposed program due to low resolution (160 \(\times\) 120).  
In order to obtain data that can be reproduced and reinterpreted in a clinically relevant manner, it is essential to establish an image acquisition protocol that eliminates the variations that may occur due to environmental factors as much as possible. Because of these reasons, we have implemented a protocol that is inspired by the most recent guidelines released by the International Academy of Clinical Thermology (Thermography Guidelines, Standards and Protocols in Clinical Thermographic Imaging IACT (International Academy of Clinical Thermology), 2018). This protocol includes the following conditions: room with an average temperature of 20-23 degrees Celsius, humidity 60%, resting time 3-5 min to achieve thermodynamic equilibrium, removal of clothing from the analyzed anatomical segment during the resting period (to adapt local circulation), positioning of the thermographic camera at 50-70 cm (depending on the device), etc.