Interface interaction method, device and equipment for image processing model training and medium
Patent Information
- Application Number
- CN202510465576.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2026-10-23
AI Technical Summary
[0005]有鉴于此,本发明实施例提供了图像处理模型训练的界面交互方法、装置、设备及存储介质,用以解决现有技术中模型生成图像的更新与损失函数变化的关联性不直观的问题
[0056]本发明实施例提供的图像处理模型训练的界面交互方法、装置、设备及介质,针对现有技术中训练过程中,模型生成图像的更新与损失函数变化的关联性不直观,影响训练调整的效率的问题,提出了一种更加直观、高效的交互方案,具体而言,练界面包含图像显示窗口和损失函数显示窗口,并且在训练过程中,这两个窗口同步更新:图像显示窗口动态展示模型当前生成的图像,损失函数显示窗口则同步显示损失函数的变化曲线。通过这种直观的可视化方式,用户可以在训练过程中实时观察损失函数下降的同时,对比模型生成图像的质量变化,便于评估训练效果。由于本方案提供了图像和损失函数的同步展示,用户可以更加精准地判断训练参数(如批次大小、训练步数等)是否需要调整。例如,如果损失函数下降但生成图像质量没有明显改善,用户可以及时调整学习率或更换训练数据,提高训练效率,减少不必要的训练迭代。本方案在图像加载界面中提供了底图窗口和目标训练图像窗口,并且明确展示两者的对应关系。用户在训练前可以方便地检查底图和目标训练图像的质量,避免因数据错误影响训练效果,提高训练数据管理的便利性和准确性。
Smart Images

Figure CN122967097A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and more particularly to an interface interaction method, apparatus, device, and medium for training image processing models. Background Technology
[0002] With the development of computer vision technology, image processing models have been widely used in various fields such as print inspection, image restoration, and object recognition. To improve the generalization ability and applicability of these models, extensive training of neural network models is usually required. This training process necessitates high-quality training data, appropriate training parameter configurations, and intuitive training status feedback. Currently, common image processing model training typically relies on writing code or calling existing deep learning frameworks. The parameter adjustment, training status observation, and model output management during training are complex, unintuitive, and require a high level of technical expertise from the user.
[0003] In existing technologies, some deep learning platforms provide visual training interfaces. For example, TensorBoard can be used to view information such as changes in the loss function and network structure. Some commercial software also integrates image training and result visualization functions. However, during the training of neural network models, changes in the loss function are usually used to measure the degree of model optimization, while the images generated by the model directly reflect the training effect.
[0004] However, existing training interfaces often display the loss function curve and the updated training images separately, making it difficult for users to intuitively determine whether the decrease in loss has truly led to an improvement in image quality. If users rely solely on the loss function value for adjustments, they may overlook the actual effect of the model's output, resulting in a deviation in the adjustment direction and affecting the model's final performance. Therefore, in the current training process, the correlation between the update of the model-generated images and the change in the loss function is not intuitive, affecting the efficiency of training adjustments. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide an interactive interface method, apparatus, device, and storage medium for training image processing models, in order to solve the problem that the correlation between the update of the model-generated image and the change of the loss function is not intuitive in the prior art.
[0006] In a first aspect, embodiments of the present invention provide an interface interaction method for training an image processing model, the method comprising:
[0007] In response to an image loading command, a base image and a target training image are loaded and displayed in the base image window and target image window of the image loading interface, respectively. The base image is obtained based on the substrate and includes at least one repeating unit, and the target training image is obtained based on the base image.
[0008] In response to the training start command, a preset neural network model is trained according to the training parameters, the base image, and the target training image. The training parameters include the batch size and the total number of training steps.
[0009] During the training process, the image display window of the training interface dynamically displays the model-generated image output by the preset neural network model for each training session, while the loss function display window of the training interface dynamically displays the loss function value during the training process.
[0010] Once the total number of actual training steps reaches the specified total number of training steps, the trained model is output to the user-specified address in response to the model export command.
[0011] Preferably, the image loading instruction includes a base map loading instruction and a target training image loading instruction. The step of loading and displaying the base map image in the base map window and loading and displaying the target training image in the target image window in response to the image loading instruction includes:
[0012] In response to the base map loading command, the base map image is loaded according to the first address entered by the user and displayed in the base map display window;
[0013] In response to the target image loading command, the target training image is loaded according to the second address input by the user and displayed in the target training image window;
[0014] In response to the completion of loading the base image and the target training image, it is determined whether the image parameters of the base image and the target training image are consistent, wherein the image parameters include at least the image resolution;
[0015] If they match, then based on the image coordinates of the base image and the target training image, alignment guide lines are displayed in the target training image and in the target training image window, respectively.
[0016] In response to user commands to move the base image and / or the target training image, move and align the base image and / or the target training image.
[0017] Preferably, the step of training a preset neural network model in response to a training start command, based on the training parameters, the base image, and the target training image, includes:
[0018] In response to the training start command, a preset sampling window is obtained;
[0019] According to the preset sampling window and the total number of training steps, the base image and the target training image are randomly sampled to obtain training image pairs, wherein the training image pairs include a first sub-image corresponding to the base image and a second sub-image corresponding to the target training image;
[0020] Determine a preset number of noise intensity coefficients based on the preset coefficient range;
[0021] Based on the random noise coefficients and the preset noise type, a preset number of noise matrices are generated;
[0022] The first sub-image or the second sub-image is processed according to the noise matrix to obtain a noisy training image pair;
[0023] The training images are input into a preset neural network model, and the preset neural network model is trained using the training parameters. The output is the model-generated image corresponding to each training image pair.
[0024] Preferably, the image display window includes a window switching label, which includes a background image label, a target training image label, and a real-time sample label. When the real-time sample label is triggered, the image display window includes a first sub-image display area, a second sub-image display area, and a model-generated image display area that are set adjacently. During training, the image display window of the training interface dynamically displays the model-generated image output by the preset neural network model for each training session, and the loss function display window of the training interface dynamically displays the loss function value of the training process, including:
[0025] Based on the batch size and the loss function of the preset neural network model, obtain the loss function value after training for each batch;
[0026] Based on the loss function values output after each batch of training, a line graph of the loss value is dynamically generated and displayed in the loss function display window;
[0027] In response to the triggering of the real-time sample labels, the current training image pairs are displayed in the first sub-image display area and the second sub-image display area, respectively, and the corresponding model-generated image is displayed in the model-generated image display area.
[0028] Preferably, the window switching tab further includes an image fusion tab. After loading and displaying the base image and the target training image in the base image window and the target image window of the image loading interface respectively in response to the image loading instruction, the method further includes:
[0029] In response to the image fusion label being triggered, the base image and the target training image are fused according to a preset transparency or user-input transparency to obtain a fused image;
[0030] The fused image is displayed in the image display window.
[0031] Preferably, the step of training a preset neural network model in response to a training start command, based on the training parameters, the base image, and the target training image, further includes:
[0032] After each batch of training, the model-generated image and the corresponding loss function value corresponding to the preset fixed region on the base image are saved to obtain the generated image sequence and the loss function value sequence.
[0033] Establish a mapping relationship between each model-generated image in the generated image sequence and its corresponding loss function value;
[0034] The generated image sequence is traversed, and several adjacent image pairs are obtained based on the generated image of each model and its adjacent generated images.
[0035] Each adjacent image pair is sampled according to a preset sliding window to form several corresponding first sampling regions and second sampling regions on the model-generated image and its adjacent model-generated image, respectively.
[0036] Calculate the initial structural similarity between each first sampling region and the corresponding second sampling region;
[0037] Based on the local texture complexity of the first sampling region and / or the second sampling region, a weight value for the initial structural similarity is obtained, wherein the weight value is positively correlated with the local texture complexity.
[0038] Based on the weight values, the structural similarity of each adjacent image pair is calculated to obtain a structural similarity sequence.
[0039] Trend analysis is performed on the structural similarity sequence and the loss function value sequence to obtain the rate of change of structural similarity and the rate of decrease of loss function value.
[0040] When the rate of change of structural similarity and the rate of decrease of loss function value meet the preset reminder conditions, the corresponding training parameter adjustment information is displayed on the training interface.
[0041] Preferably, the step of dynamically displaying the model-generated image output by each training session of the preset neural network model in the image display window of the training interface during the training process, and simultaneously dynamically displaying the loss function value of the training process in the loss function display window of the training interface, further includes:
[0042] In response to a user's click on the line chart of the loss value in the loss function display window, the loss function value corresponding to the click operation is obtained and recorded as the loss value to be displayed;
[0043] According to the mapping relationship, adjacent image pairs corresponding to the loss value to be displayed are obtained in the generated image sequence and are respectively denoted as the generated image to be displayed and the adjacent image to be displayed.
[0044] Based on the initial structural similarity, the regions of change between the generated image to be displayed and the adjacent images to be displayed are determined;
[0045] A difference map threshold is determined based on the structural similarity of the adjacent image pairs, wherein the difference map threshold is negatively correlated with the structural similarity;
[0046] Based on the difference map threshold, pixel comparison is performed on the change areas of the image to be displayed and the adjacent images to be displayed to generate a difference highlight image.
[0047] The training interface displays the image to be generated, the adjacent images to be displayed, and the difference-highlighted image in the image display window.
[0048] Secondly, embodiments of the present invention provide an interface interaction device for training an image processing model, the device comprising:
[0049] An image loading module is used to load and display a base image and a target training image in response to an image loading command in a base image window and a target image window of an image loading interface, respectively. The base image is obtained based on a substrate and includes at least one repeating unit, and the target training image is obtained based on the base image.
[0050] The model training module is used to train a preset neural network model in response to a training start command, based on training parameters, the base image, and the target training image. The training parameters include batch size and total number of training steps.
[0051] The training process display module is used to dynamically display the model-generated image output by each training of the preset neural network model in the image display window of the training interface during the training process, and to dynamically display the loss function value of the training process in the loss function display window of the training interface.
[0052] The model export module is used to output the trained model to the user-specified address in response to the model export command after the actual total number of training steps has been reached.
[0053] Thirdly, embodiments of the present invention provide an electronic device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of the first aspect described above.
[0054] Fourthly, embodiments of the present invention provide a storage medium storing computer program instructions, which, when executed by a processor, implement the method of the first aspect described above.
[0055] In summary, the beneficial effects of the present invention are as follows:
[0056] This invention provides an interactive interface method, apparatus, device, and medium for training image processing models. Addressing the problem in existing technologies where the correlation between model-generated image updates and loss function changes during training is not intuitive, affecting the efficiency of training adjustments, this invention proposes a more intuitive and efficient interaction scheme. Specifically, the training interface includes an image display window and a loss function display window, which are updated synchronously during training: the image display window dynamically shows the currently generated images, while the loss function display window synchronously displays the loss function's change curve. Through this intuitive visualization, users can observe the decrease in the loss function in real time during training while comparing the quality changes of the model-generated images, facilitating the evaluation of training effectiveness. Because this scheme provides synchronous display of images and the loss function, users can more accurately determine whether training parameters (such as batch size, training steps, etc.) need adjustment. For example, if the loss function decreases but the quality of the generated images does not improve significantly, users can promptly adjust the learning rate or change the training data to improve training efficiency and reduce unnecessary training iterations. This scheme provides a background image window and a target training image window in the image loading interface, clearly demonstrating their correspondence. Users can easily check the quality of the base image and target training image before training, avoiding the impact of data errors on training results and improving the convenience and accuracy of training data management. Attached Figure Description
[0057] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments of the present invention will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, and these are all within the protection scope of the present invention.
[0058] Figure 1 This is a flowchart illustrating an interface interaction method for training an image processing model according to an embodiment of the present invention.
[0059] Figure 2 This is a schematic diagram of the image loading interface according to an embodiment of the present invention.
[0060] Figure 3 This is a schematic diagram of the training interface in an embodiment of the present invention.
[0061] Figure 4This is a schematic diagram of the structure of an interface interaction device for training an image processing model according to an embodiment of the present invention.
[0062] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0063] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present invention and are not configured to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present invention by illustrating examples of the invention.
[0064] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0065] It should be noted that all actions involving the acquisition of signals, information, or data in this invention are carried out in compliance with the relevant data protection laws and regulations of the locality and with authorization from the owner of the relevant device.
[0066] Example 1
[0067] Please see Figure 1 This invention provides an interface interaction method for training an image processing model, the method comprising:
[0068] S1. In response to an image loading instruction, a base image is loaded and displayed in the base image window, and a target training image is loaded and displayed in the target image window, wherein the base image is acquired based on the substrate and includes at least one repeating unit, and the target training image is acquired based on the base image;
[0069] After the user selects and loads an image, the interface will display the corresponding image in both the base image window and the target training image window. Please refer to [link / reference]. Figure 2 , Figure 2 This is a schematic diagram of the image loading interface, with the base image on the left and the target training image on the right.
[0070] The base image originates from the substrate (such as jacquard fabric, embroidery, leather, etc.), whose surface can accurately reproduce the pattern through printing processes, while also adapting to the material's weave to avoid registration errors. Base images are acquired through methods including scanning, digital design, template library access, 3D reconstruction, image sensor acquisition, AI generation, and color separation processing.
[0071] The target training image is generated based on the base image. A human operator uses specialized software to precisely outline the contours based on material texture features (such as jacquard weft and embroidery stitch direction, leather texture, etc.), optimizes edges using anti-aliasing, and fills in textures according to material characteristics, such as gradient mapping for jacquard fabric, stitch matching for embroidery, and biomimetic pore generation for leather. Simultaneously, broken or blurred areas are manually repaired to ensure integrity. Finally, the target training image maintains the same pixel size as the base image to ensure accurate correspondence in subsequent deformation processing and deep learning training.
[0072] In one embodiment, the method further includes the following step before step S1:
[0073] In response to the project creation command, the current project name is obtained and the image loading interface is displayed, wherein the image loading interface includes an adjacent base map window and a target training image window;
[0074] Specifically, when a user creates a new training project, the system first obtains the project name specified by the user and initializes the interface so that the user can load the images required for training.
[0075] S2. In response to the training start command, train the preset neural network model according to the training parameters, the base image, and the target training image;
[0076] Specifically, after the image loading is complete, the training interface is displayed. This training interface includes a menu bar, an image display window, and a loss function display window. The menu bar includes a project window for displaying the project name and a parameter window for displaying and inputting training parameters, including batch size and total training steps. The training interface specifically includes:
[0077] Menu bar: Displays the current project name and allows users to input and adjust training parameters (such as batch size and total training steps). Image display window shows images during the training process. Loss function display window monitors changes in the loss function value in real time, providing an integrated training interface that allows users to configure training parameters, monitor the training process, and observe training results within a single window, improving operational efficiency.
[0078] When a user clicks the "Start Training" button on the training interface, the system will train the preset neural network model using the base map and target training image as training data, based on the training parameters set by the user (such as batch size, total number of training steps, etc.). This ensures that the training process is optimized based on the parameters set by the user, improving the controllability and applicability of the training.
[0079] In one specific embodiment, the training parameters further include: device selection (graphics card), input width of the image, input height and scaling factor, learning rate and save interval, and the parameter window will also display the time for each step, the time used and the time remaining;
[0080] The device selection option allows users to choose the computing device used during training, such as a CPU or GPU. The input image width and height (in pixels) are used to set the size of the image input into the neural network during training. The scaling factor adjusts the scaling ratio of the training data; for example, 1.0 means no scaling, 0.5 means a 50% reduction, and 2.0 means a 2x increase. Randomly scaling the training data improves the model's generalization ability, allowing it to adapt to inputs at different scales. The learning rate controls the step size of parameter updates during model training, usually expressed as a decimal (e.g., 0.001, 0.0001). A larger learning rate can speed up training but may lead to instability, while a smaller learning rate can improve stability but takes longer. The save interval sets how many steps (steps) the training weights are saved during model training for later resuming training or analyzing intermediate results.
[0081] Meanwhile, the training interface not only allows users to input and adjust training parameters, but also dynamically displays time information of the training process so that users can evaluate training progress. The time for each step displays the time required for each training step, usually in seconds (s). The elapsed time is the time the model has run from the start of training to the current moment, usually in minutes or hours.
[0082] S3. During the training process, the image generated by the preset neural network model is dynamically displayed in the image display window of the training interface for each training session, and the loss function value of the training process is dynamically displayed in the loss function display window of the training interface.
[0083] Specifically, during training, the system updates and displays the images generated by the current model in real time, allowing users to intuitively see the model's training progress. Simultaneously, it plots the loss function's change curve in real time, helping users determine whether the model is converging and whether training parameters need adjustment. This provides real-time visual feedback, enabling users to dynamically monitor the training status and adjust training strategies as necessary to improve model training efficiency and final results.
[0084] S4. After the total number of actual training steps reaches the specified total number of training steps, in response to the model export command, the trained model is output to the address specified by the user.
[0085] Finally, when the training steps reach the user-defined maximum number, the system will automatically stop training and allow the user to export the trained model to local storage or the cloud. This ensures the training results are usable and allows users to easily apply the model to real-world tasks such as inference, validation, or further optimization.
[0086] Preferably, the image loading instruction includes a base map loading instruction and a target training image loading instruction. The step of loading and displaying the base map image in the base map window and loading and displaying the target training image in the target image window in response to the image loading instruction includes:
[0087] S11. In response to the base map loading command, load the base map image according to the first address input by the user and display it in the base map display window;
[0088] The basemap loading command is an operation where the user provides a basemap file. The system loads the image based on the first address (local path or remote URL) entered by the user and displays it in the basemap window. The basemap window is the interface area used to present the basemap, allowing the user to intuitively view its contents. The purpose of this step is to ensure that the user can correctly load the basemap, providing a foundation for the subsequent loading and alignment of the target training images. Since basemaps are usually derived from substrates (such as jacquard fabric or printed materials) and contain key texture information, it is necessary to ensure that the basemap can be correctly parsed and rendered to avoid affecting the training process due to loading errors or format mismatches.
[0089] S12. In response to the target image loading instruction, load the target training image according to the second address input by the user and display it in the target training image window;
[0090] The target image loading command is an operation where the user provides a target training image. The system loads the image based on a second address (storage path or remote URL) and displays it in the target training image window. This window is used to present the target training image, allowing the user to check its matching degree with the base image.
[0091] The purpose of this step is to ensure that the user correctly loads the target training image and compares it with the base image. The target training image is generated based on the base image, so both need to maintain the same pixel size and alignment. If the loading is incorrect or the dimensions are mismatched, it may lead to training data mismatch, affecting the model training effect.
[0092] S13. In response to the completion of loading the base image and the target training image, determine whether the image parameters of the base image and the target training image are consistent, wherein the image parameters include at least the image resolution;
[0093] Image parameters are key attributes used to measure the matching degree between the base image and the target training image, including image resolution (width and height), color mode (RGB, grayscale), etc. Resolution consistency is crucial because mismatched resolutions will cause the training data to become misaligned, thus affecting the accuracy of model learning.
[0094] The purpose of this step is to ensure a one-to-one correspondence between the base image and the target training image, thereby guaranteeing the accuracy of subsequent training. If the resolutions are different, even if the two images are essentially matching, pixel-level discrepancies can still lead to model learning errors. Therefore, in this step, the system needs to check whether the resolutions are consistent and provide prompts or automatic adjustments when a mismatch is detected.
[0095] In terms of implementation, after loading two images, the system obtains their resolution information and compares them. If the resolutions match, it proceeds to the next step; if they do not match, the system can provide an automatic scaling function to match the target training image with the base image, or prompt the user to manually adjust it. The beneficial effect is to ensure data consistency, avoid distortion of training results due to size deviations, and improve the quality of training data.
[0096] S14. If they match, then according to the image coordinates of the base image and the target training image, alignment auxiliary lines are displayed in the target training image and in the target training image window respectively;
[0097] Image coordinates refer to the pixel positioning information of an image within the interface, used to ensure that the base image and the target training image are visually correctly aligned. Alignment guidelines are visual aids, typically displayed as grid lines, crosshairs, or reference boxes, helping users intuitively adjust the image position.
[0098] The purpose of this step is to provide an intuitive alignment method, assuming consistent resolution, so that users can confirm the match between the base image and the target training image. Since the target training image is generated based on the base image, even at the same resolution, slight offsets may occur due to manual drawing or filling methods. Therefore, alignment guidelines are needed to assist in the adjustment.
[0099] In implementation, the system calculates the center point and key feature points of the base image and the target training image based on their pixel coordinates, and draws auxiliary alignment lines in the target training image window. For example, a crosshair running through the center of the image can be drawn, or key reference points can be displayed in a grid. Users can adjust the position of the target training image according to these auxiliary lines to achieve the best alignment effect. The benefits include improving image matching accuracy, reducing errors from manual adjustments, and improving the accuracy of training data.
[0100] See Figure 2 , Figure 2 This includes the base image on the left and the target training image on the right, as well as reference lines displayed on both images;
[0101] S15. In response to the user's movement command on the base image and / or target training image, move and align the base image and / or target training image.
[0102] The movement command allows users to adjust the image position by dragging with the mouse, using the keyboard arrow keys, or entering specific values. This step allows users to precisely adjust the position of the base image or target training image with the guidance of alignment guidelines to ensure perfect alignment.
[0103] The purpose of this step is to provide manual fine-tuning capabilities to ensure that key feature points in the target training image are aligned with the corresponding regions in the base image. Although the previous step provided guide lines, slight offsets may exist between the base image and the target training image due to different generation methods, so manual adjustment by the user is still required to ensure optimal matching.
[0104] Preferably, if the base image comprises a plurality of repeating units uniformly distributed along the image width, the method further includes, before training the preset neural network model according to the training parameters, the base image, and the target training image in response to the training start command:
[0105] S02. In response to the image vertical copying instruction, the base image and the target training image are copied at least twice to obtain a first copied image and a second copied image;
[0106] In image processing, the vertical image copy command is used to copy and stitch images along the vertical direction (usually the Y-axis) to expand the visual range and enrich the training data. The base image typically originates from a substrate (such as jacquard fabric, printed materials, etc.). In this embodiment, the base image contains multiple repeating units evenly distributed along the image width; these units are patterns or structures that appear periodically on the substrate. The target training image is labeled data obtained based on the base image for deep learning training. The purpose of this step is to copy the base image and the target training image vertically, ensuring that the repeating units maintain regularity in the width direction while also forming continuous training data in the vertical direction, thereby improving the model's ability to learn the overall pattern.
[0107] S03. Obtain image copying parameters based on the image coordinates of the base image, wherein the image copying parameters include the target copying positions of the first copying image and the second copying image;
[0108] In the image duplication process, properly arranging the stitching position of the copied images is crucial. Image coordinates refer to the position of an image in two-dimensional space, usually represented by pixel coordinates (x, y). Image duplication parameters include the placement of the copied images, stitching offset, and alignment of repeating units, to ensure that the stitched image maintains its regularity.
[0109] The purpose of this step is to determine the target copy positions of the first and second copied images within the base image and the target training image, thereby ensuring that the stitched images are correctly aligned without misalignment, breakage, or unevenness. Since the base image already has multiple repeating units evenly distributed along its width, the size information of these units can be used when calculating the copy parameters. For example, if the base image contains N repeating units along its width, each unit having a width of W, the system can calculate the starting coordinates for stitching the copied images in the vertical direction based on W, ensuring that the stitched images maintain a complete repeating pattern.
[0110] This step allows for precise control over image copying and stitching, ensuring visual consistency between the final base image and the target training image. This facilitates the deep learning model's ability to fully utilize the characteristics of repeating units during training, enhancing its learning capacity for complex background textures. Simultaneously, this method reduces stitching errors, ensuring the quality of the model's training data and improving the accuracy of final recognition and matching.
[0111] S04. According to the target replication parameters, the first replicated image and the second replicated image are stitched together to the base image and the target training image to obtain a new base image and target training image.
[0112] After calculating the target position of the copied images, the next step is to stitch the first and second copied images onto the base image and the target training image to form complete training data. Stitching refers to combining multiple images into a new overall image at predetermined positions, ensuring that it maintains visual continuity and consistency.
[0113] The purpose of this step is to perform a stitching operation based on the previously calculated target replication parameters, ensuring that the replicated image seamlessly merges with the original image. Both the base image and the target training image adhere to the same replication parameters; that is, their replication count, replication method, and stitching position are completely identical. This ensures that the base image and the target training image maintain a one-to-one correspondence throughout the expansion process, preventing training data distortion due to misalignment or scale differences.
[0114] Preferably, obtaining the image copying parameters based on the image coordinates of the base image includes:
[0115] S031. According to the preset image processing algorithm, obtain the maximum inline matrix of the base image, denoted as the base image inline matrix;
[0116] The base image may contain transparent areas, invalid edges, or non-textured areas. Therefore, it is necessary to determine an optimal effective area for copying and stitching. The maximum inscribed matrix refers to the largest contiguous area in the base image that can be used for stitching. This area should avoid transparent or invalid pixels to ensure that unnecessary blank spaces or distortions do not occur during subsequent copying and stitching.
[0117] In practical implementation, algorithms such as edge detection, color thresholding, or transparency judgment can be used to automatically identify the effective area of the base image. For example, if there are non-texture edges in the base image, the largest rectangular region can be found by scanning the four directions of the image, where all pixels satisfy certain color or transparency threshold conditions, thereby determining the position and size of the largest inscribed matrix.
[0118] This step ensures that the copied area contains only the actual and valid image content, reduces interference from invalid information, improves the accuracy of stitching, and ensures that the input data during subsequent training is more standardized.
[0119] S032. Obtain image coordinates based on the inscribed matrix of the base map, wherein the image coordinates include the top boundary coordinates of the inscribed matrix of the base map;
[0120] After determining the maximum inscribed matrix, it is necessary to further extract the image coordinate information of the matrix, especially the coordinates of the top boundary. These top boundary coordinates are used to determine the stitching start point of the copied image to ensure the vertical alignment of the newly generated image.
[0121] One method for obtaining the top boundary coordinates is based on matrix scanning, which involves starting from the top of the matrix and recording the position of the first valid pixel. For example, assuming the top-left corner of the largest inscribed matrix is (x1, y1), then y1 is the top boundary coordinate. Based on this, the position of the next image to be stitched can be derived, ensuring it fits closely below this boundary.
[0122] The significance of this step is to ensure that the copied images are stitched together in the vertical direction with the optimal alignment, avoiding discontinuities or misalignments, and improving the visual consistency of the final stitched image and the quality of the training data.
[0123] S033. Determine the target copying position of the first copied image based on the top boundary coordinates;
[0124] After obtaining the top boundary coordinates of the inscribed matrix of the base image, the next step is to calculate the pasting position of the first copied image. The target position of the first copied image should be close to the top of the inscribed matrix of the base image to ensure the continuity of the stitching.
[0125] The specific calculation method involves translating the original base image vertically by a fixed distance, for example, by a translation of H (base image height), so that its top edge aligns with the top boundary of the base image. Assuming the top boundary coordinates are y1, the target position of the first copied image can be represented as (x1, y1-H), ensuring that its bottom edge is flush with the top boundary of the original base image.
[0126] The purpose of this step is to provide an initial stitching position for the images, allowing them to be arranged according to rules, reducing the need for manual adjustments, and ensuring a more uniform overall visual effect after stitching.
[0127] S034. Determine the bottom boundary coordinates of the first copied image based on the target copying position of the first copied image;
[0128] After pasting the first copied image to the target location, its bottom boundary coordinates need to be determined in order to further calculate the stitching position for the next step. The bottom boundary coordinates are the maximum range of the copied image in the vertical direction, which can be calculated by adding the height H of the base image to the y-coordinate of the target copy location.
[0129] For example, if the top coordinate of the first copied image is y1-H, then its bottom boundary coordinates are (x1, y1). In this case, this coordinate point will be used to determine the stitching start position of the second copied image to ensure that the image can continue to be copied continuously in the vertical direction.
[0130] The purpose of this step is to provide crucial coordinate information for subsequent stitching steps, ensuring that the copied images are arranged sequentially according to rules, thus guaranteeing the integrity and uniformity of the stitching and avoiding irregular stitching problems caused by manual adjustments.
[0131] S035. Determine the target copying position of the second copied image based on the bottom boundary coordinates.
[0132] After obtaining the bottom boundary coordinates of the first copied image, the target position of the second copied image needs to be immediately below it in order to continue stitching more copied images in the vertical direction. The calculation method is similar to that of the first copied image, that is, based on the bottom boundary coordinates (x1, y1) of the first copied image, it is shifted down by H so that the top of the second copied image is aligned with the bottom of the first copied image. The target position can be represented as (x1, y1 + H).
[0133] In step S035, regarding the target copying position of the second copied image, in addition to simply splicing according to a fixed spacing H, an optimal alignment strategy can also be adopted, that is, determining the best pasting position y based on transparent pixel detection and vertical distance minimization algorithm, so that the visual transition of the splicing area is the most natural.
[0134] Specifically, let the bottom boundary coordinate of the first copied image be y1, and the y-coordinate of its lower edge pixel at each horizontal coordinate x be y1. A (x); The top boundary coordinate of the second copied image is y2, and the y-coordinate of its upper edge pixel at each horizontal coordinate x is y2. B (x). To find the optimal pasting position y, it is necessary to traverse all possible y values (i.e., y2∈(0,H]) and calculate the vertical distance dx between the lower edge pixel of the first copied image and the upper edge pixel of the second copied image at all x positions. Then, sum over all x to obtain the stitching error value at the current y value. Among all possible y positions, the y value with the smallest Dy(y) is taken as the final optimal y coordinate to ensure that the texture alignment error at the stitching point is minimized, making the transition at the stitching point as natural as possible.
[0135] Preferably, the image display window includes a window switching tab, which includes a background image tab, a target training image tab, and a real-time sample tab. The step of training a preset neural network model in response to a training start command, based on the training parameters, the background image, and the target training image, includes:
[0136] S21. In response to the training start command, obtain the preset sampling window;
[0137] A sampling window refers to the size of the region used to extract a sub-image from the original image (base image and target training image). The size of the sampling window is usually determined by the needs of the training task. For example, a larger sampling window can be used for high-resolution base images and target training images, while a smaller sampling window can be used for low-resolution images or images with complex local features to ensure that the model can learn key features.
[0138] S22. According to the preset sampling window and the total number of training steps, randomly sample the base image and the target training image to obtain training image pairs, wherein the training image pairs include a first sub-image corresponding to the base image and a second sub-image corresponding to the target training image.
[0139] The training image pair consists of two sub-images: one from the base image (first sub-image) and the other from the target training image (second sub-image), ensuring a one-to-one pixel correspondence. Random sampling aims to enhance the diversity of the training data, enabling the model to generalize more effectively. At each training iteration, a sampling starting point is randomly selected, and sub-image pairs of the same size are extracted from both the base image and the target training image. To avoid the training data becoming overly concentrated in certain areas, sampling points can be evenly distributed across the entire range of both the base image and the target training image, ensuring the training data covers diverse textures, colors, and morphological features. As training progresses, the sampling strategy can be gradually modified, for example, by increasing the sampling weights for regions with complex textures, allowing the model to learn key features more quickly.
[0140] S23. Determine the preset number of noise intensity coefficients based on the preset coefficient range;
[0141] The noise intensity coefficient is used to control the magnitude of added noise. Different noise intensities can simulate different environmental changes, such as uneven lighting, texture interference, and printing errors, making the model more robust to interference during training. Based on experimental experience or data analysis, upper and lower limits for the noise intensity are defined. For example, setting the noise intensity coefficient between 0.1 and 0.5 ensures that the noise is neither too weak to be meaningless nor too strong to destroy the original image features. During training, a noise intensity coefficient is randomly generated for each training image pair, making the noise effect different in each training iteration and improving the model's robustness. The noise intensity can be dynamically adjusted in conjunction with changes in training loss. For example, a lower noise intensity can be applied in the early stages of training, allowing the model to learn basic features first, and then the noise intensity can be gradually increased to improve the model's adaptability. Through reasonable noise intensity control, the model can learn stronger anti-interference capabilities and improve its adaptability to real-world application scenarios.
[0142] S24. Generate a preset number of noise matrices based on the random noise coefficients and preset noise types;
[0143] The noise matrix is a matrix of the same size as the training images, where each pixel value represents the perturbation value of the corresponding image pixel. Different types of noise can simulate different environmental disturbances, such as printing defects, lighting variations, and uneven material textures. Common noise types include Gaussian noise, used to simulate camera sensor noise or random errors in the material itself; salt-and-pepper noise, used to simulate local defects or blemishes in the printing process; and Poisson noise, used to simulate exposure differences caused by uneven lighting. By enhancing training with different types of noise, the model becomes more adaptable to different noise environments, improving its robustness and generalization ability.
[0144] S25. Process the first sub-image or the second sub-image according to the noise matrix to obtain a training image pair with added noise;
[0145] The purpose of this step is to enhance the noise to make the training data closer to the real scene and prevent the model from overfitting the idealized training data.
[0146] S26. Input the training image pairs into a preset neural network model, train the preset neural network model in combination with the training parameters, and output the model-generated image corresponding to each training image pair.
[0147] This step is the core of the entire training process. The preprocessed training images are input into the neural network, and through multiple rounds of iterative optimization, the model learns the mapping relationship from the base image to the target training image. Through a reasonable training strategy, the model can learn high-quality image transformation capabilities, improving the final model performance.
[0148] Preferably, during the training process, dynamically displaying the model-generated image output by each training session of the preset neural network model in the image display window of the training interface, and simultaneously dynamically displaying the loss function value during the training process in the loss function display window of the training interface, includes:
[0149] S31. Obtain the loss function value after training each batch based on the batch size and the loss function of the preset neural network model;
[0150] In deep learning training, a loss function is used to measure the error between the current model output and the target result. After each training batch, the loss value of the current batch is calculated to evaluate the model's learning performance. The error value of the current batch is calculated using a preset loss function (such as Mean Squared Error (MSE), Perceptual Loss, GAN Loss, etc.). By monitoring the loss value in real time, it is possible to intuitively understand whether the training process is stable and whether the model is experiencing oscillations or overfitting.
[0151] S32. Based on the loss function values output after each batch of training, dynamically generate a line graph of the loss value and display it in the loss function display window;
[0152] Loss line graphs are used to visually represent the model's optimization process, helping researchers determine whether the model has converged and whether the training strategy needs adjustment. Dynamic line graphs can help quickly identify problems during training, such as inappropriate learning rates, overfitting, or underfitting, thereby optimizing the training strategy.
[0153] S33. In response to the triggering of the real-time sample label, the current training image pair is displayed in the first sub-image display area and the second sub-image display area respectively, and the corresponding model-generated image is displayed in the model-generated image display area.
[0154] The purpose of real-time sample labeling is to allow users to view the current training image pairs (i.e., the base image and the target training image) as well as the images generated by the model during training, so as to monitor the training quality at any time. By viewing the training samples and model-generated results in real time, the learning progress of the model can be intuitively evaluated, and parameters can be quickly adjusted to optimize the training effect.
[0155] like Figure 3 As shown, when the real-time sample label is triggered, the image display window in the training interface will dynamically display the image data of the current training batch. From left to right, the image display window consists of the first sub-image display area, the second sub-image display area, and the model-generated image display area. The first sub-image display area displays a sub-image of the base image (the first sub-image), which is a local region randomly cropped from the original base image. The second sub-image display area displays a sub-image of the target training image (the second sub-image), which is the corresponding region cropped from the target training image. The model-generated image display area displays the images generated by the model in the current training batch, used for intuitive evaluation of the training effect.
[0156] The image display window helps users visually monitor the relationship between input, target, and output during training, ensuring that the model's learning performance meets expectations. Combined with the loss function display window below, users can adjust training parameters in real time to optimize the generated quality.
[0157] In the diagram, the loss function display window is located at the bottom of the training interface and dynamically displays the loss function value for each batch during training. This window is primarily used to monitor the model's optimization process and help users assess the training status. During training, the loss value is calculated for each batch and plotted as a line graph in the window. As training progresses, the trend of the loss value can intuitively reflect the model's learning performance.
[0158] The line graph in the window uses different colors to represent different loss terms, making it easier to distinguish the contribution of each loss term to the training process.
[0159] The loss function display window includes a total loss label and several sub-loss item labels. When the total loss label is triggered, the total loss value of the current training batch is displayed in this window, reflecting the overall error of the model. Each sub-loss item label corresponds to a specific loss function (such as MSE loss, perceptual loss, adversarial loss, etc.). By observing the changing trends of different sub-losses, it is possible to analyze which part of the loss dominates the training and whether the loss weights need to be adjusted.
[0160] The loss function display window can intuitively present the training effect of the model. Users can analyze the training status through loss curves of different colors, judge whether the model is stable, whether there are oscillations, overfitting or slow convergence, and thus optimize the training strategy.
[0161] Preferably, the window switching tab further includes an image fusion tab. After loading and displaying the base image and the target training image in the base image window and the target image window of the image loading interface respectively in response to the image loading instruction, the method further includes:
[0162] S05. In response to the image fusion label being triggered, perform image fusion on the base image and the target training image according to the preset transparency or the user input transparency to obtain a fused image;
[0163] Specifically, image fusion is a technique that combines multiple images into a new image, often used to enhance visual effects or for comparative analysis. In this method, the base image and the target training image are overlaid with varying transparency to allow users to more intuitively observe the degree of matching between them. The fused image visually demonstrates the overlap between the base image and the target training image, helping to identify discrepancies, improve alignment accuracy, and optimize the training data preparation process.
[0164] S06. Display the fused image in the image display window.
[0165] Specifically, the merged image is dynamically displayed on the interface, allowing users to observe the image matching in real time and adjust the transparency or alignment as needed.
[0166] In one embodiment, the step of training a preset neural network model in response to a training start command, based on the training parameters, the base image, and the target training image, further includes:
[0167] S021. After each batch of training, the model-generated image and the corresponding loss function value corresponding to the preset fixed region on the base image are saved to obtain the generated image sequence and the loss function value sequence.
[0168] Specifically, in this step, "preset fixed region" refers to an image region with a fixed size and coordinates set at a specific location in the base image, either manually selected or predefined by the system, before training begins. For example, a fixed window region of 5×5 is continuously divided in the center or edge of the base image. "Model-generated image" refers to the output image generated by the neural network model based on the input sub-image after a certain number of training steps, such as a repaired image or a predicted image.
[0169] The purpose of this step is to ensure that the saved model-generated image sequence has spatial consistency, that is, it always corresponds to the same fixed region on the base map, so that the learning evolution process of the model at the same position can be continuously and comparatively observed, and the inconsistency of image position caused by random sampling can be prevented from affecting the accuracy of comparison.
[0170] In practical implementation, after each batch of training is completed, the base image and the target training image can be cropped based on a fixed sampling window to obtain the model output of that fixed region under the current batch of training, while simultaneously recording the loss function value of the corresponding batch of training. By orderly saving the fixed region images generated by different batches, a sequence of generated images is formed, and the loss function value of each batch is saved simultaneously to form a sequence of loss function values.
[0171] The beneficial effect of this step is that by using a fixed-region sampling method, the generated image sequence remains consistent in spatial location, which effectively improves the accuracy and comparability of subsequent trend analysis, difference detection, and dynamic image playback, and avoids analysis bias caused by different sampling locations.
[0172] S022. Establish a mapping relationship between each model-generated image in the generated image sequence and its corresponding loss function value;
[0173] In this step, "mapping relationship" refers to the one-to-one correspondence between the generated images and the corresponding loss function values. This can be achieved by using hash tables, dictionaries, or index arrays to ensure that the training error metric corresponding to each generated image can be quickly found.
[0174] The purpose of this step is to build an efficient data association structure, enabling rapid location of corresponding data using any generated image or a specific loss function value. This supports interactive operations such as click-to-query, trend analysis, and difference detection within the user interface. This step allows for rapid location of generated images and loss function values, improving the efficiency and accuracy of subsequent training progress visualization, dynamic interactive experience, and trend judgment.
[0175] S023. Traverse the generated image sequence and generate an image based on each model and its adjacent model to obtain several adjacent image pairs.
[0176] In this step, an adjacent image pair refers to a pair of generated images corresponding to two adjacent save times (or training steps) in the generated image sequence. It is used as a unit of image comparison to observe the changes in the model's output during adjacent training phases.
[0177] The purpose of this step is to group the changes in model output during continuous training into local units, facilitating subsequent similarity calculations, trend analysis, and difference highlighting detection. This allows for finer-grained tracking of model training dynamics. Specifically, the generated image sequence is sequentially traversed, forming adjacent image pairs from the i-th image to the (i+1)-th image, and so on, forming multiple image pairs. The data structure of each image pair can contain the indices of the two images, file paths, or direct memory data. Through this step, the changes in model output during continuous training can be refined into processable image pairs, providing basic data units for subsequent local similarity analysis and fine-grained training trend awareness.
[0178] S024. Each adjacent image pair is sampled according to a preset sliding window to form several corresponding first sampling regions and second sampling regions on the model-generated image and its adjacent model-generated image, respectively.
[0179] In this step, the preset sliding window refers to an operation method that uses a fixed-size window to slide across the image in fixed steps (such as 1 pixel or 2 pixels) to crop local regions. Each sliding window crops a pair of small regions from two images, called the first sampling region and the second sampling region, respectively. This divides the entire adjacent image pair into multiple local sub-regions, allowing for the evaluation of image changes at a local scale and the extraction of more detailed and accurate local structural change information, thereby avoiding the problem of neglecting local details caused by measuring changes in the entire image.
[0180] S025. Calculate the initial structural similarity between each first sampling region and the corresponding second sampling region;
[0181] Specifically, the initial structural similarity refers to the similarity score of local regions calculated by applying structural similarity to the first sampled region and the corresponding second sampled region. The score typically ranges from 0 to 1, where 1 indicates complete similarity and 0 indicates complete dissimilarity. By calculating local structural similarity, the structural consistency of adjacent image pairs in small local regions is measured, thereby revealing the fine-grained variation trend of the model in specific local regions during training.
[0182] S026. Based on the local texture complexity of the first sampling region and / or the second sampling region, obtain the weight value of the initial structural similarity, wherein the weight value is positively correlated with the local texture complexity;
[0183] In this step, "local texture complexity" refers to the richness of detail or structural complexity of a local image region, which can usually be measured by indicators such as local gradient magnitude, local variance, and number of edges. For example, regions with rich detail (such as text or edge regions) have high texture complexity, while regions with smooth backgrounds (such as large areas of solid color blocks) have low texture complexity.
[0184] The purpose of this step is to adjust the weight of local structural similarity in the overall similarity calculation based on the texture complexity of local regions. Since complex regions typically contain more learnable and effective features, changes in their similarity more accurately reflect training performance. Giving them higher weights enhances the sensitivity of the overall similarity to changes in effective regions. First, a local texture complexity metric (such as local variance or Sobel edge magnitude) can be calculated for each first and / or second sampling region. Then, the corresponding weight value is mapped based on texture complexity normalization, ensuring that higher local texture complexity corresponds to a larger weight value, and lower local texture complexity to a smaller weight value. These weight values are then used to weight the initial structural similarity. This step allows the overall structural similarity evaluation to be more biased towards regions with rich texture and high information content, avoiding smooth regions dominating similarity evaluation and improving the realism and sensitivity of training change trend detection.
[0185] S027. Calculate the structural similarity of each adjacent image pair based on the weight values to obtain a structural similarity sequence;
[0186] Specifically, this step combines the weights obtained from the initial local structural similarity and local texture complexity to obtain an overall structural similarity index that reflects the actual training changes, thus forming a continuous training evolution curve for subsequent trend analysis. The structural similarity sequence refers to the ordered set of weighted structural similarity values calculated for each pair of adjacent generated images arranged in order of training steps, used to describe the trajectory of the overall structural changes in the output images during model training. For each pair of adjacent images, a weighted average of the initial structural similarity of all first and second sampling regions can be calculated, with the weights corresponding to the local texture complexity. The weighted result is the overall structural similarity value of that adjacent image pair. The structural similarities of all adjacent image pairs are arranged sequentially to form a structural similarity sequence.
[0187] This step allows for the acquisition of more discriminative training evolution data, particularly improving the detection performance in regions sensitive to changes in local features, avoiding the dominance of smoothed-out invalid regions in similarity assessment, and ultimately enhancing the accuracy and granularity of training state monitoring.
[0188] S028. Perform trend analysis based on the structural similarity sequence and the loss function value sequence to obtain the rate of change of structural similarity and the rate of decrease of loss function value;
[0189] Specifically, the rate of change of structural similarity refers to the average change in structural similarity within a unit number of steps, which is usually calculated by averaging the differences of continuous structural similarity values; the rate of decrease of loss function value refers to the average decrease of loss function value within a unit number of steps, which is used to measure the convergence speed of the training target.
[0190] The purpose of this step is to use trend analysis to determine the rate of change of the model's output image and the rate of decrease of the training error during the training process, so as to keep track of the training progress in real time and dynamically detect stagnation, overfitting or abnormal convergence during the training process.
[0191] In the implementation process, a sliding window differencing can be performed on the structural similarity sequence to obtain the local rate of change. Similarly, the same sliding window is used to calculate the rate of decrease on the loss function value sequence. The rate curve can be further smoothed to remove random fluctuations and improve the stability of trend judgment. Through trend analysis, real-time monitoring of training dynamics can be achieved. When training changes slow down or convergence is abnormal, the system can quickly detect and respond, improving the controllability of the training process and the final effect of model training.
[0192] S029. When the rate of change of the structural similarity and the rate of decrease of the loss function value meet the preset reminder conditions, the corresponding training parameter adjustment information is displayed on the training interface.
[0193] In this step, the "preset reminder conditions" refer to rate threshold judgment criteria set based on experience or experiments. For example, if the rate of change in structural similarity is less than 0.01 and the rate of decrease in the loss function is less than 0.001, it is determined that the training progress is slowing down. "Training parameter adjustment information" refers to suggestions that allow users to adjust training parameters, such as reducing the learning rate, decreasing the batch size, or modifying the loss function. The purpose of this step is to promptly remind users and provide targeted training adjustment suggestions when training progress stagnates or becomes abnormal, avoiding prolonged ineffective training and improving the efficiency of training resource utilization and model performance.
[0194] During implementation, the rate of change in structural similarity and the rate of loss decrease can be compared with set thresholds. When both meet the alert conditions, the interface prompt module is triggered, displaying a message box or highlighting a warning area on the training interface, listing suggested training parameter adjustment options. Users can manually select the adjustment operation based on the prompts, or enable the automatic adjustment mode.
[0195] This step enables dynamic adaptive control during the training process, significantly improving training efficiency, avoiding resource waste or model performance degradation, and enhancing the system's intelligence level.
[0196] In one specific embodiment, step S029 includes:
[0197] No alert will be issued when the rate of change of structural similarity exceeds the first preset threshold and the rate of decrease of loss function exceeds the second preset threshold;
[0198] When the rate of change of structural similarity is greater than the first preset threshold and the rate of decrease of loss function is less than or equal to the second preset threshold, the user is prompted to reduce the learning rate.
[0199] When the rate of change of structural similarity is less than or equal to the first preset threshold, and the rate of decrease of loss function is greater than the second preset threshold, the user is prompted to adjust the design of loss function or add regularization terms.
[0200] When the rate of change of structural similarity is less than or equal to the first preset threshold, and the rate of decrease of loss function is less than or equal to the second preset threshold, the user is prompted to reduce the learning rate or the batch size, or to save the current model and terminate training.
[0201] Specifically, during the training process, in order to monitor the training progress in real time and adjust the training parameters as needed, the system performs dynamic trend analysis based on the rate of change of structural similarity and the rate of decrease of loss function, and determines whether to generate training parameter adjustment prompts based on preset judgment conditions.
[0202] Specifically, a first preset threshold and a second preset threshold are first set to determine the magnitude of the rate of change of structural similarity and the rate of decrease of the loss function, respectively. When the rate of change of structural similarity is greater than the first preset threshold and the rate of decrease of the loss function is greater than the second preset threshold, it indicates that the model output image is still changing and the training error is decreasing, and the training is in a normal convergence state. At this time, no parameter adjustment reminders are given, and training is allowed to continue.
[0203] When the rate of change of structural similarity exceeds a first preset threshold, while the rate of decrease of the loss function is less than or equal to a second preset threshold, it indicates that the model's output image is still improving, but the rate of decrease in training error has slowed down, potentially leading to a situation close to a local optimum. To promote more refined parameter updates and convergence, the system will prompt the user to reduce the current learning rate, thereby improving the precision of training.
[0204] If the rate of change of structural similarity is less than or equal to the first preset threshold, and the rate of decrease of the loss function is greater than the second preset threshold, it indicates that the training error is still decreasing rapidly, but the structural changes in the model's output image are slowing down. This may indicate a tendency to overfit the optimization objective while ignoring the actual output quality. In this case, the system will prompt the user to adjust the loss function, such as introducing perceptual loss, adversarial loss, or adding a regularization term, to guide the model to focus more on the actual quality of the output image rather than simply pursuing numerical convergence.
[0205] Finally, when both the rate of change in structural similarity and the rate of decrease in the loss function are less than or equal to their respective preset thresholds, it indicates that training has entered a stagnant phase. The changes in the model's output image slow down, and the decrease in training error also slows down, making further training less effective. Therefore, the system will prompt the user to take measures, including reducing the learning rate, reducing the batch size to introduce more random perturbations, or saving the current model based on the training results and choosing to terminate training, to avoid wasting resources.
[0206] Through the above dynamic monitoring and judgment, adjustment suggestions can be intelligently generated based on the training progress status, which can significantly improve training efficiency and model quality, and enhance the intelligence and adaptability of the training process.
[0207] In one embodiment, the step of dynamically displaying the model-generated image output by each training session of the preset neural network model in the image display window of the training interface during the training process, and simultaneously dynamically displaying the loss function value of the training process in the loss function display window of the training interface, further includes:
[0208] S031. In response to the user's click operation on the line chart of the loss value in the loss function display window, obtain the loss function value corresponding to the click operation and record it as the loss value to be displayed;
[0209] Specifically, when a user clicks on a point in the line chart, it indicates that they want to view the training status corresponding to that training step. The system can capture the user's click coordinates within the loss function display window, map these coordinates to the corresponding training step number in the line chart, and then extract the loss function value corresponding to that step, marking it as the loss value to be displayed. This loss value to be displayed serves as the basis for subsequent image retrieval and change analysis.
[0210] S032. According to the mapping relationship, obtain the adjacent image pair corresponding to the loss value to be displayed in the generated image sequence, and denot them as the generated image to be displayed and the adjacent image to be displayed, respectively.
[0211] Based on the loss value to be displayed, the corresponding training output image is quickly extracted, and this image is paired with its temporally adjacent generated image to form a neighboring image pair, providing basic data for subsequent local change detection. The mapping table is consulted based on the loss value to be displayed to obtain the corresponding generated image, and its temporally adjacent generated image is located, forming a pair of (generated image to be displayed, neighboring image to be displayed). These two images serve as input for subsequent change detection. Through this step, the corresponding model output state can be quickly restored based on the user-selected training node, providing accurate evidence for dynamic graph evolution analysis and difference detection.
[0212] S033. Based on the initial structural similarity, determine the variation regions of the generated image to be displayed and the adjacent images to be displayed;
[0213] Specifically, the initial structural similarity refers to the similarity index between two images, calculated through structural similarity measurement (step S025), in terms of overall or local similarity. This index is used to assess the structural consistency or changes between the two images. Based on structural similarity analysis, the regions where changes occur between the generated image to be displayed and its adjacent images are extracted. This avoids misclassifying unchanged regions as training evolution features and improves the accuracy of subsequent difference analysis.
[0214] S034. Determine a difference map threshold based on the structural similarity of the adjacent image pairs, wherein the difference map threshold is negatively correlated with the structural similarity;
[0215] In this step, the difference map threshold refers to the criterion used to determine whether the differences between two images are significant at the pixel level. It is used to filter out changed areas when generating the difference highlight map. Based on the overall structural similarity of the two images, the sensitivity of the difference detection is adaptively adjusted to ensure that the detection sensitivity is improved when the similarity is high, and to avoid excessive highlighting of noise when the similarity is low, thereby improving the practicality and readability of the difference highlight map.
[0216] Specifically, when structural similarity is high (small image differences), a lower difference map threshold is set to capture subtle changes; when structural similarity is low (large image differences), a higher threshold is set to avoid false highlights caused by large areas of noise. Through this step, the sensitivity of change detection can be adaptively controlled, enabling difference detection to detect both minute changes and avoid the influence of noise, thereby improving the overall accuracy and practicality of detection.
[0217] S035. Based on the difference map threshold, perform pixel comparison on the change areas of the image to be displayed and the adjacent images to be displayed to generate a difference highlight image.
[0218] In this step, the difference highlighting image refers to the image where the generated image to be displayed is compared pixel-by-pixel with the changed areas of adjacent images to be displayed. Areas of significant difference are extracted and visually highlighted to intuitively demonstrate the changes in the model's output image. Within these localized areas of change, an adaptively adjusted difference threshold is used to detect and highlight the actual changes between the two images, helping users intuitively perceive the improvements or corrections made to the model's output during training. First, the grayscale or RGB channel values of the two images can be compared pixel-by-pixel within the defined areas of change to calculate pixel differences. Pixels with differences greater than a set difference threshold are considered as changed areas and highlighted on the original image using a preset color (such as red or green) to form the difference highlighting image. Alternatively, a semi-transparent highlighting layer can be overlaid on the original image to enhance the perception of changes. This step intuitively and accurately highlights key improvement points during training, providing a more visual and easily understood basis for training parameter tuning and convergence monitoring.
[0219] S036. Display the image to be generated, the adjacent images to be displayed, and the difference-highlighted image in the image display window of the training interface.
[0220] Finally, the three images can be displayed in columns, stacked, or with tabs. Users can switch between viewing the original image, adjacent images, and difference images on the interface, or observe the comparison results simultaneously. Interactive functions such as zooming, moving, and enlarging local areas can be provided when necessary to facilitate viewing detailed changes. This step presents the image change process learned by the model during training to the user in an intuitive, continuous, and interactive way, greatly improving the interpretability, monitorability, and parameter tuning efficiency of the training process.
[0221] Example 2
[0222] Please see Figure 4 This invention provides an interactive interface device for training an image processing model, the device comprising:
[0223] An image loading module is used to load and display a base image and a target training image in response to an image loading command in a base image window and a target image window of an image loading interface, respectively. The base image is obtained based on a substrate and includes at least one repeating unit, and the target training image is obtained based on the base image.
[0224] The model training module is used to train a preset neural network model in response to a training start command, based on training parameters, the base image, and the target training image. The training parameters include batch size and total number of training steps.
[0225] The training process display module is used to dynamically display the model-generated image output by each training of the preset neural network model in the image display window of the training interface during the training process, and to dynamically display the loss function value of the training process in the loss function display window of the training interface.
[0226] The model export module is used to output the trained model to the user-specified address in response to the model export command after the actual total number of training steps has been reached.
[0227] It should be noted that each module and unit in the interface interaction device for training the image processing model in this embodiment corresponds one-to-one with each step in the interface interaction method for training the image processing model in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the interface interaction method for training the image processing model in the aforementioned embodiment, and will not be repeated here.
[0228] Example 3
[0229] In addition, combined Figure 1 The interface interaction method for training the image processing model described in this embodiment of the invention can be implemented by an electronic device. Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown.
[0230] Electronic devices may include processors and memory storing computer program instructions.
[0231] Specifically, the processor may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement embodiments of the present invention.
[0232] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0233] Computer-readable media include both permanent and non-permanent, removable and non-removable media, which can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient media, such as modulated communication signals and carrier waves.
[0234] The processor reads and executes computer program instructions stored in memory to implement the interface interaction method for training any of the image processing models in the above embodiments.
[0235] In one example, the electronic device may also include a communication interface and a bus. For example, Figure 5 As shown, the processor 401, memory 402, and communication interface 403 are connected through bus 410 and complete communication with each other.
[0236] The communication interface is mainly used to enable communication between various modules, devices, units and / or equipment in the embodiments of the present invention.
[0237] A bus, including hardware, software, or both, couples components of an electronic device together. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, a bus may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.
[0238] Example 4
[0239] Furthermore, in conjunction with the interface interaction method for training the image processing model in the above embodiments, this invention can be implemented using a computer-readable storage medium. This computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the interface interaction methods for training the image processing model in the above embodiments.
[0240] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0241] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0242] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0243] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0244] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0245] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0246] The above description is merely a specific embodiment of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.
Claims
1. A user interface interaction method for training an image processing model, characterized in that, The method includes: In response to an image loading command, a base image and a target training image are loaded and displayed in the base image window and target image window of the image loading interface, respectively. The base image is obtained based on the substrate and includes at least one repeating unit, and the target training image is obtained based on the base image. In response to the training start command, a preset neural network model is trained according to the training parameters, the base image, and the target training image. The training parameters include the batch size and the total number of training steps. During the training process, the image display window of the training interface dynamically displays the model-generated image output by the preset neural network model for each training session, while the loss function display window of the training interface dynamically displays the loss function value during the training process. Once the total number of actual training steps reaches the specified total number of training steps, the trained model is output to the user-specified address in response to the model export command.
2. The interface interaction method for training an image processing model according to claim 1, characterized in that, The image loading instruction includes a base map loading instruction and a target training image loading instruction. The step of loading and displaying the base map image in the base map window and loading and displaying the target training image in the target image window in response to the image loading instruction includes: In response to the base map loading command, the base map image is loaded according to the first address entered by the user and displayed in the base map display window; In response to the target image loading command, the target training image is loaded according to the second address input by the user and displayed in the target training image window; In response to the completion of loading the base image and the target training image, it is determined whether the image parameters of the base image and the target training image are consistent, wherein the image parameters include at least the image resolution; If they match, then based on the image coordinates of the base image and the target training image, alignment guide lines are displayed in the target training image and in the target training image window, respectively. In response to user commands to move the base image and / or the target training image, move and align the base image and / or the target training image.
3. The interface interaction method for training an image processing model according to claim 1, characterized in that, The step of training a preset neural network model in response to a training start command, based on the training parameters, the base image, and the target training image, includes: In response to the training start command, a preset sampling window is obtained; According to the preset sampling window and the total number of training steps, the base image and the target training image are randomly sampled to obtain training image pairs, wherein the training image pairs include a first sub-image corresponding to the base image and a second sub-image corresponding to the target training image; Determine a preset number of noise intensity coefficients based on the preset coefficient range; Based on the random noise coefficients and the preset noise type, a preset number of noise matrices are generated; The first sub-image or the second sub-image is processed according to the noise matrix to obtain a noisy training image pair; The training images are input into a preset neural network model, and the preset neural network model is trained using the training parameters. The output is the model-generated image corresponding to each training image pair.
4. The interface interaction method for training an image processing model according to claim 3, characterized in that, The image display window includes a window switching label, which includes a base image label, a target training image label, and a real-time sample label. When the real-time sample label is triggered, the image display window includes a first sub-image display area, a second sub-image display area, and a model-generated image display area that are set adjacently. During training, the image display window on the training interface dynamically displays the model-generated image output by the preset neural network model for each training session, and the loss function display window on the training interface dynamically displays the loss function value during the training process, including: Based on the batch size and the loss function of the preset neural network model, obtain the loss function value after training for each batch; Based on the loss function values output after each batch of training, a line graph of the loss value is dynamically generated and displayed in the loss function display window; In response to the triggering of the real-time sample labels, the current training image pairs are displayed in the first sub-image display area and the second sub-image display area, respectively, and the corresponding model-generated image is displayed in the model-generated image display area.
5. The interface interaction method for training an image processing model according to claim 4, characterized in that, The window switching tab also includes an image fusion tab. After loading and displaying the base image and the target training image in the base image window and the target image window of the image loading interface, respectively, in response to the image loading instruction, the method further includes: In response to the image fusion label being triggered, the base image and the target training image are fused according to a preset transparency or user-input transparency to obtain a fused image; The fused image is displayed in the image display window.
6. The interface interaction method for training an image processing model according to claim 3, characterized in that, The step of training a preset neural network model in response to a training start command, based on the training parameters, the base image, and the target training image, further includes: After each batch of training, the model-generated image and the corresponding loss function value corresponding to the preset fixed region on the base image are saved to obtain the generated image sequence and the loss function value sequence. Establish a mapping relationship between each model-generated image in the generated image sequence and its corresponding loss function value; The generated image sequence is traversed, and several adjacent image pairs are obtained based on the generated image of each model and its adjacent generated images. Each adjacent image pair is sampled according to a preset sliding window to form several corresponding first sampling regions and second sampling regions on the model-generated image and its adjacent model-generated image, respectively. Calculate the initial structural similarity between each first sampling region and the corresponding second sampling region; Based on the local texture complexity of the first sampling region and / or the second sampling region, a weight value for the initial structural similarity is obtained, wherein the weight value is positively correlated with the local texture complexity. Based on the weight values, the structural similarity of each adjacent image pair is calculated to obtain a structural similarity sequence. Trend analysis is performed on the structural similarity sequence and the loss function value sequence to obtain the rate of change of structural similarity and the rate of decrease of loss function value. When the rate of change of structural similarity and the rate of decrease of loss function value meet the preset reminder conditions, the corresponding training parameter adjustment information is displayed on the training interface.
7. The interface interaction method for training an image processing model according to claim 6, characterized in that, The method of dynamically displaying the model-generated image output by each training session of the preset neural network model in the image display window of the training interface during the training process, and simultaneously dynamically displaying the loss function values during the training process in the loss function display window of the training interface, further includes: In response to a user's click on the line chart of the loss value in the loss function display window, the loss function value corresponding to the click operation is obtained and recorded as the loss value to be displayed; According to the mapping relationship, adjacent image pairs corresponding to the loss value to be displayed are obtained in the generated image sequence and are respectively denoted as the generated image to be displayed and the adjacent image to be displayed. Based on the initial structural similarity, the regions of change between the generated image to be displayed and the adjacent images to be displayed are determined; A difference map threshold is determined based on the structural similarity of the adjacent image pairs, wherein the difference map threshold is negatively correlated with the structural similarity; Based on the difference map threshold, pixel comparison is performed on the change areas of the image to be displayed and the adjacent images to be displayed to generate a difference highlight image. The training interface displays the image to be generated, the adjacent images to be displayed, and the difference-highlighted image in the image display window.
8. An interactive interface device for training an image processing model, characterized in that, The device includes: An image loading module is used to load and display a base image and a target training image in response to an image loading command in a base image window and a target image window of an image loading interface, respectively. The base image is obtained based on a substrate and includes at least one repeating unit, and the target training image is obtained based on the base image. The model training module is used to train a preset neural network model in response to a training start command, based on training parameters, the base image, and the target training image. The training parameters include batch size and total number of training steps. The training process display module is used to dynamically display the model-generated image output by each training of the preset neural network model in the image display window of the training interface during the training process, and to dynamically display the loss function value of the training process in the loss function display window of the training interface. The model export module is used to output the trained model to the user-specified address in response to the model export command after the actual total number of training steps has been reached.
9. An electronic device, characterized in that, include: At least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, The method as described in any one of claims 1-7 is implemented when the computer program instructions are executed by the processor.