Photo selecting and processing method for training heart disease recognition model

By employing techniques such as image screening, artifact quantification, manual segmentation, and OCR processing based on clinical guidelines and DICOM metadata, the data quality and privacy leakage issues in the training of cardiac recognition models were resolved, thereby improving the accuracy of model training and the credibility of the dataset.

CN121147602AActive Publication Date: 2025-12-16南昌大学第一附属医院
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511281217.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2025-12-16
Estimated Expiration
2045-09-09

AI Technical Summary

Technical Problem

The training of cardiac recognition models suffers from problems such as low data quality, inconsistent annotation, and privacy leaks. Existing technologies lack standardized rules, fail to effectively quantify artifacts, have unreasonable resolution threshold settings, limited annotation tools, and insufficient privacy protection.

Method used

Based on clinical guidelines, section labeling rules were established, images were screened using DICOM metadata, motion artifacts were quantified, resolution thresholds were set, low-quality images were removed, cardiac structures were manually segmented, pathological annotations were performed, equipment differences were simulated, OCR was used to identify sensitive information, file names were standardized, and the dataset was divided by stratified sampling through multi-doctor annotation consistency assessment and expert review.

Benefits of technology

This improved image quality and annotation consistency, ensured data anonymization, enhanced the model's generalization ability and the accuracy of training data, reduced annotation errors, and constructed a high-quality, high-reliability training dataset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147602A_ABST
    Figure CN121147602A_ABST
Patent Text Reader

Abstract

The invention provides a photo selecting and processing method for training a heart disease recognition model, which comprises the following steps of: establishing a section screening rule based on DICOM metadata and anatomical features by combining a clinical guide and an image analysis technology, matching a standard section based on a field, quantifying a motion artifact degree, and filtering an artifact image by combining a heart rate and a respiration signal, so that the heart disease recognition model is trained. OpenCV histogram kurtosis analysis and frequency domain high-frequency energy detection are adopted, low-resolution and high-noise images are eliminated, a heart structure is manually segmented, a boundary is repaired through morphological closed operation, pathological labeling is achieved based on a LabelImg plug-in, local sharpening and equipment simulation enhancement are conducted, sensitive information is processed based on OCR and Gaussian blur, and standardized naming is conducted. The method comprises the following steps: establishing a training set, evaluating annotation consistency, performing stratified sampling to construct the training set, and ensuring the accuracy, integrity and compliance of model training data through multi-modal quality control, semi-automatic annotation and privacy protection strategies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning image preprocessing technology, and in particular to a method for selecting and processing photos for training a heart disease recognition model. Background Technology

[0002] The training of current intelligent diagnostic models for heart disease faces multi-dimensional technical bottlenecks. Traditional medical image screening relies on human experience to judge the type of ultrasound section, lacks standardized rule base support, and motion artifact detection mostly adopts subjective visual methods without combining physiological parameters such as heart rate and respiratory signals for quantitative analysis. Existing image preprocessing processes generally have the problem of unreasonable resolution threshold settings, and some studies only screen images based on the number of pixels, ignoring the correlation between actual spatial resolution and pixel size.

[0003] In the field of pathological annotation, existing technologies have significant shortcomings: annotation tools are limited in function, with most only supporting rectangular box annotation, making it difficult to accurately delineate complex morphologies such as valvular stenosis; cross-slice consistency verification is lacking; data augmentation strategies are homogenized and do not simulate the differences in equipment in real clinical scenarios, such as imaging parameters and probe types in different hospitals; in terms of privacy protection, traditional DICOM desensitization only removes explicit metadata, ignoring sensitive information hidden in images such as timestamps and text labels, which poses a potential risk of privacy leakage.

[0004] The training data is unevenly distributed, no quantitative evaluation system for label consistency has been established, and there is a lack of a joint frequency-spatial domain detection mechanism for motion artifacts. Existing technologies do not integrate multimodal perception, such as combining electrocardiograms, respiratory signals and image features, which limits the model's ability to recognize complex pathological features. They also do not combine multi-dimensional image features for joint screening, and the dataset division lacks a pathological category hierarchical strategy, which is prone to class imbalance problems. Summary of the Invention

[0005] The purpose of this invention is to provide a method for selecting and processing photographs for training a heart disease recognition model.

[0006] The problem this invention aims to solve is to address three core issues in the training of heart disease recognition models: low data quality, inconsistent labeling, and privacy leakage.

[0007] A method for selecting and processing photos for training a cardiac recognition model, the technical solution of which is as follows: S1: Establish section labeling rules based on clinical guidelines, including parasternal left ventricular long-axis section and apical four-chamber view, and select images that meet the section criteria from DICOM images based on the labeling rules; S2: Motion artifact labels are added based on the rule base containing the section label rules. The artifact labels are divided into no artifacts, mild artifacts, and severe artifacts. The degree of motion artifacts is quantified and combined with image metadata, including heart rate and respiratory signals in DICOM images. Based on images that meet the section standard, images without artifacts are selected. S3: Set the minimum resolution threshold to 512×512 pixels, remove low-resolution images, and use OpenCV's histogram analysis function to detect image contrast (including histogram kurtosis) and noise level (including variance), remove images that are too dark, too bright, or too noisy, apply Fourier transform to the retained images, detect motion artifacts in high-frequency components, and remove images with artifacts that were not completely removed in S2. S4: Based on the manual drawing function of the image editing tool, remove the mutual occlusion between internal organs, remove organs unrelated to the heart in the image, retain only the boundary information of the heart and its surrounding blood vessels, manually draw the outline of the heart, cover all key structures including the left ventricle and aortic valve, and perform morphological closure operation on the outline result to fill small holes based on the integrity of the heart region. S5: Using a LabelImg-based plugin, pathological areas, including valvular stenosis and ventricular hypertrophy, are annotated, and a structured label CSV file is output. S6: Unsharp Masking is used to locally sharpen the marked pathological areas to enhance lesion features, contrast stretching is applied to non-pathological areas to simulate imaging differences between different devices, Gaussian noise and rotation are added to the entire image, and the pathological areas are preserved without distortion. S7: Use OCR technology to identify sensitive information in the image, including text labels and timestamps, perform blurring, replace the patient ID in the original file name with patient number_section type_pathology label, and delete metadata in the image including patient name and hospital name; S8: Based on the annotation results of different doctors on the same batch of images, calculate the annotation consistency Kappa coefficient. For images with a consistency Kappa coefficient lower than the threshold of 0.7, conduct expert review. Based on the distribution of each pathological category, use stratified sampling to divide the training set, validation set, and test set.

[0008] Furthermore, in step S1, section labeling rules are established based on clinical guidelines, and images conforming to sectioning criteria are selected from DICOM images based on these labeling rules, including: According to the guidelines for echocardiography, the standard section types are defined, including the parasternal left ventricular long-axis section and the apical four-chamber section. The anatomical features corresponding to each section, including the aortic valve position and the continuity of the interventricular septum, are converted into quantifiable label rules. Create a structured table, associate the section type with DICOM images and anatomical features, read the metadata of the DICOM images, match it with the rule base, and generate preliminary labels; Based on the description field in the DICOM image, images containing keywords of the target section are selected. The selected images are reviewed, and images that are misclassified are marked. Based on the review results, the keyword and anatomical feature matching rules in the rule base are updated.

[0009] Furthermore, in step S2, motion artifact labels are added based on a rule base containing section label rules, the degree of motion artifacts is quantified, and combined with image metadata, artifact-free images are selected from images that meet the section criteria, including: The Laplacian operator was used to calculate the image blur index variance. The higher the blur, the more severe the motion artifacts. Fourier transform was used to detect periodic stripes in the image, and the stripe intensity distribution was statistically analyzed. Based on the extracted feature values, the image was divided into three categories: no artifacts, mild artifacts, and severe artifacts. The label for no artifacts was blur variance <100 and stripe intensity peak <5%; the label for mild artifacts was blur variance 100-300 and stripe intensity peak 5%-15%; and the label for severe artifacts was blur variance >300 and stripe intensity peak >15%. Based on medical imaging standards, the above definitions are transformed into quantifiable image feature rules, and the motion artifact labeling rule base is embedded into the section labeling rule base established in S1 to form a joint rule base. Heart rate and respiratory signal data are extracted from DICOM images. If an image is marked as having severe artifacts, it is directly removed regardless of the heart rate and respiratory signal. If an image is marked as having mild artifacts, it is upgraded to severe artifacts and removed if either the heart rate is >120 beats / minute or the respiratory signal is abnormal. If an image is marked as having no artifacts and the heart rate and respiratory signal are normal, it is filtered and retained.

[0010] Furthermore, in S3, low-resolution images are removed, images that are too dark, too bright, or have excessive noise are removed, and images with artifacts that were not completely removed in S2 are removed, including: According to clinical imaging standards, the minimum resolution threshold is set to 512×512 pixels. The pixel size is extracted from the metadata of the DICOM image, the actual spatial resolution is calculated, and the images output by S2 are traversed to check whether their width and height are both ≥512 pixels. If they do not meet the requirements, they are removed. If the actual spatial resolution of the image is lower than the clinical requirement, it is still removed even if the number of pixels is ≥512×512. OpenCV is used to calculate the kurtosis value of the gray-level histogram. A kurtosis threshold is set, and gray-level values ​​of image regions are extracted. A variance threshold is set, and images with a kurtosis < 1.5 are removed, and images with a variance > 100 are removed. OpenCV is used to perform Fourier transform on the image to obtain the frequency domain spectrum. The high-frequency region of the frequency domain spectrum is extracted, the average energy value of the region is calculated, and an energy threshold is set. If the high-frequency energy is >1000, the image is removed.

[0011] Furthermore, in step S4, the process of removing mutual occlusion between internal organs, removing organs unrelated to the heart from the image, manually drawing the outline of the heart, and performing morphological closing operations on the drawn result to fill small holes includes: Using 3D Slicer image editing software, high-quality DICOM images output by S3 were imported, and the changing trends of occluded areas, including blood vessel orientation, were observed in adjacent slices. Based on the Erase function in the software, non-critical structures occluding the heart were erased, and based on the Brush function in the software, boundary breaks caused by erasure were repaired. Based on clinical anatomical knowledge, organs unrelated to the heart are identified. Using the Paint function in the software, a mask is drawn along the boundary of the unrelated organ. The mask area is filled with black. The mask is multiplied pixel by pixel with the original image, and only the heart area is retained. Using the Threshold function in the software, select the heart region, switch to the freehand drawing tool, and draw the outline point by point along the heart boundary to ensure that key structures, including the root of the aortic valve, are completely preserved. Use the 3D rendering function in the software to check the continuity of the outline in adjacent slices. In OpenCV, set up structuring elements, fill holes, and smooth the boundaries. Check the filling effect through a 3D view.

[0012] Furthermore, the pathological areas marked in S5 include valvular stenosis areas and ventricular hypertrophy areas, and the output structured label CSV format file includes: A plugin directory is created based on LabelImg. Pathological annotation modes are developed in the plugins, including predefined pathological categories such as valvular stenosis and ventricular hypertrophy. The plugin entry point is defined, and the annotation interface interaction logic is implemented. Drag the mouse in the image to create a custom polygon bounding box. A label selection window will pop up. Select a label from the predefined pathology categories. Combine the manually drawn heart outline described in S4 with the labeled areas of adjacent slices. Display the labeling results and dynamically adjust the bounding box position. After each image is annotated, the label information is automatically written to a CSV file. The bounding box coordinates are checked to see if they exceed the image range. If they do, a correction is prompted, and the rationality of the pathology type and the annotated area is verified.

[0013] Furthermore, in S6, Unsharp Masking is used to locally sharpen the marked pathological areas, simulating imaging differences between different devices, and Gaussian noise and rotation are added to the entire image, including: Read the bounding box coordinates of the pathological region from the CSV file, generate a binary mask based on the coordinates, mark the location of the pathological region, and combine the mask with the original image to ensure that subsequent sharpening operations only apply to the pathological region. Gaussian blur is applied to the pathological area with a radius of 2 pixels to generate a blurred image. The difference between the original image and the blurred image is calculated. The sharpening intensity is automatically adjusted according to the histogram kurtosis value described in S3. The sharpening weight is reduced for high-contrast images. Histogram equalization is applied to non-pathological areas to expand the grayscale distribution range, and linear stretching is used to map pixel values ​​to the range of [0,255]. The brightness values ​​of non-pathological areas were adjusted by ±10% to simulate the exposure differences of different devices. Random offsets were added to the RGB channels, including +5% for the red channel and -3% for the blue channel, to simulate the differences in color response of different devices. Generate a Gaussian noise matrix with a mean of 0 and a standard deviation of 0.1. Add the noise matrix to the original image and dynamically adjust the standard deviation according to the noise variance threshold described in S3. The rotation angle is randomly selected within the range of -15° to +15° to simulate the difference in the shooting angle of the device. The rotation axis is the center of the heart contour, and bilinear interpolation is used.

[0014] Furthermore, in step S7, OCR technology is used to identify sensitive information in the image, replacing the patient ID in the original filename with patient number_section type_pathology label, including: OCR technology is used to recognize text content in images, identify timestamps and hospital names, match patient IDs, timestamps and hospital names based on regular expressions, locate sensitive text areas based on OCR recognition results, apply Gaussian blur to sensitive areas, and set the kernel size to 15×15. Define the new file name format as Patient ID_Section Type_Pathology Label. The patient ID is automatically generated based on the patient ID, the section type is extracted based on the section label rules described in S1, and the pathology label is read from the CSV label file described in S5. Remove metadata including patient name and hospital name from the image.

[0015] Furthermore, in step S8, the Kappa coefficient for annotation consistency is calculated. Images with a Kappa coefficient below the threshold of 0.7 are reviewed by an expert panel. Stratified sampling is used to divide the dataset into training, validation, and test sets, including: Map each doctor's annotation results to a uniform format, including binary labels: 0 = no lesion, 1 = lesion present; The actual consistency rate is the percentage of samples where all doctors have consistent annotations. The random consistency rate is the probability of random consistency based on the annotation distribution of each doctor. The Kappa coefficient is calculated as follows: (actual consistency rate - random consistency rate) / (1 - random consistency rate). When Kappa < 0.7, the original image, conflict annotations, and the CSV tag file described in S5 are attached for expert review. The review results are written into the CSV tag file to replace the original conflict annotations. Based on the CSV file described in S5, the number of samples for each pathological category is counted, the proportion of each pathological category in each dataset is calculated, and stratified sampling is used to divide the dataset into training set, validation set, and test set.

[0016] The beneficial effects of this invention are: based on the section labeling rules constructed from clinical guidelines and the quantitative analysis of motion artifacts, combined with DICOM metadata screening, the integrity and clarity of the anatomical structure of the image are ensured from the source, reducing the subsequent model deviation caused by artifacts or low resolution. Low-quality images are eliminated through resolution threshold filtering, histogram and frequency domain analysis, and morphological operations are used to fill holes in the heart region to further optimize image details. The structured annotation of pathological areas, along with enhancement techniques such as local sharpening and contrast stretching, preserves lesion characteristics while simulating equipment differences, enhancing the generalization ability of subsequent models. OCR-driven sensitive information desensitization and file name standardization ensure data anonymization compliance. Multi-doctor annotation consistency assessment and expert review mechanisms effectively reduce annotation errors and improve label credibility. By dividing the dataset through stratified sampling, the balance of model training and the objectivity of evaluation are ensured, thus constructing a high-quality and highly reliable training dataset. Attached Figure Description

[0017] Figure 1 This is a flowchart of a photo selection and processing method for training a heart disease recognition model. Detailed Implementation

[0018] The present invention will be further described clearly and completely below, but the scope of protection of the present invention is not limited thereto.

[0019] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.

[0020] Example 1 A method for selecting and processing photos for training a cardiac recognition model, the technical solution of which is as follows: S1: Establish section labeling rules based on clinical guidelines, including parasternal left ventricular long-axis section and apical four-chamber view, and select images that meet the section criteria from DICOM images based on the labeling rules; S2: Motion artifact labels are added based on the rule base containing the section label rules. The artifact labels are divided into no artifacts, mild artifacts, and severe artifacts. The degree of motion artifacts is quantified and combined with image metadata, including heart rate and respiratory signals in DICOM images. Based on images that meet the section standard, images without artifacts are selected. S3: Set the minimum resolution threshold to 512×512 pixels, remove low-resolution images, and use OpenCV's histogram analysis function to detect image contrast (including histogram kurtosis) and noise level (including variance), remove images that are too dark, too bright, or too noisy, apply Fourier transform to the retained images, detect motion artifacts in high-frequency components, and remove images with artifacts that were not completely removed in S2. S4: Based on the manual drawing function of the image editing tool, remove the mutual occlusion between internal organs, remove organs unrelated to the heart in the image, retain only the boundary information of the heart and its surrounding blood vessels, manually draw the outline of the heart, cover all key structures including the left ventricle and aortic valve, and perform morphological closure operation on the outline result to fill small holes based on the integrity of the heart region. S5: Using a LabelImg-based plugin, pathological areas, including valvular stenosis and ventricular hypertrophy, are annotated, and a structured label CSV file is output. S6: Unsharp Masking is used to locally sharpen the marked pathological areas to enhance lesion features, contrast stretching is applied to non-pathological areas to simulate imaging differences between different devices, Gaussian noise and rotation are added to the entire image, and the pathological areas are preserved without distortion. S7: Use OCR technology to identify sensitive information in the image, including text labels and timestamps, perform blurring, replace the patient ID in the original file name with patient number_section type_pathology label, and delete metadata in the image including patient name and hospital name; S8: Based on the annotation results of different doctors on the same batch of images, calculate the annotation consistency Kappa coefficient. For images with a consistency Kappa coefficient lower than the threshold of 0.7, conduct expert review. Based on the distribution of each pathological category, use stratified sampling to divide the training set, validation set, and test set.

[0021] Furthermore, in step S1, section labeling rules are established based on clinical guidelines, and images conforming to sectioning criteria are selected from DICOM images based on these labeling rules, including: According to the guidelines for echocardiography, the standard section types are defined, including the parasternal left ventricular long-axis section and the apical four-chamber view. The anatomical features corresponding to each section, including the position of the aortic valve and the continuity of the interventricular septum, are converted into quantifiable label rules. The parasternal left ventricular long-axis section shows structures including the aortic valve, left ventricle, and left atrium. The apical four-chamber view clearly shows the left and right atria, left and right ventricles, mitral valve, tricuspid valve, and foramen ovale structure. Create a structured table to associate the section type with DICOM images and anatomical features. For example, the parasternal left ventricular long axis section → field 0008,103E contains the keyword "left ventricular long axis" and the image must include the aortic valve and the posterior wall of the left ventricle. The apical four-chamber view → field 0008,104E contains the keyword "four-chamber view" and the image must show the left and right atria and the intact interventricular septum. Read the metadata of the DICOM image, such as the 0008,103E field, match it with the rule base, and generate preliminary labels. Based on the description fields in the DICOM images, such as 0008 and 103E, images containing keywords of the target section are selected. The selected images are reviewed, and images that are misclassified are marked. Based on the review results, the keyword and anatomical feature matching rules in the rule base are updated.

[0022] Furthermore, in step S2, motion artifact labels are added based on a rule base containing section label rules, the degree of motion artifacts is quantified, and combined with image metadata, artifact-free images are selected from images that meet the section criteria, including: The Laplacian operator was used to calculate the image blur index variance. The higher the blur, the more severe the motion artifacts. Fourier transform was used to detect periodic stripes in the image, and the stripe intensity distribution was statistically analyzed. Based on the extracted feature values, the image was divided into three categories: no artifacts, mild artifacts, and severe artifacts. The label for no artifacts was blur variance <100 and stripe intensity peak <5%; the label for mild artifacts was blur variance 100-300 and stripe intensity peak 5%-15%; and the label for severe artifacts was blur variance >300 and stripe intensity peak >15%. Based on medical imaging standards, the above definitions are transformed into quantifiable image feature rules, and the motion artifact labeling rule base is embedded into the section labeling rule base established in S1 to form a joint rule base. Heart rate and respiratory signal data are extracted from DICOM images. If an image is marked as having severe artifacts, it is directly removed regardless of the heart rate and respiratory signal. If an image is marked as having mild artifacts, it is upgraded to severe artifacts and removed if either the heart rate is >120 beats / minute or the respiratory signal is abnormal. If an image is marked as having no artifacts and the heart rate and respiratory signal are normal, it is filtered and retained.

[0023] Furthermore, in S3, low-resolution images are removed, images that are too dark, too bright, or have excessive noise are removed, and images with artifacts that were not completely removed in S2 are removed, including: According to clinical imaging standards, the minimum resolution threshold is set to 512×512 pixels. The pixel size is extracted from the metadata of the DICOM image, the actual spatial resolution is calculated, and the images output by S2 are traversed to check whether their width and height are both ≥512 pixels. If they do not meet the requirements, they are removed. If the actual spatial resolution of the image is lower than the clinical requirements, or the pixel size is too large and causes blurry details, it is still removed even if the number of pixels is ≥512×512. The OpenCV cv2.calcHist() function is used to calculate the kurtosis value of the grayscale histogram. A kurtosis threshold is set, such as kurtosis < 1.5 indicating that the image is too dark or too bright. The grayscale values ​​of the image region are extracted, and a variance threshold is set, such as variance > 100 indicating that the noise is too high. If the kurtosis of the histogram is < 1.5, it is discarded; if the variance is > 100, it is discarded. The image is Fourier transformed using OpenCV's cv2.dft() function to obtain the frequency domain spectrum. The high-frequency region of the frequency domain spectrum is extracted, and the average energy value of the region is calculated. An energy threshold is set: energy > 1000 indicates motion artifacts, and if the high-frequency energy > 1000, the image is removed.

[0024] Furthermore, in step S4, the process of removing mutual occlusion between internal organs, removing organs unrelated to the heart from the image, manually drawing the outline of the heart, and performing morphological closing operations on the drawn result to fill small holes includes: Using 3D Slicer image editing software, high-quality DICOM images output by S3 were imported, and the changing trends of occluded areas, including blood vessel orientation, were observed in adjacent slices. Based on the Erase function in the software, non-critical structures occluding the heart were erased, and based on the Brush function in the software, boundary breaks caused by erasure were repaired. Based on clinical anatomical knowledge, organs unrelated to the heart, such as the liver, stomach, and lungs, are identified. A mask is drawn along the boundary of the unrelated organ using the Paint function in the software. The mask area is filled with black. The mask is multiplied pixel by pixel with the original image, and only the heart area is retained. Using the Threshold function in the software, roughly select the heart region, switch to the freehand drawing tool, and draw the outline point by point along the heart boundary to ensure that key structures, including the root of the aortic valve, are completely preserved. Use the 3D rendering function in the software to check the continuity of the outline in adjacent slices. In OpenCV, set up structuring elements, such as a circular structure with a radius of 2 pixels. Apply the cv2.morphologyEx() function to the mask to fill the holes and smooth the boundaries. Check the filling effect through a 3D view to ensure the integrity of the heart region.

[0025] Furthermore, the pathological areas marked in S5 include valvular stenosis areas and ventricular hypertrophy areas, and the output structured label CSV format file includes: A plugin directory is created based on LabelImg, and pathological annotation modes are developed in the plugins, including predefined pathological categories such as valvular stenosis and ventricular hypertrophy. The plugin entry is defined based on plugin.py, and the annotation interface interaction logic is implemented based on main_window.py. Drag the mouse in the image to create a custom polygon bounding box. A label selection window will pop up. Select a label from predefined pathology categories, including valvular stenosis and ventricular hypertrophy. Combine the manually drawn cardiac outline described in S4 with the labeled areas of adjacent slices, display the labeling results, and dynamically adjust the bounding box position. After each image is annotated, the label information is automatically written to a CSV file. The bounding box coordinates are checked to see if they exceed the image range. If they do, a correction is prompted. The rationality of the pathology type and the annotated area is verified. For example, the ventricular hypertrophy area should not cover the lungs.

[0026] Furthermore, in S6, Unsharp Masking is used to locally sharpen the marked pathological areas, simulating imaging differences between different devices, and Gaussian noise and rotation are added to the entire image, including: Read the bounding box coordinates of the pathological region from the CSV file, generate a binary mask 0 / 1 matrix based on the coordinates, mark the location of the pathological region, and combine the mask with the original image to ensure that subsequent sharpening operations only apply to the pathological region. Gaussian blur is applied to the pathological area with a radius of 2 pixels to generate a blurred image. The difference between the original image and the blurred image is calculated to enhance the high-frequency information of the edges. The sharpening intensity is automatically adjusted according to the histogram kurtosis value described in S3. The sharpening weight is reduced for high-contrast images. Histogram equalization is applied to non-pathological areas, i.e., areas outside the mask, to expand the grayscale distribution range. Linear stretching is used to map pixel values ​​to the range of [0, 255] to highlight details. Based on the cv2.convertScaleAbs() function, the brightness value of non-pathological areas is adjusted by ±10% to simulate the exposure difference of different devices. Random offsets are added to the RGB channels, including +5% for the red channel and -3% for the blue channel, to simulate the color response difference of the devices. A Gaussian noise matrix with a mean of 0 and a standard deviation of 0.1 is generated. The noise matrix is ​​added to the original image. The pathological area is protected by a mask to ensure that it is not distorted. The standard deviation is dynamically adjusted according to the noise variance threshold in S3 to avoid noise masking the lesion features. The rotation angle is randomly selected within the range of -15° to +15° to simulate the difference in the shooting angle of the equipment. The rotation axis is taken as the center of the heart contour to ensure that the pathological area is not deformed. Bilinear interpolation is used to reduce the jagged artifacts caused by rotation.

[0027] Furthermore, in step S7, OCR technology is used to identify sensitive information in the image, replacing the patient ID in the original filename with patient number_section type_pathology label, including: OCR technology is used to recognize text content in images, including timestamps such as 2025-06-08 00:45:09 and hospital names. Patient IDs, timestamps, and hospital names are matched based on regular expressions. Based on the OCR recognition results, sensitive text areas are located, and Gaussian blur is applied to the sensitive areas with a kernel size of 15×15. Define the new file name format as Patient ID_Section Type_Pathology Label. The patient ID is automatically generated based on the patient ID. The section type is extracted based on the section label rules described in S1, such as parasternal left ventricular long axis section → LVLA. The pathology label is read from the CSV label file described in S5. Remove metadata including patient name and hospital name from the image.

[0028] Furthermore, in step S8, the Kappa coefficient for annotation consistency is calculated. Images with a Kappa coefficient below the threshold of 0.7 are reviewed by an expert panel. Stratified sampling is used to divide the dataset into training, validation, and test sets, including: Map each doctor's annotation results, including the coordinates of the valvular stenosis area and the label of the ventricular hypertrophy area, to a unified format, such as binary labels: 0 = no lesion, 1 = lesion. If doctor A annotates valvular stenosis as 1 and doctor B annotates it as 0, then the comparison will be conflicting. The actual consistency rate is the percentage of samples where all doctors have consistent annotations. The random consistency rate is the probability of random consistency based on the annotation distribution of each doctor. The Kappa coefficient is calculated as follows: (actual consistency rate - random consistency rate) / (1 - random consistency rate). When Kappa < 0.7, the original image, conflict annotations, and the CSV tag file described in S5 are attached for expert review. The review results are written into the CSV tag file to replace the original conflict annotations. Based on the CSV file described in S5, the number of samples for each pathological category, including valvular stenosis and ventricular hypertrophy, was counted, and the proportion of each pathological category in each dataset was counted, such as valvular stenosis accounting for 40% and ventricular hypertrophy accounting for 60%. Stratified sampling was used to divide the dataset into training set, validation set, and test set.

[0029] refer to Figure 1 The diagram shows a flowchart of a photo selection and processing method for training a heart disease recognition model.

[0030] Example 2 In this embodiment, two typical sample images were selected from the hospital's cardiac ultrasound image database. The pathological features of the first image are: a central type of pore II atrial septal defect with left-to-right shunt at the atrial level; the pathological features of the second image are also a central type of pore II atrial septal defect with left-to-right shunt at the atrial level, but the heart rate is abnormally high at 126 bpm.

[0031] Two typical sample images were processed, and the DICOM metadata fields (0008, 103E) were parsed to identify the keyword "Card Adult". The features of the apical four-chamber view, including the position of the atrioventricular valves and the continuity of the interventricular septum, were detected. The second image was marked as abnormal due to a heart rate of 126 bpm > 120 bpm.

[0032] The second image was subjected to Fourier transform to detect periodic stripes. The peak value was 15.7%, which is greater than the 15% threshold. Combined with the abnormal heart rate, it was determined to be a severe artifact and was directly removed. The first image had an artifact peak value of 4.2%, which was retained. The size was 1280×1024 and no modifications were made. The dark areas were repaired.

[0033] Erase the liver shadow in the image, i.e. the non-heart area in the lower right corner. Manually draw the atrial septal defect area, i.e. the red blood flow area. Use the LabelImg plugin to mark the location of the atrial septal defect, cover the blue box with a polygon, and generate a CSV label: P001_A4C_ASD_Central.

[0034] Unsharp Masking with a radius of 2px was applied to the defective area for local sharpening. Gaussian noise was added to the entire image with σ=0.1, and the RGB channels were shifted with red +5%. OCR was used to identify and blur the First Affiliated Hospital of Nanchang University. The files were renamed: P001_EPIQ7C_ASD.dcm and P002_PHILIPS_ASD.dcm. Three doctors independently annotated the files. Figure 1 The Kappa coefficient is 0.85, which is greater than the 0.7 threshold, indicating that the annotation is valid.

[0035] The dataset was constructed using stratified sampling based on pathological distribution. The pathological categories were: atrial septal defect (ASD) 65%, ventricular hypertrophy 20%, and other heart diseases 15%. The training set comprised 70% of the dataset, consisting of 455 cases of ASD, 140 cases of ventricular hypertrophy, and 105 cases of other heart diseases, all extracted according to the above proportions. The validation set comprised 15% of the dataset, consisting of 97 cases of ASD, 30 cases of ventricular hypertrophy, and 22 cases of other heart diseases, all extracted according to the above proportions. The test set comprised 15% of the dataset, consisting of 98 cases of ASD, 30 cases of ventricular hypertrophy, and 23 cases of other heart diseases, all extracted according to the above proportions.

[0036] Multi-dimensional model performance verification was conducted using YOLOv5 training. The preprocessed group B was compared with the unprocessed group A. The evaluation metrics for the unprocessed group A are shown in Table 1. Table 1 mAP is the mean precision; mAP@0.5 is the mean precision when IoU (Intersection over Union) = 0.5; mAP@0.5:0.95 is the mean precision for IoU thresholds from 0.5 to 0.95, with 10 thresholds (step size 0.05) from lenient (IoU = 0.5) to strict (IoU = 0.95), and the average precision is taken at all IoU thresholds; IoU is the percentage of overlap between the model's predicted bounding box and the doctor's labeled bounding box; sensitivity (recall) measures the model's ability to detect real lesions; F1-Score is the harmonic mean of recall and precision; false positive rate (FPR) is the proportion of actual negative samples that are incorrectly identified as positive; the Dice coefficient for lesion localization is the spatial overlap between the predicted lesion area and the doctor's labeled area. The second image of heart rate abnormality was misidentified as a shunt abnormality in group A with a confidence level of 0.83. In group B, due to the removal of this sample, the misclassification of the same type in the test set dropped to 0.

[0037] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0038] This invention provides a method for selecting and processing images for training a cardiac recognition model. By combining clinical guidelines and image analysis technology, it establishes cross-section screening rules based on DICOM metadata and anatomical features, matches standard cross-sections based on fields, quantifies the degree of motion artifacts, filters artifact images by combining heart rate and respiratory signals, uses OpenCV histogram kurtosis analysis and frequency domain high-frequency energy detection to remove low-resolution and excessively noisy images, manually segments cardiac structures and repairs boundaries using morphological closing operations, implements pathological annotation based on the LabelImg plugin, performs local sharpening and device simulation enhancement, processes sensitive information based on OCR recognition and Gaussian blur, standardizes naming, evaluates annotation consistency, constructs a training set through stratified sampling, and ensures the accuracy, integrity, and compliance of model training data through multimodal quality control, semi-automatic annotation, and privacy protection strategies.

Claims

1. A method for selecting and processing photographs for training a heart disease recognition model, characterized in that, include: S1: Establish section labeling rules based on clinical guidelines, including parasternal left ventricular long-axis section and apical four-chamber view, and select images that meet the section criteria from DICOM images based on the labeling rules; S2: Motion artifact labels are added based on the rule base containing the section label rules. The artifact labels are divided into no artifacts, mild artifacts, and severe artifacts. The degree of motion artifacts is quantified and combined with image metadata, including heart rate and respiratory signals in DICOM images. Based on images that meet the section standard, images without artifacts are selected. S3: Set the minimum resolution threshold to 512×512 pixels, remove low-resolution images, and use OpenCV's histogram analysis function to detect image contrast (including histogram kurtosis) and noise level (including variance), remove images that are too dark, too bright, or too noisy, apply Fourier transform to the retained images, detect motion artifacts in high-frequency components, and remove images with artifacts that were not completely removed in S2. S4: Based on the manual drawing function of the image editing tool, remove the mutual occlusion between internal organs, remove organs unrelated to the heart in the image, retain only the boundary information of the heart and its surrounding blood vessels, manually draw the outline of the heart, cover all key structures including the left ventricle and aortic valve, and perform morphological closure operation on the outline result to fill small holes based on the integrity of the heart region. S5: Using a LabelImg-based plugin, pathological areas, including valvular stenosis and ventricular hypertrophy, are annotated, and a structured label CSV file is output. S6: Unsharp Masking is used to locally sharpen the marked pathological areas to enhance lesion features, contrast stretching is applied to non-pathological areas to simulate imaging differences between different devices, Gaussian noise and rotation are added to the entire image, and the pathological areas are preserved without distortion. S7: Use OCR technology to identify sensitive information in the image, including text labels and timestamps, perform blurring, replace the patient ID in the original file name with patient number_section type_pathology label, and delete metadata in the image including patient name and hospital name; S8: Based on the annotation results of different doctors on the same batch of images, calculate the annotation consistency Kappa coefficient. For images with a consistency Kappa coefficient lower than the threshold of 0.7, conduct expert review. Based on the distribution of each pathological category, use stratified sampling to divide the training set, validation set, and test set.

2. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S1, section labeling rules are established based on clinical guidelines. Images that meet the sectioning criteria are then selected from DICOM images based on these labeling rules. This includes: According to the guidelines for echocardiography, the standard section types are defined, including the parasternal left ventricular long-axis section and the apical four-chamber section. The anatomical features corresponding to each section, including the aortic valve position and the continuity of the interventricular septum, are converted into quantifiable label rules. Create a structured table, associate the section type with DICOM images and anatomical features, read the metadata of the DICOM images, match it with the rule base, and generate preliminary labels; Based on the description field in the DICOM image, images containing keywords of the target section are selected. The selected images are reviewed, and images that are misclassified are marked. Based on the review results, the keyword and anatomical feature matching rules in the rule base are updated.

3. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S2, motion artifact labels are added based on a rule base containing section label rules. The degree of motion artifacts is quantified and combined with image metadata to filter artifact-free images based on images that meet the section criteria. This includes: The Laplacian operator was used to calculate the image blur index variance. The higher the blur, the more severe the motion artifacts. Fourier transform was used to detect periodic stripes in the image, and the stripe intensity distribution was statistically analyzed. Based on the extracted feature values, the image was divided into three categories: no artifacts, mild artifacts, and severe artifacts. The label for no artifacts was blur variance <100 and stripe intensity peak <5%; the label for mild artifacts was blur variance 100-300 and stripe intensity peak 5%-15%; and the label for severe artifacts was blur variance >300 and stripe intensity peak >15%. Based on medical imaging standards, the above definitions are transformed into quantifiable image feature rules, and the motion artifact labeling rule base is embedded into the section labeling rule base established in S1 to form a joint rule base. Heart rate and respiratory signal data are extracted from DICOM images. If an image is marked as having severe artifacts, it is directly removed regardless of the heart rate and respiratory signal. If an image is marked as having mild artifacts, it is upgraded to severe artifacts and removed if either the heart rate is >120 beats / minute or the respiratory signal is abnormal. If an image is marked as having no artifacts and the heart rate and respiratory signal are normal, it is filtered and retained.

4. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, The process of removing low-resolution images in S3, removing images that are too dark, too bright, or too noisy, and removing images with artifacts that were not completely removed in S2, includes: According to clinical imaging standards, the minimum resolution threshold is set to 512×512 pixels. The pixel size is extracted from the metadata of the DICOM image, the actual spatial resolution is calculated, and the images output by S2 are traversed to check whether their width and height are both ≥512 pixels. If they do not meet the requirements, they are removed. If the actual spatial resolution of the image is lower than the clinical requirement, it is still removed even if the number of pixels is ≥512×512. OpenCV is used to calculate the kurtosis value of the gray-level histogram. A kurtosis threshold is set, and gray-level values ​​of image regions are extracted. A variance threshold is set, and images with a kurtosis < 1.5 are removed, and images with a variance > 100 are removed. OpenCV is used to perform Fourier transform on the image to obtain the frequency domain spectrum. The high-frequency region of the frequency domain spectrum is extracted, the average energy value of the region is calculated, and an energy threshold is set. If the high-frequency energy is >1000, the image is removed.

5. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S4, the process involves removing mutual occlusion between internal organs, removing organs unrelated to the heart from the image, manually drawing the heart's outline, and performing morphological closing operations on the drawn result to fill small holes. This includes: Using 3D Slicer image editing software, high-quality DICOM images output by S3 were imported, and the changing trends of occluded areas, including blood vessel orientation, were observed in adjacent slices. Based on the Erase function in the software, non-critical structures occluding the heart were erased, and based on the Brush function in the software, boundary breaks caused by erasure were repaired. Based on clinical anatomical knowledge, organs unrelated to the heart are identified. Using the Paint function in the software, a mask is drawn along the boundary of the unrelated organ. The mask area is filled with black. The mask is multiplied pixel by pixel with the original image, and only the heart area is retained. Using the Threshold function in the software, select the heart region, switch to the freehand drawing tool, and draw the outline point by point along the heart boundary to ensure that key structures, including the root of the aortic valve, are completely preserved. Use the 3D rendering function in the software to check the continuity of the outline in adjacent slices. In OpenCV, set up structuring elements, fill holes, and smooth the boundaries. Check the filling effect through a 3D view.

6. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, The pathological areas marked in S5 include valvular stenosis areas and ventricular hypertrophy areas, and the output is a structured tagged CSV file, including: A plugin directory is created based on LabelImg. Pathological annotation modes are developed in the plugins, including predefined pathological categories such as valvular stenosis and ventricular hypertrophy. The plugin entry point is defined, and the annotation interface interaction logic is implemented. Drag the mouse in the image to create a custom polygon bounding box. A label selection window will pop up. Select a label from the predefined pathology categories. Combine the manually drawn heart outline described in S4 with the labeled areas of adjacent slices. Display the labeling results and dynamically adjust the bounding box position. After each image is annotated, the label information is automatically written to a CSV file. The bounding box coordinates are checked to see if they exceed the image range. If they do, a correction is prompted, and the rationality of the pathology type and the annotated area is verified.

7. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S6, Unsharp Masking is used to locally sharpen the marked pathological areas, simulating imaging differences between different devices. Gaussian noise and rotation are added to the entire image, including: Read the bounding box coordinates of the pathological region from the CSV file, generate a binary mask based on the coordinates, mark the location of the pathological region, and combine the mask with the original image to ensure that subsequent sharpening operations only apply to the pathological region. Gaussian blur is applied to the pathological area with a radius of 2 pixels to generate a blurred image. The difference between the original image and the blurred image is calculated. The sharpening intensity is automatically adjusted according to the histogram kurtosis value described in S3. The sharpening weight is reduced for high-contrast images. Histogram equalization is applied to non-pathological areas to expand the grayscale distribution range, and linear stretching is used to map pixel values ​​to the range of [0,255]. The brightness values ​​of non-pathological areas were adjusted by ±10% to simulate the exposure differences of different devices. Random offsets were added to the RGB channels, including +5% for the red channel and -3% for the blue channel, to simulate the differences in color response of different devices. Generate a Gaussian noise matrix with a mean of 0 and a standard deviation of 0.

1. Add the noise matrix to the original image and dynamically adjust the standard deviation according to the noise variance threshold described in S3. The rotation angle is randomly selected within the range of -15° to +15° to simulate the difference in the shooting angle of the device. The rotation axis is the center of the heart contour, and bilinear interpolation is used.

8. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S7, OCR technology is used to identify sensitive information in the image, replacing the patient ID in the original filename with patient number_section type_pathology label, including: OCR technology is used to recognize text content in images, identify timestamps and hospital names, match patient IDs, timestamps and hospital names based on regular expressions, locate sensitive text areas based on OCR recognition results, apply Gaussian blur to sensitive areas, and set the kernel size to 15×15. Define the new file name format as Patient ID_Section Type_Pathology Label. The patient ID is automatically generated based on the patient ID, the section type is extracted based on the section label rules described in S1, and the pathology label is read from the CSV label file described in S5. Remove metadata including patient name and hospital name from the image.

9. The method for selecting and processing photographs for training a heart disease recognition model as described in claim 1, characterized in that, In step S8, the Kappa coefficient of annotation consistency is calculated. Images with a Kappa coefficient below the threshold of 0.7 are reviewed by an expert meeting. Stratified sampling is used to divide the dataset into training, validation, and test sets, including: Map each doctor's annotation results to a uniform format, including binary labels: 0 = no lesion, 1 = lesion present; The actual consistency rate is the percentage of samples where all doctors have consistent annotations. The random consistency rate is the probability of random consistency based on the annotation distribution of each doctor. The Kappa coefficient is calculated as follows: (actual consistency rate - random consistency rate) / (1 - random consistency rate). When Kappa < 0.7, the original image, conflict annotations, and the CSV tag file described in S5 are attached for expert review. The review results are written into the CSV tag file to replace the original conflict annotations. Based on the CSV file described in S5, the number of samples for each pathological category is counted, the proportion of each pathological category in each dataset is calculated, and stratified sampling is used to divide the dataset into training set, validation set, and test set.

Citation Information

Patent Citations

  • Congenital heart disease auxiliary diagnosis method based on multi-visual-angle cooperation relation

    CN110164550A

  • Model training method and device, and motion artifact identification and prompting method and device

    CN115797729A

  • Section recognition method, device and equipment of cardiac ultrasound image and medium

    CN118097236A

  • AI-based fetal congenital heart disease evaluation and detection method, system and medium

    CN118522451A

  • Heart segmentation method based on dual-path convolution hybrid coding enhancement

    CN118608486A