Sample label distribution method and device, equipment and storage medium
The method automates sample label assignment by analyzing image features and angles, reducing time and error, thus improving efficiency and accuracy in label allocation.
Patent Information
- Application Number
- CN202411263403.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2025-01-03
AI Technical Summary
The existing process of allocating sample labels in the target area is cumbersome, consuming significant human and time resources and being prone to human factor errors, which hinders efficiency improvements.
A method that utilizes image processing and machine learning techniques to automatically assign sample labels by analyzing feature maps, calculating centroid distances and intersection-over-union ratios, and determining principal axis angles to assign labels to targets in the image.
Reduces the time required for sample label allocation and eliminates human factor errors, enhancing the efficiency and accuracy of the label assignment process.
Smart Images

Figure CN119251444A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and financial technology, and in particular to a sample label assignment method, device, equipment and storage medium. Background Art
[0002] As a learning goal, sample labels directly guide the model on how to understand and map input data to the desired output results, which is the cornerstone of supervised learning. In machine learning or deep learning, clear sample labels help ensure that the model learns the correct features and rules.
[0003] However, the existing process of allocating sample labels in the target area is cumbersome, which is not conducive to improving the efficiency of sample label allocation. The reason is that in the case of the first target and the second target in the target area, the existing technology mainly uses manual allocation to allocate sample labels in the target area, and the manual allocation method consumes a lot of human resources and time resources, increases the allocation time of sample labels in the target area, and is easily affected by human factors, so it is not conducive to improving the efficiency of sample label allocation. Summary of the invention
[0004] The present invention provides a sample label allocation method, device, computer equipment and storage medium to solve the technical problem that the existing sample label allocation process of the target area is cumbersome and is not conducive to improving the sample label allocation efficiency.
[0005] In a first aspect, a sample label assignment method is provided, comprising:
[0006] Acquire an image to be processed, and acquire a feature map of the image to be processed;
[0007] According to the feature map, a target area is acquired, a first target and a second target existing in the target area are acquired, a first candidate box corresponding to the first target is acquired, and a second candidate box corresponding to the second target is acquired;
[0008] Obtaining a centroid distance between the first candidate box and the second candidate box, and obtaining an intersection-over-union ratio between the first candidate box and the second candidate box;
[0009] When the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining a principal axis of the first candidate box and obtaining a principal axis of the second candidate box;
[0010] According to the main axis of the first candidate frame and a predefined first acquisition method, a first main axis angle of the first candidate frame is acquired, and according to the main axis of the second candidate frame and a predefined second acquisition method, a second main axis angle of the second candidate frame is acquired;
[0011] According to the first main axis angle, a first sample label is obtained, according to the second main axis angle, a second sample label is obtained, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
[0012] Further, acquiring a target area according to the feature map, acquiring a first target and a second target existing in the target area, acquiring a first candidate box corresponding to the first target, and acquiring a second candidate box corresponding to the second target, includes:
[0013] Inputting the feature map into a region proposal network to obtain a target region output by the region proposal network based on the feature map;
[0014] When there are two targets in the target area, a first target and a second target of the two targets are obtained, a first candidate frame corresponding to the first target is obtained, and a second candidate frame corresponding to the second target is obtained.
[0015] Further, the obtaining of the centroid distance between the first candidate box and the second candidate box, and the obtaining of the intersection-over-union ratio between the first candidate box and the second candidate box include:
[0016] generating a centroid distance between the first candidate box and the second candidate box according to the center point coordinates of the first candidate box and the center point coordinates of the second candidate box;
[0017] An intersection area and a union area between the first candidate box and the second candidate box are obtained, and an intersection-and-union ratio between the first candidate box and the second candidate box is generated according to the intersection area and the union area, where the intersection-and-union ratio is a ratio of the intersection area to the union area.
[0018] Further, when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining the principal axis of the first candidate box and obtaining the principal axis of the second candidate box include:
[0019] When the centroid distance is less than a preset distance and the intersection-over-union ratio is greater than a preset value, obtaining the long side of the first candidate box and obtaining the long side of the second candidate box;
[0020] An axis parallel to the long side of the first candidate box is selected as the main axis of the first candidate box; an axis parallel to the long side of the second candidate box is selected as the main axis of the second candidate box.
[0021] Further, acquiring a first main axis angle of the first candidate frame according to the main axis of the first candidate frame and a predefined first acquisition method, and acquiring a second main axis angle of the second candidate frame according to the main axis of the second candidate frame and a predefined second acquisition method, includes:
[0022] Obtaining a first slope corresponding to the main axis of the first candidate frame, determining a first angle between the main axis of the first candidate frame and the horizontal direction of the coordinate system according to the first slope and an inverse tangent function, and selecting the first angle as a first main axis angle of the first candidate frame;
[0023] Obtain a second slope corresponding to the main axis of the second candidate box, determine a second angle between the main axis of the second candidate box and the horizontal direction of the coordinate system based on the second slope and the inverse tangent function, and select the second angle as the second main axis angle of the second candidate box.
[0024] Further, acquiring a first sample label according to the first main axis angle, acquiring a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target includes:
[0025] Obtaining a first difference between the first spindle angle and a preset angle, and obtaining a second difference between the second spindle angle and the preset angle;
[0026] When the first difference is smaller than the second difference, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
[0027] Further, after obtaining a first sample label according to the first main axis angle, obtaining a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target, the sample label assignment method includes:
[0028] A display page corresponding to the image to be processed is obtained, and the first sample label and the second sample label are displayed in the display page.
[0029] In a second aspect, a sample label distribution device is provided, comprising:
[0030] A first acquisition module, used to acquire an image to be processed and acquire a feature map of the image to be processed;
[0031] A second acquisition module is used to acquire a target area according to the feature map, acquire a first target and a second target in the target area, acquire a first candidate box corresponding to the first target, and acquire a second candidate box corresponding to the second target;
[0032] A third acquisition module is used to acquire a centroid distance between the first candidate box and the second candidate box, and acquire an intersection-over-union ratio between the first candidate box and the second candidate box;
[0033] A fourth acquisition module, configured to acquire the principal axis of the first candidate box and the principal axis of the second candidate box when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition;
[0034] a fifth acquisition module, configured to acquire a first main axis angle of the first candidate frame according to the main axis of the first candidate frame and a predefined first acquisition method, and acquire a second main axis angle of the second candidate frame according to the main axis of the second candidate frame and a predefined second acquisition method;
[0035] An allocation module is used to obtain a first sample label according to the first main axis angle, obtain a second sample label according to the second main axis angle, allocate the first sample label to the first target, and allocate the second sample label to the second target.
[0036] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned sample label assignment method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned sample label assignment method are implemented.
[0038] The present application provides a sample label assignment method, apparatus, computer equipment and storage medium, which obtain an image to be processed and a feature map of the image to be processed; according to the feature map, obtain a target area, obtain a first target and a second target in the target area, obtain a first candidate box corresponding to the first target, and obtain a second candidate box corresponding to the second target; obtain a centroid distance between the first candidate box and the second candidate box, and obtain an intersection-and-union ratio between the first candidate box and the second candidate box; when the centroid distance satisfies a first condition and the intersection-and-union ratio satisfies a second condition, obtain the main axis of the first candidate box and obtain the main axis of the second candidate box; according to the main axis of the first candidate box and a predefined first acquisition method, obtain a first main axis angle of the first candidate box, and according to the main axis of the second candidate box and a predefined second acquisition method, obtain the main axis angle of the second candidate box. The second principal axis angle of the second candidate box; according to the first principal axis angle, obtain the first sample label, according to the second principal axis angle, obtain the second sample label, assign the first sample label to the first target, and assign the second sample label to the second target. The beneficial effects are in two aspects. On the one hand, according to the first principal axis angle, obtain the first sample label, according to the second principal axis angle, obtain the second sample label, assign the first sample label to the first target, and assign the second sample label to the second target. Since no manual allocation is required, the allocation time of the sample labels in the target area is reduced, which is conducive to improving the allocation efficiency of the sample labels in the target area; on the other hand, assigning the first sample label to the first target and assigning the second sample label to the second target will not be affected by human factors, which is conducive to improving the allocation effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 is a schematic diagram of an application environment of a sample label assignment method according to an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of a sample label assignment method provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4yes Figure 1 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 is a structural schematic diagram of a sample label distribution device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an application environment of a sample label assignment method according to an embodiment of the present invention. The sample label assignment method provided by the embodiment of the present invention can be applied in the following embodiments: Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains the image to be processed through the client, and obtains a feature map of the image to be processed;
[0051] According to the feature map, a target area is acquired, a first target and a second target existing in the target area are acquired, a first candidate box corresponding to the first target is acquired, and a second candidate box corresponding to the second target is acquired;
[0052] Obtaining a centroid distance between the first candidate box and the second candidate box, and obtaining an intersection-over-union ratio between the first candidate box and the second candidate box;
[0053] When the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining a principal axis of the first candidate box and obtaining a principal axis of the second candidate box;
[0054] According to the main axis of the first candidate frame and a predefined first acquisition method, a first main axis angle of the first candidate frame is acquired, and according to the main axis of the second candidate frame and a predefined second acquisition method, a second main axis angle of the second candidate frame is acquired;
[0055] According to the first main axis angle, a first sample label is obtained, according to the second main axis angle, a second sample label is obtained, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
[0056] In the scheme implemented by the above-mentioned sample label allocation method, device, equipment and medium, the beneficial effects are in two aspects. On the one hand, according to the first main axis angle, the first sample label is obtained, and according to the second main axis angle, the second sample label is obtained, and the first sample label is allocated to the first target, and the second sample label is allocated to the second target. Since no manual allocation is required, the allocation time of the sample labels in the target area is reduced, which is conducive to improving the allocation efficiency of the sample labels in the target area; on the other hand, the allocation of the first sample label to the first target and the allocation of the second sample label to the second target will not be affected by human factors, which is conducive to improving the allocation effect.
[0057] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0058] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0059] See also Figure 2 , Figure 2 A flow chart of a sample label assignment method provided by an embodiment of the present invention includes the following steps:
[0060] S21, obtaining an image to be processed, and obtaining a feature map of the image to be processed;
[0061] Exemplarily, obtaining an image to be processed and obtaining a feature map of the image to be processed includes:
[0062] Connect the image acquisition device of the target system, obtain the image to be processed sent by the image acquisition device, and obtain the feature map of the image to be processed through the backbone network of the instance segmentation model.
[0063] Among them, the target systems include insurance systems, banking systems, and financial systems.
[0064] For the sake of illustration, an example is given below:
[0065] The image acquisition device of the target system is a surveillance camera, which is installed above the intersection and covers the zebra crossing area. When a vehicle passes the zebra crossing at a certain speed, a pedestrian is crossing the road on the zebra crossing. The surveillance camera captures the image at this moment, which is the image to be processed.
[0066] S22, acquiring a target area according to the feature map, acquiring a first target and a second target in the target area, acquiring a first candidate box corresponding to the first target, and acquiring a second candidate box corresponding to the second target;
[0067] Among them, the first target is the first target to be identified;
[0068] The second target is the second target to be identified.
[0069] Wherein, acquiring the target area according to the feature map, acquiring the first target and the second target existing in the target area, acquiring the first candidate box corresponding to the first target, and acquiring the second candidate box corresponding to the second target, comprises:
[0070] Inputting the feature map into a region proposal network to obtain a target region output by the region proposal network based on the feature map;
[0071] When there are two targets in the target area, a first target and a second target of the two targets are obtained, a first candidate frame corresponding to the first target is obtained, and a second candidate frame corresponding to the second target is obtained.
[0072] Exemplarily, inputting the feature map into a region proposal network, and obtaining a target region output by the region proposal network based on the feature map includes:
[0073] The feature map is input into a region proposal network of an instance segmentation model to obtain a target region output by the region proposal network based on the feature map.
[0074] S23, obtaining a centroid distance between the first candidate box and the second candidate box, and obtaining an intersection-over-union ratio between the first candidate box and the second candidate box;
[0075] S24, when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining a principal axis of the first candidate box and obtaining a principal axis of the second candidate box;
[0076] Wherein, when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining the principal axis of the first candidate frame and obtaining the principal axis of the second candidate frame include:
[0077] When the centroid distance is less than a preset distance and the intersection-over-union ratio is greater than a preset value, obtaining the long side of the first candidate box and obtaining the long side of the second candidate box;
[0078] An axis parallel to the long side of the first candidate box is selected as the main axis of the first candidate box; an axis parallel to the long side of the second candidate box is selected as the main axis of the second candidate box.
[0079] S25, acquiring a first main axis angle of the first candidate box according to the main axis of the first candidate box and a predefined first acquisition method, and acquiring a second main axis angle of the second candidate box according to the main axis of the second candidate box and a predefined second acquisition method;
[0080] S26, acquiring a first sample label according to the first main axis angle, acquiring a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target.
[0081] The first sample label is assigned to the first target, and the first target can be identified by the first sample label. The second sample label is assigned to the second target, and the second target can be identified by the second sample label.
[0082] Wherein, obtaining a first sample label according to the first main axis angle, obtaining a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target includes:
[0083] Obtaining a first difference between the first spindle angle and a preset angle, and obtaining a second difference between the second spindle angle and the preset angle;
[0084] Among them, the preset angles include 0 degrees, 45 degrees, 90 degrees, -90 degrees, and -45 degrees.
[0085] When the first difference is smaller than the second difference, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
[0086] For the sake of illustration, an example is given below:
[0087] For example, the first sample label is vehicle, and the second sample label is zebra crossing;
[0088] When a vehicle passes the zebra crossing at a certain speed, a pedestrian is crossing the road on the zebra crossing. The surveillance camera captures the image at this moment, and the image at this moment is the image to be processed.
[0089] Since the front of the vehicle has crossed the zebra crossing, but the rear of the vehicle has not completely passed through, the vehicle and the zebra crossing partially overlap in the target area of the image to be processed, so there are two targets in the target area, a first target and a second target of the two targets are obtained, a first candidate frame corresponding to the first target is obtained, and a second candidate frame corresponding to the second target is obtained;
[0090] In an actual road scene, a zebra crossing usually has a clear vertical direction, a first difference between the first principal axis angle and 90 degrees is obtained, and a second difference between the second principal axis angle and 90 degrees is obtained;
[0091] When the first difference is smaller than the second difference, the zebra crossing is assigned to the first target, and the vehicle is assigned to the second target.
[0092] After obtaining a first sample label according to the first main axis angle, obtaining a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target, the sample label assignment method includes:
[0093] A display page corresponding to the image to be processed is obtained, and the first sample label and the second sample label are displayed in the display page.
[0094] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, a first sample label is obtained according to the first main axis angle, and a second sample label is obtained according to the second main axis angle. The first sample label is assigned to the first target, and the second sample label is assigned to the second target. Since no manual assignment is required, the assignment time of sample labels in the target area is reduced, which is beneficial to improving the assignment efficiency of sample labels in the target area. On the other hand, the assignment of the first sample label to the first target and the assignment of the second sample label to the second target will not be affected by human factors, which is beneficial to improving the assignment effect.
[0095] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0096] S31, generating a centroid distance between the first candidate box and the second candidate box according to the center point coordinates of the first candidate box and the center point coordinates of the second candidate box;
[0097] The center of gravity distance is used to evaluate the proximity of the first candidate frame and the second candidate frame in terms of position. The smaller the center of gravity distance is, the closer the first candidate frame and the second candidate frame are in terms of position.
[0098] S32, obtaining the intersection area and the union area between the first candidate box and the second candidate box, and generating an intersection-and-union ratio between the first candidate box and the second candidate box based on the intersection area and the union area, wherein the intersection-and-union ratio is the ratio of the intersection area to the union area.
[0099] The intersection-in-union ratio is used to evaluate the similarity between the first candidate box and the second candidate box in terms of shape. The intersection-in-union ratio is a value between 0 and 1. The higher the intersection-in-union ratio, the more overlap there is between the first candidate box and the second candidate box, that is, the closer the first candidate box and the second candidate box are in terms of shape.
[0100] In the embodiment of the present invention, the proximity between the first candidate box and the second candidate box in terms of position and shape may be determined through the centroid distance and the intersection-over-union ratio.
[0101] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0102] S41, obtaining a first slope corresponding to the main axis of the first candidate box, determining a first angle between the main axis of the first candidate box and the horizontal direction of the coordinate system according to the first slope and an inverse tangent function, and selecting the first angle as a first main axis angle of the first candidate box;
[0103] S42, obtain the second slope corresponding to the main axis of the second candidate box, determine the second angle between the main axis of the second candidate box and the horizontal direction of the coordinate system according to the second slope and the inverse tangent function, and select the second angle as the second main axis angle of the second candidate box.
[0104] In the embodiment of the present invention, since manual allocation is not required, the allocation time of sample labels in the target area is reduced, which is beneficial to improving the allocation efficiency of sample labels in the target area.
[0105] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0106] S51, obtaining a first difference between the first spindle angle and a preset angle, and obtaining a second difference between the second spindle angle and a preset angle;
[0107] S52: When the first difference is smaller than the second difference, assigning the first sample label to the first target, and assigning the second sample label to the second target.
[0108] In the embodiment of the present invention, since manual allocation is not required, the allocation time of sample labels in the target area is reduced, which is beneficial to improving the allocation efficiency of sample labels in the target area.
[0109] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of a structure of a sample label distribution device according to an embodiment of the present invention. Figure 6 As shown, the sample label distribution device includes a first acquisition module 101, a second acquisition module 102, a third acquisition module 103, a fourth acquisition module 104, a fifth acquisition module 105, and a distribution module 106. The functional modules are described in detail as follows:
[0110] A first acquisition module 101 is used to acquire an image to be processed and acquire a feature map of the image to be processed;
[0111] A second acquisition module 102 is used to acquire a target area according to the feature map, acquire a first target and a second target in the target area, acquire a first candidate box corresponding to the first target, and acquire a second candidate box corresponding to the second target;
[0112] A third acquisition module 103 is used to acquire a centroid distance between the first candidate box and the second candidate box, and acquire an intersection-over-union ratio between the first candidate box and the second candidate box;
[0113] A fourth acquisition module 104 is configured to acquire the main axis of the first candidate box and the main axis of the second candidate box when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition;
[0114] A fifth acquisition module 105, configured to acquire a first main axis angle of the first candidate frame according to the main axis of the first candidate frame and a predefined first acquisition method, and acquire a second main axis angle of the second candidate frame according to the main axis of the second candidate frame and a predefined second acquisition method;
[0115] The allocation module 106 is used to obtain a first sample label according to the first main axis angle, obtain a second sample label according to the second main axis angle, allocate the first sample label to the first target, and allocate the second sample label to the second target.
[0116] In one embodiment, the second acquisition module 102 includes:
[0117] A first acquisition subunit is used to input the feature map into a region proposal network to obtain a target region output by the region proposal network based on the feature map;
[0118] The second acquisition subunit is used for acquiring a first target and a second target of the two targets when there are two targets in the target area, acquiring a first candidate frame corresponding to the first target, and acquiring a second candidate frame corresponding to the second target.
[0119] In one embodiment, the third acquisition module 103 includes:
[0120] a generating subunit, configured to generate a centroid distance between the first candidate box and the second candidate box according to the center point coordinates of the first candidate box and the center point coordinates of the second candidate box;
[0121] The third acquisition subunit is used to obtain the intersection area and the union area between the first candidate box and the second candidate box, and generate an intersection-and-union ratio between the first candidate box and the second candidate box based on the intersection area and the union area, where the intersection-and-union ratio is the ratio of the intersection area to the union area.
[0122] In one embodiment, the fourth acquisition module 104 includes:
[0123] a fourth acquisition subunit, configured to acquire the long side of the first candidate box and the long side of the second candidate box when the centroid distance is less than a preset distance and the intersection-over-union ratio is greater than a preset value;
[0124] A selection subunit is used to select an axis parallel to the long side of the first candidate box as the main axis of the first candidate box; and select an axis parallel to the long side of the second candidate box as the main axis of the second candidate box.
[0125] In one embodiment, the fifth acquisition module 105 includes:
[0126] a fifth acquisition subunit, configured to acquire a first slope corresponding to the main axis of the first candidate frame, determine a first angle between the main axis of the first candidate frame and the horizontal direction of the coordinate system according to the first slope and an inverse tangent function, and select the first angle as a first main axis angle of the first candidate frame;
[0127] A determination subunit is provided to obtain a second slope corresponding to the main axis of the second candidate box, determine a second angle between the main axis of the second candidate box and the horizontal direction of the coordinate system according to the second slope and the inverse tangent function, and select the second angle as the second main axis angle of the second candidate box.
[0128] In one embodiment, the allocation module 106 includes:
[0129] a sixth acquisition subunit, configured to acquire a first difference between the first spindle angle and a preset angle, and acquire a second difference between the second spindle angle and the preset angle;
[0130] An allocating subunit is used to allocate the first sample label to the first target and allocate the second sample label to the second target when the first difference is smaller than the second difference.
[0131] In one embodiment, the sample label distribution device further includes:
[0132] A display module is used to obtain a display page corresponding to the image to be processed, and display the first sample label and the second sample label in the display page.
[0133] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, a first sample label is obtained according to the first main axis angle, and a second sample label is obtained according to the second main axis angle. The first sample label is assigned to the first target, and the second sample label is assigned to the second target. Since no manual assignment is required, the assignment time of sample labels in the target area is reduced, which is beneficial to improving the assignment efficiency of sample labels in the target area. On the other hand, the assignment of the first sample label to the first target and the assignment of the second sample label to the second target will not be affected by human factors, which is beneficial to improving the assignment effect.
[0134] For the specific definition of the sample label allocation device, please refer to the definition of the sample label allocation method above, which will not be repeated here.
[0135] Each module in the above-mentioned sample label distribution device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0136] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0137] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of a sample label allocation method can be implemented on the server side.
[0138] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database via a network connection. When the computer program is executed by the processor, the functions or steps of a sample label assignment method can be implemented on the client.
[0139] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0140] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions of the server and the client in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0141] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0142] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0143] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0144] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0145] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A sample label assignment method, characterized in that: include: Acquire an image to be processed, and acquire a feature map of the image to be processed; According to the feature map, a target area is acquired, a first target and a second target existing in the target area are acquired, a first candidate box corresponding to the first target is acquired, and a second candidate box corresponding to the second target is acquired; Obtaining a centroid distance between the first candidate box and the second candidate box, and obtaining an intersection-over-union ratio between the first candidate box and the second candidate box; When the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining a principal axis of the first candidate box and obtaining a principal axis of the second candidate box; According to the main axis of the first candidate frame and a predefined first acquisition method, a first main axis angle of the first candidate frame is acquired, and according to the main axis of the second candidate frame and a predefined second acquisition method, a second main axis angle of the second candidate frame is acquired; According to the first main axis angle, a first sample label is obtained, according to the second main axis angle, a second sample label is obtained, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
2. The sample label assignment method according to claim 1, characterized in that: The step of acquiring a target area according to the feature map, acquiring a first target and a second target existing in the target area, acquiring a first candidate box corresponding to the first target, and acquiring a second candidate box corresponding to the second target includes: Inputting the feature map into a region proposal network to obtain a target region output by the region proposal network based on the feature map; When there are two targets in the target area, a first target and a second target of the two targets are obtained, a first candidate frame corresponding to the first target is obtained, and a second candidate frame corresponding to the second target is obtained.
3. The sample label assignment method according to claim 1, characterized in that: The obtaining of the centroid distance between the first candidate box and the second candidate box, and the obtaining of the intersection-over-union ratio between the first candidate box and the second candidate box include: generating a centroid distance between the first candidate box and the second candidate box according to the center point coordinates of the first candidate box and the center point coordinates of the second candidate box; An intersection area and a union area between the first candidate box and the second candidate box are obtained, and an intersection-and-union ratio between the first candidate box and the second candidate box is generated according to the intersection area and the union area, where the intersection-and-union ratio is a ratio of the intersection area to the union area.
4. The sample label assignment method according to claim 1, characterized in that: When the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition, obtaining the main axis of the first candidate frame and obtaining the main axis of the second candidate frame include: When the centroid distance is less than a preset distance and the intersection-over-union ratio is greater than a preset value, obtaining the long side of the first candidate box and obtaining the long side of the second candidate box; An axis parallel to the long side of the first candidate box is selected as the main axis of the first candidate box; an axis parallel to the long side of the second candidate box is selected as the main axis of the second candidate box.
5. The sample label assignment method according to claim 1, characterized in that: The acquiring, according to the main axis of the first candidate frame and a predefined first acquisition method, a first main axis angle of the first candidate frame, and acquiring, according to the main axis of the second candidate frame and a predefined second acquisition method, a second main axis angle of the second candidate frame, includes: Obtaining a first slope corresponding to the main axis of the first candidate frame, determining a first angle between the main axis of the first candidate frame and the horizontal direction of the coordinate system according to the first slope and an inverse tangent function, and selecting the first angle as a first main axis angle of the first candidate frame; Obtain a second slope corresponding to the main axis of the second candidate box, determine a second angle between the main axis of the second candidate box and the horizontal direction of the coordinate system based on the second slope and the inverse tangent function, and select the second angle as the second main axis angle of the second candidate box.
6. The sample label assignment method according to claim 1, characterized in that: The step of acquiring a first sample label according to the first main axis angle, acquiring a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target includes: Obtaining a first difference between the first spindle angle and a preset angle, and obtaining a second difference between the second spindle angle and the preset angle; When the first difference is smaller than the second difference, the first sample label is assigned to the first target, and the second sample label is assigned to the second target.
7. The sample label assignment method according to any one of claims 1 to 6, characterized in that: After obtaining a first sample label according to the first main axis angle, obtaining a second sample label according to the second main axis angle, assigning the first sample label to the first target, and assigning the second sample label to the second target, the sample label assignment method includes: A display page corresponding to the image to be processed is obtained, and the first sample label and the second sample label are displayed in the display page.
8. A sample label distribution device, characterized in that: include: A first acquisition module, used to acquire an image to be processed and acquire a feature map of the image to be processed; A second acquisition module is used to acquire a target area according to the feature map, acquire a first target and a second target in the target area, acquire a first candidate box corresponding to the first target, and acquire a second candidate box corresponding to the second target; A third acquisition module is used to acquire a centroid distance between the first candidate box and the second candidate box, and acquire an intersection-over-union ratio between the first candidate box and the second candidate box; A fourth acquisition module, configured to acquire the principal axis of the first candidate box and the principal axis of the second candidate box when the centroid distance satisfies a first condition and the intersection-over-union ratio satisfies a second condition; a fifth acquisition module, configured to acquire a first main axis angle of the first candidate frame according to the main axis of the first candidate frame and a predefined first acquisition method, and acquire a second main axis angle of the second candidate frame according to the main axis of the second candidate frame and a predefined second acquisition method; An allocation module is used to obtain a first sample label according to the first main axis angle, obtain a second sample label according to the second main axis angle, allocate the first sample label to the first target, and allocate the second sample label to the second target.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the sample label assignment method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the sample label assignment method according to any one of claims 1 to 7 are implemented.
