Medical invoice edge detection model construction method and device, equipment and medium

By introducing semantic anchor masks for invoices and edge prior constraints to optimize the mask autoencoder, and combining it with a dual-branch attention fusion module, the problems of noise sensitivity and low detection accuracy in edge detection of medical invoice images are solved, and more efficient edge feature extraction is achieved.

CN121884380APending Publication Date: 2026-04-17PICC INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-08
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing edge detection methods for medical invoice images are sensitive to noise and have difficulty handling complex backgrounds and layouts. Pre-trained deep learning models have limited feature extraction capabilities for medical invoice images, resulting in low detection accuracy.

Method used

By introducing invoice semantic anchor masks and edge prior constraints, the mask autoencoder is optimized for targeted learning. A dual-branch attention fusion module is constructed to eliminate redundant channels and optimize the connection of multi-scale features, thus building an initial edge detection model.

Benefits of technology

It enhances the ability to learn edge features of medical invoices in a targeted manner, reduces reliance on fine-tuning data, lowers noise sensitivity, and improves image detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121884380A_ABST
    Figure CN121884380A_ABST
Patent Text Reader

Abstract

The invention provides a medical invoice edge detection model construction method and device, equipment and a medium, and the method comprises the steps: obtaining a medical invoice image set, and marking the invoice semantic anchor point of each medical invoice image in the medical invoice image set, so as to construct a sample set; the mask auto-encoder is improved, and an optimized mask auto-encoder is obtained; performing iterative training on the optimized mask auto-encoder by using the sample set to obtain a trained mask auto-encoder, and extracting a multi-layer residual network from the trained mask auto-encoder; constructing an initial edge detection model based on a multi-layer residual network and a double-branch attention fusion module; and training the initial edge detection model by using the sample set to construct a medical invoice edge detection model. By adopting the medical invoice edge detection model construction method and device, the equipment and the medium, the noise sensitivity is reduced, the edge feature extraction capability is improved, and the image detection precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more specifically, to a method, apparatus, device, and medium for constructing a medical invoice edge detection model. Background Technology

[0002] Medical invoices are legally binding payment vouchers issued by medical institutions to patients or payers when providing medical services, selling medicines, or medical consumables. They serve as the core basis for medical insurance reimbursement, personal expense accounting, and commercial insurance claims. Automated processing of medical invoices is crucial for improving the efficiency and accuracy of medical expense reimbursement, financial accounting, and medical insurance settlement. Edge detection of medical invoice images is a critical step in this automated process. Currently, edge detection methods for medical invoice images typically rely on image processing techniques (such as Canny edge detection) or directly use pre-trained deep learning models (such as ResNet and VGG) for feature extraction, followed by edge localization using object detection algorithms (such as Faster R-CNN and YOLO).

[0003] However, existing edge detection methods for medical invoice images (such as Canny) are sensitive to noise and have difficulty handling complex backgrounds and layouts. Pre-trained deep learning models are usually trained on general image datasets (such as ImageNet), which have limited ability to extract specific features (such as edges) of medical invoice images, resulting in low image detection accuracy. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a method, apparatus, device and medium for constructing a medical invoice edge detection model, so as to overcome at least one of the above-mentioned defects.

[0005] In a first aspect, embodiments of this application provide a method for constructing a medical invoice edge detection model, including: Obtain a set of medical invoice images, and annotate the semantic anchor points of each medical invoice image in the set to construct a sample set; By introducing semantic anchor masks for invoices and edge prior constraints, the mask autoencoder is guided to learn the source features of medical invoices in a targeted manner, thereby obtaining an optimized mask autoencoder. The optimized mask autoencoder is iteratively trained using a sample set to obtain the trained mask autoencoder, and a multi-layer residual network is extracted from the trained mask autoencoder. A dual-branch attention fusion module is constructed to remove redundant channels and optimize the connection of multi-scale features. Based on the multi-layer residual network and the dual-branch attention fusion module, an initial edge detection model is constructed. The initial edge detection model was trained using a sample set to build a medical invoice edge detection model.

[0006] Optionally, by introducing invoice semantic anchor masks and edge prior constraints, the mask autoencoder is guided to learn the source features of medical invoices in a targeted manner to obtain an optimized mask autoencoder. This includes: introducing invoice semantic anchor masks into the initial residual network of the mask autoencoder to mask key regions and specified regions in the medical invoice image with different masking probabilities; and adding edge prior constraints to the decoder of the mask autoencoder to guide the decoder to learn edge features in a targeted manner to obtain an optimized mask autoencoder.

[0007] Optionally, the step of constructing a dual-branch attention fusion module for removing redundant channels and optimizing multi-scale feature connections includes: setting a first branch for removing redundant channels; using the first branch to remove edge features under target channels with insufficient contribution to obtain a first feature map; setting a second branch for adaptive scale connection; performing multi-scale feature extraction on the first feature map in the second branch to obtain initial second feature maps at different scales; dynamically adjusting the scale weights between different scales according to the invoice semantic anchor point, and fusing the initial second feature maps at different scales according to the scale weights to obtain a second feature map; and fusing the first feature map and the second feature map to obtain an enhanced feature map.

[0008] Optionally, the step of using the first branch to remove edge features under the target channel with insufficient contribution includes: using the first branch to determine the edge contribution of each channel; selecting the target channel whose edge contribution does not meet the preset contribution requirement, and removing the edge features under the target channel from the input feature map.

[0009] Optionally, the step of constructing an initial edge detection model based on a multi-layer residual network and a dual-branch attention fusion module includes: constructing an initial edge detection model based on a multi-layer residual network, a dual-branch attention fusion module, a detection head module for converting feature maps into edge detection results, and an edge confidence calibration module.

[0010] Optionally, the edge detection results include edge candidate boxes and confidence probabilities. The step of training the initial edge detection model using a sample set to construct a medical invoice edge detection model includes: using an edge confidence calibration module to determine the confidence score of the edge candidate box based on the confidence probability and the positional matching degree between the edge candidate box and the semantic anchor point of the invoice; comparing the confidence score with a confidence threshold; and calibrating the edge confidence of the edge candidate boxes output by the detection head module based on the comparison result.

[0011] Optionally, after calibrating the edge confidence of the edge candidate boxes output by the detection head module based on the comparison results, the method further includes: determining the classification loss, regression loss, and edge prior loss of the medical invoice edge detection model respectively; determining the total loss based on the classification loss, regression loss, and edge prior loss, and iteratively training the medical invoice edge detection model based on the total loss.

[0012] Secondly, embodiments of this application also provide a medical invoice edge detection model construction device, the device comprising: The sample set construction module is used to obtain a set of medical invoice images and to annotate the semantic anchor points of each medical invoice image in the set in order to construct the sample set. The model improvement module is used to guide the mask autoencoder to learn the source features of medical invoices in a targeted manner by introducing invoice semantic anchor mask and edge prior constraints, so as to obtain an optimized mask autoencoder. The first training module is used to iteratively train the optimized mask autoencoder using the sample set to obtain the trained mask autoencoder, and then extract a multi-layer residual network from the trained mask autoencoder. The model building module is used to build a dual-branch attention fusion module for eliminating redundant channels and optimizing the connection of multi-scale features. Based on the multi-layer residual network and the dual-branch attention fusion module, the initial edge detection model is built. The second training module is used to train the initial edge detection model using the sample set in order to build a medical invoice edge detection model.

[0013] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the medical invoice edge detection model construction method described above are performed.

[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the medical invoice edge detection model construction method described above.

[0015] The embodiments of this application bring the following beneficial effects: This application provides a method, apparatus, device, and medium for constructing a medical invoice edge detection model. By introducing semantic anchors and edge prior constraints, it enhances the targeted learning ability for medical invoice edge features and reduces reliance on fine-tuning data. Simultaneously, through a dual-branch attention fusion module, redundant channels are eliminated, and multi-scale feature connections are optimized, resolving issues such as background interference and feature discontinuity during scale switching. Compared to existing medical invoice edge detection model construction methods, this approach reduces sensitivity to noise, improves feature extraction capabilities for edge features, and enhances image detection accuracy.

[0016] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating the medical invoice edge detection model construction method provided in this application embodiment is shown; Figure 2 A flowchart illustrating the determination steps of the optimized mask autoencoder provided in the embodiments of this application is shown; Figure 3 A flowchart illustrating the construction steps of the dual-branch attention fusion module provided in an embodiment of this application is shown; Figure 4 This paper shows a schematic diagram of the structure of the medical invoice edge detection model construction device provided in an embodiment of this application; Figure 5 A schematic diagram of the structure of the electronic device provided in the embodiments of this application is shown. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0020] To facilitate understanding of this embodiment, the following describes each of the exemplary steps provided in this embodiment using the medical invoice edge detection model construction method provided in this application embodiment as an example applied to a terminal device.

[0021] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for constructing a medical invoice edge detection model, as provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method for constructing a medical invoice edge detection model includes: Step S101: Obtain a set of medical invoice images and annotate the semantic anchor points of each medical invoice image in the set to construct a sample set.

[0022] Collect multiple medical invoice images to form a medical invoice image set. These images include different types of medical invoices, such as value-added tax invoices and outpatient fee invoices.

[0023] For each medical invoice image, in addition to marking the bounding box, additional invoice semantic anchors are marked. These invoice semantic anchors can refer to semantic information used to identify different areas in the medical invoice image. Invoice semantic anchors include multiple types, including but not limited to: invoice code area, amount column, border vertices, and column separator lines.

[0024] After annotating the semantic anchor points of the invoices, the medical invoice image set is divided. For example, 70% of the medical invoice images are divided into the training set, 20% into the validation set, and 10% into the test set. Data augmentation processing is then performed on the training set (such as rotating it by ±15°, adding 5%-10% printing noise, and simulating 1-3mm paper wrinkles) to obtain the final training set.

[0025] Step S102: By introducing invoice semantic anchor mask and edge prior constraints, the mask autoencoder is guided to learn the source features of medical invoices in a targeted manner to obtain an optimized mask autoencoder.

[0026] Masked autoencoders can refer to improved masked autoencoders. For example, a masked autoencoder can be an improved masked autoencoder (MAE) model.

[0027] The following reference Figure 2 This section will introduce the process of determining the optimized mask autoencoder.

[0028] Figure 2 A flowchart illustrating the determination steps of the optimized mask autoencoder provided in an embodiment of this application is shown. The determination steps of the optimized mask autoencoder include: Step S1021: Introduce an invoice semantic anchor mask into the initial residual network of the mask autoencoder to mask key regions and specified regions in the medical invoice image with different masking probabilities.

[0029] The mask autoencoder consists of an encoder and a decoder. The decoder is used to predict edge features, while the encoder is used to extract and aggregate global context and structured semantic features, providing a high-quality feature base for the decoder so that it can accurately infer the edge structure of the masked region.

[0030] In the encoder, a multi-layer residual network is used as the backbone network, for example, ResNet50. Invoice semantic anchor masks can be introduced during the masking stage of ResNet50. For example, multiple invoice semantic anchors (such as invoice code, patient name, medical insurance payment amount, treatment items, etc.) are predefined, and the text features and layout features (such as position coordinates, font / size, prefix and suffix rules) of each invoice semantic anchor are determined. Then, the image patches corresponding to the invoice semantic anchors are located to generate an anchor mask matrix (e.g., "1" represents the key region corresponding to the anchor, and "0" represents the non-key region corresponding to the non-anchor).

[0031] Specifically, the complete medical invoice image can be divided into several square pixel blocks of the same size, each pixel block being an independent image patch. The masking strategy performs binary classification and labeling on these image patches based on the invoice's semantic anchor points. Image patches labeled "1" are masked patches and are ignored by the encoder; image patches labeled "0" are unmasked patches and are fed into the encoder for feature extraction. The size of the masked patch is set to... The shading rate can be dynamically adjusted.

[0032] Simultaneously, the occlusion probability of key regions (such as border vertices and separator lines) corresponding to the semantic anchor points of invoices is set as the first occlusion probability, and the occlusion probability of specified regions other than key regions (such as blank backgrounds) is set as the second occlusion probability. The first occlusion probability is less than the second occlusion probability; the first occlusion probability is within the range of 5% to 10%, and the second occlusion probability is within the range of 60% to 70%. This ensures that the MAE model prioritizes learning key edge features.

[0033] Step S1022: Add edge prior constraints to the decoder of the mask autoencoder, and use the edge prior constraints to guide the decoder to learn edge features in a targeted manner, so as to obtain an optimized mask autoencoder.

[0034] Add edge prior constraints to the output layer of the decoder. For example, compare the predicted edge features of the occluded region predicted by the decoder with the real edge features of the occluded region to determine the L1 distance (Manhattan distance) between the predicted edge features and the real edge features.

[0035] The edge prior loss is determined based on the L1 distance. This edge prior loss is then weighted and summed with the reconstruction loss of the MAE model to force the decoder to learn edge features. The weights of the edge prior loss are less than or equal to the weights of the reconstruction loss.

[0036] Step S103: Iteratively train the optimized mask autoencoder using the sample set to obtain the trained mask autoencoder, and extract the multilayer residual network from the trained mask autoencoder.

[0037] The optimized mask autoencoder is iteratively trained using a sample set. For example, using the optimizer AdamW, the optimized mask autoencoder is trained for multiple training epochs. In each training epoch, the optimized mask autoencoder learns all the training data (e.g., 1000 medical invoices) completely. At the same time, a learning rate is set during the iterative training process. After every 20 training epochs, the learning rate decays to 0.5 of the previous training epoch. After multiple training epochs of iterative training, the trained mask autoencoder is obtained.

[0038] The trained mask autoencoder includes a trained multi-layer residual network, such as ResNet50, which has the ability to accurately extract key edge features of medical invoices and can reduce the dependence on fine-tuning data.

[0039] The trained multilayer residual network is extracted from the trained mask autoencoder to build an initial edge detection model.

[0040] Step S104: Construct a dual-branch attention fusion module for eliminating redundant channels and optimizing multi-scale feature connections. Based on the multi-layer residual network and the dual-branch attention fusion module, construct an initial edge detection model.

[0041] The dual-branch attention fusion module can refer to the dual-branch dynamic attention fusion module, which includes two branches: a first branch for eliminating redundant channels and a second branch for adaptive scaling.

[0042] The following reference Figure 3 This section will introduce the construction process of the dual-branch attention fusion module.

[0043] Figure 3 A flowchart illustrating the construction steps of the dual-branch attention fusion module provided in this application embodiment is shown, as follows: Figure 3 As shown, the construction steps of the dual-branch attention fusion module include: Step S1041: Set a first branch for removing redundant channels. Use the first branch to remove edge features under the target channel with insufficient contribution to obtain the first feature map.

[0044] Specifically, the first branch is used to determine the edge contribution of each channel. Then, the target channel whose edge contribution does not meet the preset contribution requirement is selected, and the edge features under the target channel are removed from the input feature map.

[0045] The above process can be implemented by setting a channel attention generator in the first branch, which includes a global average pooling layer and two fully connected layers. For example, the feature map received from the first branch is input into the global average pooling layer of the channel attention generator to obtain... The feature vector is input into a two-layer fully connected layer and the sigmoid activation function to obtain the channel attention weights. The channel attention weights can represent the edge contribution, and the channel attention weights are positively correlated with the edge contribution.

[0046] In this system, each medical invoice image corresponds to a feature map. The channel attention weight is determined by assigning an independent importance weight to each channel of the input feature map. Therefore, the channel attention weight is a... A vector (tensor).

[0047] Set a channel weight threshold, compare the channel attention weight of each channel with the channel weight threshold. If the channel attention weight of the channel is less than the channel weight threshold, the channel is determined to be a target channel that does not meet the contribution requirement, that is, the contribution is insufficient. Remove the edge features of the target channel from the feature map to obtain the first feature map corresponding to the feature map. The first feature map is denoted as F1.

[0048] Step S1042: Set up a second branch for adaptive scale transition, and perform multi-scale feature extraction on the first feature map in the second branch to obtain initial second feature maps at different scales.

[0049] In the second branch, multiple convolution kernels are set, including 3×3 convolution kernels, 5×5 convolution kernels, and 7×7 convolution kernels.

[0050] Multiple convolutional kernels are used to extract features from the first feature map at multiple scales to obtain initial second feature maps at different scales. The dimensions of the initial second feature maps at different scales are all C1×H×W.

[0051] Step S1043: Dynamically adjust the scale weights between different scales based on the semantic anchor points of the invoice, and fuse the initial second feature maps at different scales according to the scale weights to obtain the second feature map.

[0052] The second branch introduces a scale-connected weight generator, which includes an adaptive pooling layer and an activation function Softmax. Initial second feature maps of different scales are input into the scale-connected weight generator. In the scale-connected weight generator, the initial second feature maps of different scales are sequentially processed by adaptive pooling and the activation function Softmax to generate scale weights of different scales. The scale weights of different scales are γ3, γ5, and γ7, and the sum of the scale weights of different scales is 1.

[0053] Then, the scale weights are dynamically adjusted based on the semantic anchor points of the invoice. Specifically, the type of semantic anchor point (such as border, separator, amount box, etc.) can be identified first, and then the scale weights of the corresponding scales can be adjusted according to preset rules and re-normalized to ensure that the sum of the scale weights is 1. For example, when the semantic anchor point of the invoice is detected as a border, the corresponding scale weight γ7 can be increased; when the semantic anchor point of the invoice is detected as a separator, the corresponding scale weight γ3 can be increased.

[0054] By using dynamically adjusted scale weights, multiple initial second feature maps at different scales are weighted and fused to obtain a second feature map, so as to achieve smooth feature transition during scale switching.

[0055] Step S1044: Fuse the first feature map and the second feature map to obtain an enhanced feature map.

[0056] The first feature map obtained from the first branch is multiplied element-wise with the second feature map output from the second branch to obtain an enhanced feature map through fusion. The enhanced feature map not only eliminates redundant channel interference but also optimizes the connection of multi-scale features.

[0057] After constructing the dual-branch attention fusion module, an initial edge detection model can be jointly built based on the multi-layer residual network, the dual-branch attention fusion module, the detection head module for converting feature maps into edge detection results, and the edge confidence calibration module.

[0058] The detection head module includes a classification branch and a regression branch, which are two parallel sub-networks. The classification branch qualitatively determines whether each location on the feature map is an edge location; the regression branch, if the location is an edge location, quantitatively predicts the bounding box coordinates corresponding to the edge.

[0059] Step S105: Train the initial edge detection model using the sample set to construct the medical invoice edge detection model.

[0060] When training the initial edge detection model, you can first initialize the parameters of the initial edge detection model, set the training batch size to 16, the number of iterations to 50 epochs, the initial learning rate to 1e-4, and decay to 0.6 of the previous iteration every 10 epochs.

[0061] In one embodiment, after the initial edge detection model is trained, the edge confidence calibration module can be used to perform edge confidence calibration while obtaining the medical invoice edge detection model.

[0062] The edge detection results of the medical invoice edge detection model include the edge candidate boxes output by the detection head module and the confidence probability.

[0063] When performing edge confidence calibration, the edge confidence calibration module determines the confidence score of the edge candidate box based on the confidence probability and the position matching degree between the edge candidate box and the semantic anchor point of the invoice. It then compares the confidence score with the confidence threshold and calibrates the edge candidate box output by the detection head module based on the comparison result.

[0064] For example, the product of the confidence probability and the location matching degree is used to determine the confidence score. If the confidence score is less than a preset score threshold, the candidate edge box is removed. If the confidence score is greater than or equal to the preset score threshold, the position of the first type of edge is determined, and a linear interpolation method is used to supplement the discontinuities of the first type of edge (such as a dashed border) to improve edge continuity. Here, the first type of edge can refer to a thin edge, which is an edge structure in medical invoice images that is extremely narrow (usually 1 to 3 pixels), has a low pixel ratio, and is easily broken or missed. The first type of edge corresponds to the second type of edge, which refers to a thick edge, such as the thick outer border of an invoice, with a width ≥ 4 pixels. This is the most likely target to fail in medical invoice edge detection.

[0065] In one embodiment, after edge confidence calibration is completed, the total loss of the medical invoice edge detection model can be determined.

[0066] For example, the classification loss of the medical invoice edge detection model is determined using the binary cross-entropy loss function, the regression loss is determined using the GloU Loss function, and the edge prior loss determined by the decoder of the masked autoencoder is reused. Then, the total loss is determined based on the sum of the weights of the classification loss, regression loss, and edge prior loss. This total loss is used to determine whether the medical invoice edge detection model meets the iteration stopping condition. If the iteration stopping condition is met, the iteration training process ends; otherwise, the next round of model training begins.

[0067] In one embodiment, after determining the edge detection model for medical invoices, the edge detection model for medical invoices can be tested and verified.

[0068] For example, determine the edge detection accuracy, recall, F1 score, edge continuity, and false positive rate of the medical invoice edge detection model, and determine whether the medical invoice edge detection model meets the accuracy requirements based on the test indicators.

[0069] The medical invoice edge detection model construction method provided in this application can improve the targeted learning ability of medical invoice edge features by introducing semantic anchor points and edge prior constraints, and reduce the dependence on fine-tuning data. At the same time, through the dual-branch attention fusion module, redundant channels can be eliminated and multi-scale feature connection can be optimized to solve the problems of edge features being disturbed by the background and feature discontinuity when the scale is switched, reduce the sensitivity to noise, improve the feature extraction ability of edge features, and improve the image detection accuracy.

[0070] Based on the same inventive concept, this application also provides a medical invoice edge detection model construction device corresponding to the medical invoice edge detection model construction method. Since the principle of the device in this application is similar to the above-mentioned medical invoice edge detection model construction method in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0071] Please see Figure 4 , Figure 4 This is a schematic diagram of a medical invoice edge detection model construction device provided in an embodiment of this application. Figure 4 As shown, the medical invoice edge detection model construction device 200 includes: The sample set construction module 201 is used to obtain a set of medical invoice images and to annotate the semantic anchor points of each medical invoice image in the set to construct a sample set. The model improvement module 202 is used to guide the mask autoencoder to learn the source features of medical invoices in a targeted manner by introducing invoice semantic anchor mask and edge prior constraints, so as to obtain an optimized mask autoencoder. The first training module 203 is used to iteratively train the optimized mask autoencoder using the sample set to obtain the optimized mask autoencoder and extract a multi-layer residual network from the optimized mask autoencoder. Model building module 204 is used to build a dual-branch attention fusion module for removing redundant channels and optimizing the connection of multi-scale features. Based on the multi-layer residual network and the dual-branch attention fusion module, an initial edge detection model is built. The second training module 205 is used to train the initial edge detection model using the sample set to build a medical invoice edge detection model.

[0072] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 300 includes a processor 310, a memory 320, and a bus 330.

[0073] The memory 320 stores machine-readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 and the memory 320 communicate via the bus 330. When the machine-readable instructions are executed by the processor 310, they can perform the operations described above. Figure 1 The steps of the medical invoice edge detection model construction method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0074] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the medical invoice edge detection model construction method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0075] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0077] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0078] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0079] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0080] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for constructing a medical invoice edge detection model, characterized in that, Applied to, including: Obtain a set of medical invoice images, and annotate the semantic anchor points of each medical invoice image in the set to construct a sample set; By introducing semantic anchor masks for invoices and edge prior constraints, the mask autoencoder is guided to learn the source features of medical invoices in a targeted manner, thereby obtaining an optimized mask autoencoder. The optimized mask autoencoder is iteratively trained using the sample set to obtain the trained mask autoencoder, and a multi-layer residual network is extracted from the trained mask autoencoder. A dual-branch attention fusion module is constructed to remove redundant channels and optimize the connection of multi-scale features. Based on the multi-layer residual network and the dual-branch attention fusion module, an initial edge detection model is constructed. The initial edge detection model is trained using the sample set to construct a medical invoice edge detection model.

2. The method according to claim 1, characterized in that, The step of guiding the mask autoencoder to learn the source features of medical invoices in a targeted manner by introducing invoice semantic anchor masks and edge prior constraints to obtain an optimized mask autoencoder includes: Invoice semantic anchor mask is introduced into the initial residual network of the mask autoencoder to mask key areas and specified areas in the medical invoice image with different masking probabilities. An edge prior constraint is added to the decoder of the mask autoencoder. The edge prior constraint is used to guide the decoder to learn edge features in a targeted manner, so as to obtain an optimized mask autoencoder.

3. The method according to claim 1, characterized in that, The step of constructing a dual-branch attention fusion module for eliminating redundant channels and optimizing multi-scale feature connections includes: A first branch is set up to remove redundant channels. Using the first branch, edge features under target channels with insufficient contribution are removed to obtain a first feature map. A second branch is set up for adaptive scale transition. In the second branch, multi-scale feature extraction is performed on the first feature map to obtain initial second feature maps at different scales. The scale weights between different scales are dynamically adjusted based on the invoice semantic anchor points, and the initial second feature maps at different scales are fused together based on the scale weights to obtain the second feature map. The first feature map and the second feature map are fused to obtain an enhanced feature map.

4. The method according to claim 3, characterized in that, The step of using the first branch to remove edge features under the target channel with insufficient contribution includes: Using the first branch, determine the edge contribution of each channel; Select the target channel whose edge contribution does not meet the preset contribution requirement, and remove the edge features under the target channel from the input feature map.

5. The method according to claim 1, characterized in that, The step of constructing the initial edge detection model based on the multi-layer residual network and the dual-branch attention fusion module includes: An initial edge detection model is constructed based on the multi-layer residual network, the dual-branch attention fusion module, the detection head module for converting feature maps into edge detection results, and the edge confidence calibration module.

6. The method according to claim 5, characterized in that, The edge detection result includes edge candidate boxes and confidence probabilities. The step of training the initial edge detection model using the sample set to construct a medical invoice edge detection model includes: Using the edge confidence calibration module, the confidence score of the edge candidate box is determined based on the confidence probability and the positional matching degree between the edge candidate box and the semantic anchor point of the invoice. The confidence score is compared with the confidence threshold, and the edge confidence of the edge candidate box output by the detection head module is calibrated based on the comparison result.

7. The method according to claim 6, characterized in that, After calibrating the edge confidence of the edge candidate boxes output by the detection head module based on the comparison results, the method further includes: The classification loss, regression loss, and edge prior loss of the medical invoice edge detection model are determined respectively. The total loss is determined based on the classification loss, the regression loss, and the edge prior loss, and the medical invoice edge detection model is iteratively trained based on the total loss.

8. A device for constructing a medical invoice edge detection model, characterized in that, include: The sample set construction module is used to acquire a set of medical invoice images and to annotate the semantic anchor points of each medical invoice image in the set to construct a sample set. The model improvement module is used to guide the mask autoencoder to learn the source features of medical invoices in a targeted manner by introducing invoice semantic anchor mask and edge prior constraints, so as to obtain an optimized mask autoencoder. The first training module is used to iteratively train the optimized mask autoencoder using the sample set to obtain the trained mask autoencoder, and extract a multi-layer residual network from the trained mask autoencoder. The model building module is used to build a dual-branch attention fusion module for eliminating redundant channels and optimizing the connection of multi-scale features. Based on the multi-layer residual network and the dual-branch attention fusion module, an initial edge detection model is built. The second training module is used to train the initial edge detection model using the sample set to construct a medical invoice edge detection model.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the medical invoice edge detection model construction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the medical invoice edge detection model construction method as described in any one of claims 1 to 7.