Elevator character detection model training method, device, equipment and storage medium
By extending and cropping the first target area in the elevator image, multiple target training images are generated, and inputting them into the basic detection model for training, the problem of reducing detection accuracy of the existing elevator character detection model in different scenarios is solved, and higher generalization and accuracy are achieved.
Patent Information
- Application Number
- CN202411813258.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-08
AI Technical Summary
When the existing elevator character detection model is applied to different elevator scenes, the detection accuracy is reduced and the generalization is poor.
By marking the first target area in the elevator image and expanding it outwardly according to the preset outward expansion ratio range, multiple second target areas are obtained, and then the target training image is cut out from the elevator image and input iteratively trained to obtain the elevator character detection model.
It effectively enriches the number of training samples, improves the generalization of the model, and improves the accuracy of elevator character detection.
Smart Images

Figure CN119785364A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection technology, and in particular to an elevator character detection model training method, device, computer equipment and storage medium. Background Art
[0002] With the continuous development of science and technology, target detection technology has been widely used in many technical fields, such as mobile robots that provide cross-floor services in the field of artificial intelligence technology.
[0003] In order for a mobile robot to provide cross-floor service, it is usually necessary for the robot to identify the elevator display panel of the elevator through target detection technology, including identifying the button control panel and floor information display panel outside the elevator, so as to identify the floor information of the mobile robot's current floor and the button information on the button control panel, such as the elevator up button and down button, and then control the robot to click the up button or down button to open the elevator and enter the elevator. When the mobile robot enters the elevator, it is also necessary to identify the floor information display panel and button control panel inside the elevator to identify the corresponding button information (button characters) on the button control panel, so as to control the robot to click the corresponding button to make the elevator go up or down to the required floor. In this way, the robot can automatically take the elevator to different floors based on target detection technology to achieve cross-floor service.
[0004] At present, mobile robots usually obtain elevator images containing elevator floor display boards, and then input the elevator images into elevator character detection models for character recognition to obtain elevator floor information and button information. However, due to the limitation of the number of training samples, elevator character detection models are usually trained based on elevator images of fixed elevator scenes. When applied to other elevator scenes, the detection accuracy of the elevator character detection model may be reduced. Therefore, the existing elevator character detection models have the problem of poor generalization. Summary of the invention
[0005] The embodiments of the present invention provide an elevator character detection model training method, device, computer equipment and storage medium to solve the problem of poor generalization of the elevator character detection model.
[0006] A method for training an elevator character detection model, the method comprising: Acquire elevator images, and mark a first target area in each elevator image, where the first target area is an area in the elevator image where the elevator display panel is located; Expanding the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; According to the second target area, the elevator image is cropped to obtain a plurality of target training images; The target training image is input into the basic detection model for iterative training to obtain an elevator character detection model.
[0007] Optionally, in the above method, the step of expanding the first target area according to a preset expansion ratio range to obtain a plurality of second target areas includes: Acquire a first position parameter and a first size parameter of the first target area; According to different proportion parameters in the outer expansion proportion range, the first position parameter and the first size parameter are calculated respectively to obtain a second position parameter and a second size parameter; The second target area is determined based on the second position parameter and the second size parameter.
[0008] In the above method, optionally, the basic detection model includes an input layer, a reference network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is respectively connected before the input end of each feature fusion module.
[0009] In the above method, optionally, the step of inputting the target training image into a basic detection model for iterative training to obtain an elevator character detection model comprises: Annotating the target training image with a corresponding real detection frame, where the real detection frame is obtained based on a position label and a size label; Inputting the target training image into the basic detection model to obtain a predicted detection frame of the target training image, wherein the predicted detection frame includes a predicted position and a predicted size; Calculating a target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label; When the target loss value reaches a preset condition, the elevator character detection model is obtained.
[0010] In the above method, optionally, the step of calculating the target loss value of the basic detection model according to the predicted position, the position label, the predicted size and the size label includes: According to the predicted position, the position label, the predicted size and the size label, respectively calculating the center point distance between the predicted detection frame and the real detection frame, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor; The target loss value is calculated according to the center point distance, the diagonal distance, the weight parameter, the correction factor, the intersection-and-union ratio and the influence factor.
[0011] In the above method, optionally, the target loss value is calculated by the following loss function: in, represents the distance from the center point, represents the diagonal distance, represents the intersection-over-union ratio, represents the weight parameter, represents the correction factor, represents the impact factor.
[0012] In the above method, optionally, the impact factor is calculated by the following method: Calculating the predicted area and the predicted size ratio of the predicted detection box according to the predicted size; The impact factor is calculated based on the predicted area and the predicted size ratio.
[0013] An elevator character detection model training device, comprising: An image acquisition module acquires an elevator image and marks a first target area in each elevator image, where the first target area is an area in the elevator image where the elevator display panel is located; An area expansion module, which expands the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; A region cropping module, which crops the elevator image according to the second target region to obtain a plurality of target training images; The model training module inputs the target training image into the basic detection model for iterative training to obtain the elevator character detection model.
[0014] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the elevator character detection model training method as described in any one of the above items is implemented.
[0015] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the elevator character detection model training method as described in any one of the above items.
[0016] The above-mentioned elevator character detection model training method, device, computer equipment and storage medium, by marking the first target area in the elevator image, and then expanding the first target area according to a preset expansion ratio range to obtain multiple second target areas, and then intercepting multiple target training images from the elevator image according to each second target area, and then training the basic detection model according to the obtained target training images to obtain the elevator character detection model. It can be seen that the present invention obtains multiple second target areas by expanding the first target area in the elevator image, and then intercepting multiple different target training images from the elevator image according to the second target area. Compared with the prior art, the number of training samples is effectively enriched, and the purpose of improving the generalization of the model can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] 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.
[0018] Figure 1 This is a flow chart of an implementation of a method for training an elevator character detection model in one embodiment of the present invention; Figure 2 It is a partial implementation flow chart of the elevator character detection model training method in one embodiment of the present invention; Figure 3 Schematic diagram of the original structure of the Neck network in the elevator character detection model in one embodiment of the present invention; Figure 4 is a schematic diagram of the structure of a target module in a Neck network in one embodiment of the present invention; Figure 5 It is a partial implementation flow chart of the elevator character detection model training method in one embodiment of the present invention; Figure 6 It is a partial implementation flow chart of the elevator character detection model training method in one embodiment of the present invention; Figure 7 It is a partial implementation flow chart of the elevator character detection model training method in one embodiment of the present invention; Figure 8 It is a structural schematic diagram of an elevator character detection model training device in one embodiment of the present invention; Fig. 9 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0019] 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.
[0020] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0021] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0022] As used in the present specification and the appended claims, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0023] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0024] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0025] The present invention discloses a training method, device, computer equipment and storage medium for an elevator character detection model, which obtains a plurality of second target areas by marking a first target area in an elevator image, and then expanding the first target area according to a preset expansion ratio range, and then extracting a plurality of target training images from the elevator image according to each second target area, and then training a basic detection model according to the obtained target training images to obtain an elevator character detection model. It can be seen that the present invention obtains a plurality of second target areas by expanding the first target area in the elevator image, and then extracts a plurality of different target training images from the elevator image according to the second target area. Compared with the prior art, the number of training samples is effectively enriched, and the purpose of improving the generalization of the model can be achieved. This will be explained below through specific embodiments.
[0026] like Figure 1 As shown, it is a flowchart of an implementation method of an elevator character detection model training method disclosed in an embodiment of the present invention. The method is applied to an electronic device with image processing capability. The method in this embodiment may specifically include the following steps: S101: Acquire elevator images and mark a first target area in each elevator image.
[0027] The first target area is the area where the elevator display panel is located in the elevator image.
[0028] In a specific implementation, the first target area in this embodiment may be a region of interest (ROI) marked in the elevator image, and the area where the elevator display panel is located in the marked elevator image is the first target area. The elevator display panel in the elevator image may be a floor information display panel in the elevator, or the elevator display panel may be a floor information display panel outside the elevator, or the elevator display panel in the elevator image may be an elevator button display panel in the elevator, and the elevator display panel is not limited in this embodiment. When the elevator display panel in the elevator image is the floor information display panel in the elevator, the first target area at least includes the entire floor information display panel, and when the elevator display panel in the elevator image is the elevator button display panel in the elevator, the first target area may include the entire elevator button display panel, or each elevator button corresponds to a first target area, and this is not limited in this embodiment.
[0029] For example, taking the elevator display panel in the elevator image as the elevator button display panel in the elevator as an example, a robot connected to the elevator character detection model disclosed in this embodiment is controlled to obtain the elevator image through a camera, and the floor information corresponding to each elevator button in the elevator image is identified through the elevator character detection model. Then, according to the identified floor information, the robot is controlled to click the elevator button corresponding to the floor to be reached, so that the robot can automatically take the elevator.
[0030] S102: Expand the first target area according to a preset expansion ratio range to obtain a plurality of second target areas.
[0031] Among them, the outward expansion ratio range includes multiple ratio values. For example, the outward expansion ratio range can be (5%, 30%), then (5%, 30%) can include multiple ratio values such as 5%, 10%, 15%, 20%, 25% and 30%. It should be noted that the above-mentioned outward expansion ratio range and the number of ratio values included in the outward expansion ratio range are merely exemplary descriptions and do not constitute any limitation on the outward expansion ratio range and the number of ratio values included in the outward expansion ratio range.
[0032] In a specific implementation, in this embodiment, the first target area can be expanded outward according to the proportion values in the expansion proportion range to obtain the second target area corresponding to each proportion value. That is, the number of second target areas corresponds to the number of proportion values in the expansion proportion range. The more proportion values in the expansion proportion range, the more second target areas can be obtained.
[0033] S103: According to the second target area, the elevator image is cropped to obtain a plurality of target training images.
[0034] The elevator image is cropped multiple times according to different second target regions, and a target training image is obtained by cropping each second target region.
[0035] In a specific implementation, in this embodiment, the second target area in the elevator image can be cropped by a tool with a cropping function, wherein the tool with a cropping function includes but is not limited to any one of Photoshop, GIMP, IrfanView, Canva and the like.
[0036] S104: Input the target training image into the basic detection model for iterative training to obtain an elevator character detection model.
[0037] In a specific implementation, in this embodiment, after the target training image is annotated, it can be input into the basic detection model for iterative training, so that when the basic detection model reaches a preset number of iterations, or when the loss value of the basic detection model converges, the basic detection model trained at this time is determined to be the elevator character detection model. The basic detection model in this embodiment includes but is not limited to the YOLOV5 model.
[0038] In summary, the present embodiment discloses a method for training an elevator character detection model, which obtains a plurality of second target areas by marking a first target area in an elevator image, and then expanding the first target area according to a preset expansion ratio range, and then extracting a plurality of target training images from the elevator image according to each second target area, and then training a basic detection model according to the obtained target training images to obtain an elevator character detection model. It can be seen that the present invention obtains a plurality of second target areas by expanding the first target area in the elevator image, and then extracting a plurality of different target training images from the elevator image according to the second target area, which effectively enriches the number of training samples compared to the prior art, and can achieve the purpose of improving the generalization of the model.
[0039] based on Figure 1 In the specific implementation, step S102 in this embodiment can be implemented by the following steps: Figure 2 As shown: S201: Acquire a first position parameter and a first size parameter of a first target area.
[0040] It can be understood that the first target area in this embodiment can be a rectangular area, and the rectangular area can be represented by a center point coordinate and a size parameter, wherein the size parameter at least includes a height parameter and a width parameter of the first target area, and the center point coordinate is at least a coordinate data including a horizontal coordinate and a vertical coordinate. Therefore, when marking the first target area in the elevator image, the first target area can be marked in the elevator image by marking the first position parameter and the first size parameter.
[0041] For example, the first target area can be expressed as (x, y, w, h), where (x, y) represents the first position parameters of the first target area, namely the horizontal coordinate and the vertical coordinate, and (w, h) represents the first size parameters of the first target area, namely the width parameter and the height parameter.
[0042] S202: Calculate the first position parameter and the first size parameter respectively according to different ratio parameters in the outer expansion ratio range to obtain a second position parameter and a second size parameter.
[0043] According to each ratio parameter in the expansion ratio range, the first position parameter is moved and the first size parameter is expanded to obtain a second position parameter and a second size parameter.
[0044] In a specific implementation, in this embodiment, according to each ratio parameter in the expansion ratio range, the first position parameter is moved and the first size parameter is expanded. In a specific implementation, in this embodiment, the horizontal coordinate movement factor, the vertical coordinate movement factor, the width expansion factor and the height expansion factor can be calculated respectively according to each expansion ratio, and then the horizontal coordinate of the first position parameter is moved according to the horizontal coordinate movement factor, the vertical coordinate of the first position parameter is moved according to the vertical coordinate movement factor, the width parameter of the first size parameter is expanded according to the width expansion factor, and the height parameter of the first size parameter is expanded according to the height expansion factor.
[0045] For example, taking the first target area represented by (x, y, w, h) as an example, (x, y) represents the horizontal coordinate and the vertical coordinate, (w, h) represents the width parameter and the height parameter, and one of the proportional parameters in the expansion ratio range is v. Then, the horizontal coordinate movement factor can be v×w, the vertical coordinate movement factor can be v×h, the width expansion factor can be 2×w×v, and the height expansion factor can be 2×h×v. Then, after expansion, the first target area is (xv×w, yv×h, w+2×w×v, h+2×h×v). Therefore, the first target area can be expanded to obtain the second target area.
[0046] It should be noted that the above example is only one implementation method of expanding the first target area according to the expansion ratio in this embodiment, and does not specifically limit the specific implementation method of expanding the first target area in this embodiment.
[0047] S203: Determine a second target area based on the second position parameter and the second size parameter.
[0048] It should be understood that after obtaining the second position parameter and the second size parameter, the specific position of the second target area can be determined according to the second position parameter, and the specific size of the second target area can be determined according to the second size parameter, wherein the second position parameter is the center point coordinate of the second target area, and the second size parameter is the height parameter and width parameter of the second target area at the center point coordinate.
[0049] In summary, in this embodiment, the first position parameter is moved by the scale parameter and the first size parameter is expanded to obtain the second target area, so that the first target area can be contained in the second target area, and the center point coordinates can be moved. Therefore, more effective target training images can be obtained based on the second target area cropping, which is beneficial to improving the generalization and character recognition accuracy of the elevator character detection model.
[0050] based on Figure 1 In the specific implementation, the basic detection model in this embodiment includes an input layer, a baseline network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is connected before the input end of each feature fusion module.
[0051] That is to say, in the target module of the Neck network of the basic detection model, each input end of the feature fusion module is connected to a depthwise separable convolutional layer, and in the target module of the Neck network of the trained elevator character detection model, each input end of the feature fusion module is also connected to a depthwise separable convolutional layer.
[0052] like Figure 3 As shown in FIG. 1 , it is a schematic diagram of the original structure of the Neck network in the YOLOV5 model, wherein the network structure in the dotted box is the target module in this embodiment, wherein the target module includes a feature fusion module (concat) and an upsampling module. The schematic diagram of the structure of the target module obtained after optimization is as follows: Figure 4 As shown, it can be seen that a depth-wise separable convolutional layer is connected before the two input ends of the feature fusion module.
[0053] To sum up, in this embodiment, by connecting a depth-separable convolutional layer before each input end of the feature fusion module in the target module in the Neck network of the basic detection model, the feature extraction capability of the elevator character detection model for elevator characters can be effectively enhanced.
[0054] based on Figure 1 In the specific implementation, step S104 in this embodiment can be implemented by the following steps: Figure 5 As shown: S501: Annotate the target training image with a corresponding true detection frame, where the true detection frame is obtained based on a position label and a size label.
[0055] In a specific implementation, the real detection frame in the target training image in this embodiment can be a re-labeled detection frame, or the first target area in the elevator image is used as the real detection frame in the target training image, that is, the size label of the real detection frame in the target training image is the same as the first size parameter of the first target area, and the first position parameter of the first target area in the elevator image is converted into the position parameter of the first target area in the target training image, that is, the position label of the real detection frame in the target training image. In this way, the corresponding position label and size label can be labeled on the target training image.
[0056] S502: Input the target training image into the basic detection model to obtain a predicted detection frame of the target training image, where the predicted detection frame includes a predicted position and a predicted size.
[0057] In a specific implementation, in this embodiment, after the target training image is input into the basic detection model, the basic detection model predicts the elevator display panel in the target training image to obtain a predicted detection frame of the target training image, and the predicted detection frame includes a predicted position and a predicted size.
[0058] S503: Calculate the target loss value of the basic detection model according to the predicted position and the position label.
[0059] In a specific implementation, the loss value is calculated according to the predicted position and the position label in this embodiment to obtain the target loss value of the basic detection model. The method for calculating the target loss value in this embodiment can be calculated as follows: Figure 6 As shown: S601: Calculate the center point distance between the predicted detection box and the true detection box, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor according to the predicted position, the position label, the predicted size and the size label.
[0060] In one embodiment, the distance between the center points of the predicted detection box and the real detection box can be calculated by using the horizontal coordinate and the vertical coordinate in the predicted position and the horizontal coordinate and the vertical coordinate in the position label.
[0061] In a specific implementation, in this embodiment, the distance between the center points of the predicted detection frame and the actual detection frame can be calculated by inputting the horizontal coordinate and vertical coordinate in the predicted position and the horizontal coordinate and vertical coordinate in the position label into the distance formula between the two points.
[0062] The distance formula between two points is as follows: in, Indicates the horizontal coordinate in the position label. represents the horizontal coordinate in the predicted position, Represents the vertical coordinate in the position label, represents the ordinate in the predicted position, Indicates the center point distance between the predicted detection box and the true detection box.
[0063] In one embodiment, the diagonal distance between the minimum bounding rectangle of the predicted detection box and the real detection box in this embodiment can be calculated as follows: According to the predicted position and predicted size of the predicted detection frame, the four corner coordinates of the predicted detection frame are calculated, and according to the position label and size label of the real detection frame, the four corner coordinates of the real detection frame are calculated. According to the four corner coordinates of the predicted detection frame and the four corner coordinates of the real detection frame, the minimum enclosing rectangle and the two diagonal coordinates of the minimum enclosing rectangle of the predicted detection frame and the real detection frame are determined. According to the two diagonal coordinates, the diagonal distance of the minimum enclosing rectangle of the predicted detection frame and the real detection frame is calculated based on the distance formula between the two points.
[0064] In one embodiment, the correction factor in this embodiment can be calculated as follows: The predicted size of the predicted detection box includes a height parameter and a width parameter, and the predicted size of the real detection box includes a height label and a width label. The height parameter and the width parameter, the height label and the width label are input into the correction factor calculation formula to obtain the correction factor.
[0065] The correction factor calculation formula can be shown as follows: in, Indicates the width label of the real detection box, Represents the height label of the real detection box, Represents the width parameter of the predicted detection box, Represents the height parameter of the predicted detection box, Represents the correction factor.
[0066] In one embodiment, the weight parameter in this embodiment can be calculated as follows: Determine the intersection-over-union ratio and correction factor of the predicted detection box and the real detection box, input the intersection-over-union ratio and correction factor of the predicted detection box and the real detection box into the weight parameter calculation formula, and calculate the weight parameter.
[0067] The weight parameter calculation formula can be shown as follows: in, represents the correction factor, It represents the intersection-over-union ratio of the predicted detection box and the real detection box. Represents the weight parameter.
[0068] In one embodiment, the impact factor in this embodiment can be calculated as follows: Figure 7 As shown: S701: Calculate the predicted area and predicted size ratio of the predicted detection box according to the predicted size.
[0069] The predicted area is calculated by multiplying the height parameter and the width parameter in the predicted size, and the predicted size ratio is the ratio of the height parameter to the width parameter.
[0070] S702: Calculate the impact factor according to the predicted area and the predicted size ratio.
[0071] The predicted area and predicted size ratio are input into the impact factor calculation formula to obtain the impact factor.
[0072] The impact factor calculation formula is as follows: in, represents the predicted area of the predicted detection box, represents the predicted size, Represents the impact factor.
[0073] S602: Calculate the target loss value according to the center point distance, diagonal distance, weight parameter, correction factor, intersection ratio and influence factor.
[0074] The center point distance, diagonal distance, weight parameter, correction factor, intersection ratio and influence factor are input into the target loss function to calculate the target loss value.
[0075] Among them, the calculation expression of the target loss function is as follows: in, represents the center point distance, represents the diagonal distance, represents the intersection-and-union ratio, represents the weight parameter, represents the correction factor, Represents the impact factor.
[0076] S504: When the target loss value reaches a preset condition, an elevator character detection model is obtained.
[0077] Among them, the preset conditions can be set according to actual needs to obtain an elevator character detection model with better learning effect.
[0078] On the first hand, the preconditions can be as follows: It is determined whether the target loss value is less than a preset loss threshold. If the target loss value is less than the preset loss threshold, it is determined that the basic detection model is fully trained to obtain an elevator character detection model.
[0079] Secondly, the preconditions can also be as follows: When the target loss value no longer decreases and tends to be stable, it is determined that the basic detection model is fully trained and the elevator character detection model is obtained.
[0080] In summary, in this embodiment, by adding the influence factor Into the formula, the objective loss function can have a good balance in computational complexity and parameter adjustment, which is beneficial to improving the detection accuracy of the trained elevator character detection model.
[0081] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0082] like Figure 8 FIG. 1 is a schematic diagram of a structure of an elevator character detection model training device disclosed in an embodiment of the present invention, and the device specifically includes the following modules: The image acquisition module 801 acquires the elevator image and marks a first target area in each elevator image, where the first target area is the area where the elevator display panel is located in the elevator image; An area expansion module 802 expands the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; A region cropping module 803 crops the elevator image according to the second target region to obtain a plurality of target training images; The model training module 804 inputs the target training image into the basic detection model for iterative training to obtain an elevator character detection model.
[0083] In summary, the present invention discloses an elevator character detection model training device, which obtains a plurality of second target areas by marking a first target area in an elevator image, and then expanding the first target area according to a preset expansion ratio range, and then extracting a plurality of target training images from the elevator image according to each second target area, and then training a basic detection model according to the obtained target training images to obtain an elevator character detection model. It can be seen that the present invention obtains a plurality of second target areas by expanding the first target area in the elevator image, and then extracts a plurality of different target training images from the elevator image according to the second target area. Compared with the prior art, the present invention effectively enriches the number of training samples, and can achieve the purpose of improving the generalization of the model.
[0084] In one embodiment, the area expansion module 802 is used to: Acquire a first position parameter and a first size parameter of the first target area; According to different proportion parameters in the outer expansion proportion range, the first position parameter and the first size parameter are calculated respectively to obtain a second position parameter and a second size parameter; The second target area is determined based on the second position parameter and the second size parameter.
[0085] In one embodiment, the basic detection model includes an input layer, a reference network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is connected before the input end of each feature fusion module.
[0086] In one embodiment, the model training module 804 is used to: Annotating the target training image with a corresponding real detection frame, where the real detection frame is obtained based on a position label and a size label; Inputting the target training image into the basic detection model to obtain a predicted detection frame of the target training image, wherein the predicted detection frame includes a predicted position and a predicted size; Calculating a target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label; When the target loss value reaches a preset condition, the elevator character detection model is obtained.
[0087] In one embodiment, the model training module 804 may also be used to: According to the predicted position, the position label, the predicted size and the size label, respectively calculating the center point distance between the predicted detection frame and the real detection frame, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor; The target loss value is calculated according to the center point distance, the diagonal distance, the weight parameter, the correction factor, the intersection-and-union ratio and the influence factor.
[0088] In one embodiment, the target loss value is calculated by the following loss function: in, represents the distance from the center point, represents the diagonal distance, represents the intersection-over-union ratio, represents the weight parameter, represents the correction factor, represents the impact factor.
[0089] In one embodiment, the impact factor is calculated as follows: Calculating the predicted area and the predicted size ratio of the predicted detection box according to the predicted size; The impact factor is calculated based on the predicted area and the predicted size ratio.
[0090] For the specific limitations of the elevator character detection model training device, please refer to the relevant limitations of the elevator character detection model training method above, which will not be repeated here. Each module in the above-mentioned elevator character detection model training device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0091] In one embodiment, a computer device is disclosed. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, a network interface and a database connected through 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, 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 terminal through a network connection. When the computer program is executed by the processor, a method for training an elevator character detection model is implemented.
[0092] In one embodiment, 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 following steps when executing the computer program: Acquire elevator images, and mark a first target area in each elevator image, where the first target area is an area in the elevator image where the elevator display panel is located; Expanding the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; According to the second target area, the elevator image is cropped to obtain a plurality of target training images; The target training image is input into the basic detection model for iterative training to obtain an elevator character detection model.
[0093] In a practical manner, the first target area is expanded according to a preset expansion ratio range to obtain a plurality of second target areas, including: Acquire a first position parameter and a first size parameter of the first target area; According to different proportion parameters in the outer expansion proportion range, the first position parameter and the first size parameter are calculated respectively to obtain a second position parameter and a second size parameter; The second target area is determined based on the second position parameter and the second size parameter.
[0094] In a practical manner, the basic detection model includes an input layer, a reference network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is connected before the input end of each feature fusion module.
[0095] In a practical manner, the target training image is input into a basic detection model for iterative training to obtain an elevator character detection model, including: Annotating the target training image with a corresponding real detection frame, where the real detection frame is obtained based on a position label and a size label; Inputting the target training image into the basic detection model to obtain a predicted detection frame of the target training image, wherein the predicted detection frame includes a predicted position and a predicted size; Calculating a target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label; When the target loss value reaches a preset condition, the elevator character detection model is obtained.
[0096] In a practical manner, the calculating the target loss value of the basic detection model according to the predicted position, the position label, the predicted size and the size label includes: According to the predicted position, the position label, the predicted size and the size label, respectively calculating the center point distance between the predicted detection frame and the real detection frame, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor; The target loss value is calculated according to the center point distance, the diagonal distance, the weight parameter, the correction factor, the intersection-and-union ratio and the influence factor.
[0097] In a practical manner, the target loss value is calculated by the following loss function: in, represents the distance from the center point, represents the diagonal distance, represents the intersection-over-union ratio, represents the weight parameter, represents the correction factor, represents the impact factor.
[0098] In one practical approach, the impact factor is calculated as follows: Calculating the predicted area and the predicted size ratio of the predicted detection box according to the predicted size; The impact factor is calculated based on the predicted area and the predicted size ratio.
[0099] In one embodiment, a computer-readable storage medium is disclosed. When the instructions in the computer-readable storage medium are executed by a processor in a computer device, the computer device can perform the steps of any embodiment of an elevator character detection model training method disclosed in the present invention. The computer-readable storage medium can be non-volatile or volatile.
[0100] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Acquire elevator images, and mark a first target area in each elevator image, where the first target area is an area in the elevator image where the elevator display panel is located; Expanding the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; According to the second target area, the elevator image is cropped to obtain a plurality of target training images; The target training image is input into the basic detection model for iterative training to obtain an elevator character detection model.
[0101] In a practical manner, the first target area is expanded according to a preset expansion ratio range to obtain a plurality of second target areas, including: Acquire a first position parameter and a first size parameter of the first target area; According to different proportion parameters in the outer expansion proportion range, the first position parameter and the first size parameter are calculated respectively to obtain a second position parameter and a second size parameter; The second target area is determined based on the second position parameter and the second size parameter.
[0102] In a practical manner, the basic detection model includes an input layer, a reference network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is connected before the input end of each feature fusion module.
[0103] In a practical manner, the target training image is input into a basic detection model for iterative training to obtain an elevator character detection model, including: Annotating the target training image with a corresponding real detection frame, where the real detection frame is obtained based on a position label and a size label; Inputting the target training image into the basic detection model to obtain a predicted detection frame of the target training image, wherein the predicted detection frame includes a predicted position and a predicted size; Calculating a target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label; When the target loss value reaches a preset condition, the elevator character detection model is obtained.
[0104] In a practical manner, the calculating the target loss value of the basic detection model according to the predicted position, the position label, the predicted size and the size label includes: According to the predicted position, the position label, the predicted size and the size label, respectively calculating the center point distance between the predicted detection frame and the real detection frame, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor; The target loss value is calculated according to the center point distance, the diagonal distance, the weight parameter, the correction factor, the intersection-and-union ratio and the influence factor.
[0105] In a practical manner, the target loss value is calculated by the following loss function: in, represents the distance from the center point, represents the diagonal distance, represents the intersection-over-union ratio, represents the weight parameter, represents the correction factor, represents the impact factor.
[0106] In one practical approach, the impact factor is calculated as follows: Calculating the predicted area and the predicted size ratio of the predicted detection box according to the predicted size; The impact factor is calculated based on the predicted area and the predicted size ratio.
[0107] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0108] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0109] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for training an elevator character detection model, characterized in that: The method comprises: Acquire elevator images, and mark a first target area in each elevator image, where the first target area is an area in the elevator image where an elevator display panel is located; Expanding the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; According to the second target area, the elevator image is cropped to obtain a plurality of target training images; The target training image is input into the basic detection model for iterative training to obtain an elevator character detection model.
2. The elevator character detection model training method according to claim 1, characterized in that: The first target area is expanded according to a preset expansion ratio range to obtain a plurality of second target areas, including: Acquire a first position parameter and a first size parameter of the first target area; According to different proportion parameters in the outer expansion proportion range, the first position parameter and the first size parameter are calculated respectively to obtain a second position parameter and a second size parameter; The second target area is determined based on the second position parameter and the second size parameter.
3. The elevator character detection model training method according to claim 1, characterized in that: The basic detection model includes an input layer, a reference network, a Neck network and an output end, wherein, in each feature fusion module in the Neck network and in the target module where the upsampling model is located, a depth-separable convolutional layer is connected before the input end of each feature fusion module.
4. The elevator character detection model training method according to claim 1, characterized in that: The target training image is input into the basic detection model for iterative training to obtain the elevator character detection model, including: Annotating the target training image with a corresponding real detection frame, where the real detection frame is obtained based on a position label and a size label; Inputting the target training image into the basic detection model to obtain a predicted detection frame of the target training image, wherein the predicted detection frame includes a predicted position and a predicted size; Calculating a target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label; When the target loss value reaches a preset condition, the elevator character detection model is obtained.
5. The elevator character detection model training method according to claim 4, characterized in that: The step of calculating the target loss value of the basic detection model according to the predicted position, the position label, the predicted size, and the size label includes: According to the predicted position, the position label, the predicted size and the size label, respectively calculating the center point distance between the predicted detection frame and the real detection frame, the diagonal distance of the minimum circumscribed rectangle, the weight parameter, the correction factor, the intersection-over-union ratio and the influence factor; The target loss value is calculated according to the center point distance, the diagonal distance, the weight parameter, the correction factor, the intersection-and-union ratio and the influence factor.
6. The elevator character detection model training method according to claim 5, characterized in that: The target loss value is calculated by the following loss function: in, represents the center point distance, represents the diagonal distance, represents the intersection-over-union ratio, represents the weight parameter, represents the correction factor, represents the impact factor.
7. The elevator character detection model training method according to any one of claims 5 or 6, characterized in that: The impact factor is calculated as follows: Calculating the predicted area and the predicted size ratio of the predicted detection box according to the predicted size; The impact factor is calculated based on the predicted area and the predicted size ratio.
8. An elevator character detection model training device, characterized in that: include: An image acquisition module acquires an elevator image and marks a first target area in each elevator image, where the first target area is an area in the elevator image where the elevator display panel is located; An area expansion module, which expands the first target area according to a preset expansion ratio range to obtain a plurality of second target areas; A region cropping module, which crops the elevator image according to the second target region to obtain a plurality of target training images; The model training module inputs the target training image into the basic detection model for iterative training to obtain the elevator character detection model.
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 elevator character detection model training method as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the elevator character detection model training method as described in any one of claims 1 to 7 is implemented.