X-ray image foreign matter multi-label labeling method
By adopting multiple label labeling methods in food X -ray images, foreign matter in the food in the food is detailed, and the problem of accuracy and generalization capabilities of single labels in the case of many foreign objects, obvious differences, and complicated backgrounds can be solved. Higher foreign object recognition accuracy and model robustness.
Patent Information
- Application Number
- CN202411450798.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-21
AI Technical Summary
In the case of many foreign objects in food, obvious differences and complex backgrounds, the single-label annotation method leads to difficulty in positioning foreign objects, scale distortion and feature extraction, resulting in reduced model accuracy and generalization ability.
The method of multi-label labeling of foreign objects in X-ray images is adopted. By acquiring food X-ray images, a foreign object label set is formulated, and the Labelimg open source image annotation tool is used to perform multi-label labeling of foreign objects.
Significantly increases the richness of foreign body information, helps the model more accurately identify various types of foreign bodies, improves the model's robustness to changes in shape and size differences, and effectively enhances the accuracy and generalization capabilities of the model.
Smart Images

Figure CN119339379A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a multi-label annotation method for foreign bodies in X-ray images. Background Art
[0002] In related technologies, deep learning is generally used to detect foreign matter in food. A single label is used to mark foreign matter in food. When the type of foreign matter to be detected is relatively single, it is more appropriate to use a single label for identification and detection. However, when there are many types of foreign matter in the sample, the differences are obvious, and the background is complex, if the labeling work continues to use a single label, there will be problems such as difficulty in locating foreign matter, scale distortion, and difficulty in feature extraction, making it difficult for the model to learn the common characteristics of all foreign matter, resulting in reduced accuracy and generalization ability of the model. In order to improve the accuracy and generalization ability of the model, a multi-label foreign matter labeling method is proposed to address the problem of a large number of foreign matter types, obvious differences, and complex background. Summary of the invention
[0003] In view of the shortcomings of the prior art, the present invention solves the technical problems by adopting a technical solution: a method for labeling foreign bodies in X-ray images with multiple labels, comprising the following steps:
[0004] S1. Obtaining food X-ray images;
[0005] S2, formulating a foreign body label set according to the shape features of all foreign bodies in the X-ray image;
[0006] S3. Label the foreign matter in the food X-ray image according to the foreign matter label set.
[0007] Preferably, the food X-ray image in S1 is acquired by an X-ray machine to serve as the food data set for the experiment.
[0008] Preferably, the labels in the foreign object label set in S2 include points, shortlines, balls, blocks, longlines, rings, longstrips, screws, nuts, clips and springs.
[0009] Preferably, the foreign object category corresponding to the label points is point-shaped, the foreign object category corresponding to the label shortlines is short wire-shaped, the foreign object category corresponding to the label balls is spherical, the foreign object category corresponding to the label blocks is block-shaped, the foreign object category corresponding to the label longlines is filament-shaped, the foreign object category corresponding to the label rings is ring-shaped, the foreign object category corresponding to the label longstrips is strip-shaped, the foreign object category corresponding to the label screws is screws, the foreign object category corresponding to the label nuts is nuts, the foreign object category corresponding to the label clips is paper clips, and the foreign object category corresponding to the label springs is springs.
[0010] Preferably, the dot-shaped and short-thread-shaped foreign bodies correspond to the test card foreign bodies.
[0011] Preferably, the spherical, block-shaped, filamentous, ring-shaped and long strip-shaped foreign bodies correspond to irregular foreign bodies.
[0012] Preferably, the screws, nuts, paper clips and springs correspond to specific types of foreign matter.
[0013] Preferably, the foreign body annotation in S3 uses the Label img open source image annotation tool.
[0014] Preferably, the use of the Label img open source image annotation tool requires first opening the image file to be annotated, selecting the appropriate annotation tool on the toolbar, using the annotation tool to draw the corresponding shape on the image, and adding a category label to it, and saving the annotation result
[0015] The beneficial effects of the present invention are as follows:
[0016] The present invention uses a multi-label annotation method for food X-ray images for target detection, which can significantly increase the richness of foreign matter information, thereby helping the model to more accurately identify various types of foreign matter. In addition, the multi-label annotation method enables the model to learn the intrinsic associations and differences between different labels, which not only improves the model's robustness to changes in shape and size differences, but also effectively enhances the model's accuracy and generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is the food X-ray image of the present invention;
[0018] Figure 2 This is an effect diagram of multi-label annotation in the present invention. DETAILED DESCRIPTION
[0019] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0020] A multi-label annotation method for foreign bodies in X-ray images, comprising the following steps:
[0021] S1. Obtaining food X-ray images;
[0022] S2, formulating a foreign body label set according to the shape features of all foreign bodies in the X-ray image;
[0023] S3. Label the foreign matter in the food X-ray image according to the foreign matter label set.
[0024] like Figure 1 As shown in Figure 1, food X-ray images are obtained through an X-ray machine. The food dataset for the experiment includes 8 types of food, including dried fish, flavored food, shrimp balls, bread, hawthorn balls, hawthorn bars, ice cream and condiments.
[0025] The labels in the foreign body label set include points, shortlines, balls, blocks, longlines, rings, longstrips, screws, nuts, clips and springs, as shown in the following table (foreign body label set):
[0026]
[0027] Among them, the foreign object category corresponding to the label points is the point category, the foreign object category corresponding to the label shortlines is the short wire category, the foreign object category corresponding to the label balls is the spherical category, the foreign object category corresponding to the label blocks is the block category, the foreign object category corresponding to the label longlines is the filamentary category, the foreign object category corresponding to the label rings is the ring category, the foreign object category corresponding to the label longstrips is the long strip category, the foreign object category corresponding to the label screws is the screw category, the foreign object category corresponding to the label nuts is the nut category, the foreign object category corresponding to the label clips is the paper clip category, and the foreign object category corresponding to the label springs is the spring category; the point category and the short wire category correspond to the test card foreign objects, the spherical category, the block category, the filamentary category, the ring category and the long strip category correspond to the irregular category foreign objects, and the screw category, the nut category, the paper clip category and the spring category correspond to the specific category foreign objects.
[0028] like Figure 2 As shown, foreign body annotation is performed using the Labelimg open source image annotation tool. To use the Labelimg open source image annotation tool, you need to first open the image file to be annotated, select the appropriate annotation tool on the toolbar, such as rectangle, ellipse, polygon, etc., use the annotation tool to draw the corresponding shape on the image, add category labels to it, and save the annotation results.
[0029] Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field and related fields without creative work should fall within the scope of protection of the present invention. The structures, devices and operating methods not specifically described and explained in the present invention are implemented according to the conventional means in the field unless otherwise specified and limited.
Claims
1. A multi-label annotation method for foreign bodies in X-ray images, characterized in that: The following steps are involved: S1. Obtaining food X-ray images; S2, formulating a foreign body label set according to the shape features of all foreign bodies in the X-ray image; S3. Label the foreign matter in the food X-ray image according to the foreign matter label set.
2. The method for labeling foreign matter in X-ray images according to claim 1, characterized in that: The food X-ray images in S1 are acquired by an X-ray machine and serve as a food dataset for the experiment.
3. The method for labeling foreign matter in X-ray images according to claim 1, characterized in that: The labels in the foreign object label set in S2 include points, shortlines, balls, blocks, longlines, rings, longstrips, screws, nuts, clips and springs.
4. The method for labeling foreign matter in X-ray images according to claim 3, characterized in that: The foreign object category corresponding to the label points is point-shaped, the foreign object category corresponding to the label shortlines is short wire-shaped, the foreign object category corresponding to the label balls is spherical, the foreign object category corresponding to the label blocks is block-shaped, the foreign object category corresponding to the label longlines is filament-shaped, the foreign object category corresponding to the label rings is ring-shaped, the foreign object category corresponding to the label longstrips is long strips, the foreign object category corresponding to the label screws is screws, the foreign object category corresponding to the label nuts is nuts, the foreign object category corresponding to the label clips is paper clips, and the foreign object category corresponding to the label springs is springs.
5. The method for labeling foreign matter in X-ray images according to claim 4, characterized in that: The dot-shaped and short-thread-shaped objects correspond to the foreign bodies on the test card.
6. The method for labeling foreign matter in X-ray images according to claim 4, characterized in that: The spherical, block-shaped, filamentous, ring-shaped and long strip-shaped foreign bodies correspond to irregular foreign bodies.
7. The method for labeling foreign matter in X-ray images according to claim 4, characterized in that: The screws, nuts, paper clips and springs correspond to specific types of foreign matter.
8. The method for labeling foreign matter in X-ray images according to claim 1, characterized in that: The foreign objects in S3 are annotated using the Labelimg open source image annotation tool.
9. The method for labeling foreign matter in X-ray images according to claim 8, characterized in that: To use the Labelimg open source image annotation tool, you need to first open the image file to be annotated, select the appropriate annotation tool on the toolbar, use the annotation tool to draw the corresponding shape on the image, add a category label to it, and save the annotation result.