Indoor obstacle detection method, system and equipment based on improved SGD algorithm
By using the improved DASE-SGDM algorithm to update network parameters in the sweeping robot, the problem of insufficient detection accuracy of indoor obstacles in the prior art is solved, and higher detection accuracy and model performance are achieved.
Patent Information
- Application Number
- CN202411430550.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Existing sweeping robots have insufficient accuracy in indoor obstacle detection, especially in complex environments, and it is difficult to effectively identify and avoid obstacles.
The improved stochastic gradient descent algorithm (DASE-SGDM) is adopted, which not only updates the first-order moment parameters, but also updates the second-order moment parameters through innovative algorithms, optimizes the network parameter update process, and improves model performance.
Through the optimized DASE-SGDM algorithm, the detection accuracy of indoor obstacles by the sweeping robot is improved, the oscillation phenomenon is reduced, the optimal solution is prevented, and the overall performance of the model is improved.
Smart Images

Figure CN118982721B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and relates to indoor obstacle detection when a sweeping robot moves indoors, and in particular to an indoor obstacle detection method, system and device based on an improved SGD algorithm. Background Art
[0002] In recent years, sweeping robot products have been rapidly promoted and applied, with significant technical improvements in both structure and specific functions. Since they can automatically clean and collect debris in the house and have a certain level of intelligence, the use prospects of sweeping robots are very prominent.
[0003] At present, sweeping robot products that are widely used generally use sensors to sense external conditions, and detect indoor obstacles based on the sensed conditions, make corresponding feedback, and take corresponding measures. In the prior art, in addition to using sensors to sense obstacles, with the rapid development of artificial intelligence technology in recent years, more and more sweeping robots use artificial intelligence technology to detect indoor obstacles.
[0004] The invention patent with application number 202111077265.8 discloses a method, device and sweeping robot for obstacle avoidance and route control of a sweeping robot, which discloses: each group of sensor data is input into the first convolutional neural network corresponding to each sensor type to extract the first feature data corresponding to each group of sensor data; then the sensor data and the first feature data corresponding to each sensor are input into the second convolutional neural network corresponding to each sensor type to extract the second feature data corresponding to each group of sensor data; finally, based on a preset feature fusion function, the first feature data and the second feature data corresponding to multiple sensors are cross-fused to obtain the target sensor data after the fusion process; after obtaining the corresponding target sensor data, it is necessary to specifically determine the specific data corresponding to the obstacle based on the obtained target sensor data.
[0005] In addition to using sensors to obtain the distance between the robot and the obstacle and performing feature fusion based on convolutional neural networks, it is also possible to analyze, detect, and identify indoor scene images obtained by the sweeping robot based on artificial intelligence. For example, the indoor scene image is input into a conventional network such as the yolov8s network, and the conventional network such as the yolov8s network identifies and detects obstacles in the image. When using deep neural networks such as the yolov8s network for image detection and recognition, it is usually necessary to train the network, and during the training process, an optimizer is needed to optimize and update parameters.
[0006] Application No. 2022105251354 discloses an unsupervised abnormal behavior detection method based on background suppression, which involves updating network parameters using a stochastic gradient descent method, specifically: constructing an unsupervised abnormal behavior detection network model H and performing iterative training, using the back propagation method to calculate the network parameter gradient during training, and using a stochastic gradient descent algorithm to update the network parameters through the network parameter gradient; specifically, when using the stochastic gradient descent algorithm to update the network parameters through the network parameter gradient, the update formula is: , , , , , .
[0007] In addition to using the stochastic gradient descent algorithm (i.e., SGD algorithm) to update network parameters, the Adam algorithm can also be used to update network parameters (such as the invention patent application with application number 202310991678X). However, when the prior art uses the stochastic gradient descent algorithm (i.e., SGD algorithm) and the Adam algorithm to update network parameters, the specific algorithms are basically the same or have little difference (such as the SGD algorithm in 2022105251354 and the Adam algorithm in 202310991678X). Therefore, it is necessary to propose a new DASE-SGDM algorithm suitable for indoor obstacle detection by a sweeping robot to improve the detection accuracy of indoor obstacles by the sweeping robot. Summary of the invention
[0008] The purpose of the present invention is to provide an indoor obstacle detection method, system and device based on an improved SGD algorithm, and to improve the detection accuracy of indoor obstacles by a sweeping robot by adopting an optimized DASE-SGDM algorithm.
[0009] In order to achieve the above-mentioned purpose, the present invention specifically adopts the following technical solutions:
[0010] An indoor obstacle detection method based on an improved SGD algorithm comprises the following steps:
[0011] Step S1, obtaining indoor obstacle sample images and label data;
[0012] Step S2, constructing an obstacle detection and recognition model;
[0013] Step S3, training an obstacle detection and recognition model;
[0014] The obstacle detection and recognition model constructed in step S2 is trained using the indoor obstacle sample images and label data in step S1. The DASE-SGDM algorithm is used to update the network parameters during training. The DASE-SGDM algorithm is specifically as follows:
[0015] Step S3-1, initialization parameters , , set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value :
[0016] ;
[0017] Step S3-2, update the first-order moment parameters:
[0018] ;
[0019] Step S3-3, update the second-order moment parameters:
[0020] ;
[0021] Step S3-4, using the updated first-order moment parameters and second-order moment parameters to update the network parameters and gradient values:
[0022] Step S3-5, repeating steps S3-2 to S3-4 until the training is completed;
[0023] in, Indicates the network parameters before updating, represents the first-order moment parameter before updating, represents the second-order moment parameter before updating, Represents the gradient value before updating;
[0024] Step S4, using the obstacle detection and recognition model to perform real-time obstacle recognition on the indoor image to be tested acquired by the sweeping robot to obtain an obstacle detection result.
[0025] Furthermore, in step 1, the specific method of obtaining indoor obstacle sample images and label data is as follows:
[0026] The sweeping robot moves indoors and collects indoor images through an image acquisition device on the sweeping robot. The indoor images obtained by the sweeping robot are indoor obstacle sample images.
[0027] Mark the obstacles in the indoor obstacle sample image to obtain label data.
[0028] Furthermore, in step S2, the obstacle detection and recognition model is a deep learning neural network.
[0029] Furthermore, the deep learning neural network adopts the YOLOv8s network.
[0030] Furthermore, in step S3-4, the specific algorithm for updating the network parameters and gradient values is:
[0031] ;
[0032] ;
[0033] in, represents the updated network parameters, represents the exponential decay rate, represents the updated first-order moment parameter, represents the updated second-order moment parameter, represents the updated gradient value, represents the differential, Represents the loss function.
[0034] Furthermore, after updating the gradient value, the direction of gradient change is determined according to the gradient values before and after the update, and the learning rate is updated according to the direction of gradient change.
[0035] Furthermore, when updating the learning rate according to the direction of gradient change, the specific method is:
[0036] like ,but ,otherwise ;
[0037] When updating the learning rate according to the direction of gradient change, if If it is greater than the preset gradient change threshold, the learning rate update method is: ; Otherwise, the learning rate is updated as follows: ;
[0038] in, represents the performance feedback factor; Indicates the performance change symbol. If the performance improves, then is positive, if the performance decreases, then is negative.
[0039] Furthermore, in step S3, the performance of the trained obstacle detection and recognition model is evaluated, and the evaluation indicators include accuracy and recall rate;
[0040] The accuracy is calculated as follows:
[0041] ;
[0042] The calculation formula for recall is:
[0043] ;
[0044] in, represents the number of true positive examples, represents the number of false positive examples, Represents the number of false negative examples.
[0045] An indoor obstacle detection system based on an improved SGD algorithm comprises the following steps:
[0046] An indoor obstacle sample image acquisition module is used to acquire indoor obstacle sample images and label data;
[0047] Obstacle detection and recognition model building module, used to build an obstacle detection and recognition model;
[0048] Obstacle detection and recognition model training module, used to train obstacle detection and recognition model;
[0049] The obstacle detection and recognition model constructed in step S2 is trained using the indoor obstacle sample images and label data in step S1. The DASE-SGDM algorithm is used to update the network parameters during training. The DASE-SGDM algorithm is specifically as follows:
[0050] Step S3-1, initialization parameters , , set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value :
[0051] ;
[0052] Step S3-2, update the first-order moment parameters:
[0053] ;
[0054] Step S3-3, update the second-order moment parameters:
[0055] ;
[0056] Step S3-4, using the updated first-order moment parameters and second-order moment parameters to update the network parameters and gradient values:
[0057] Step S3-5, repeating steps S3-2 to S3-4 until the training is completed;
[0058] in, Indicates the network parameters before updating, represents the first-order moment parameter before updating, represents the second-order moment parameter before updating, Represents the gradient value before updating;
[0059] The obstacle real-time recognition module is used to use the obstacle detection and recognition model to perform real-time obstacle recognition on the indoor test image obtained by the sweeping robot to obtain the obstacle detection result.
[0060] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0061] The beneficial effects of the present invention are as follows:
[0062] 1. In the prior art, when the SGD algorithm is used to update network parameters, most of them are only updated to the first-order moment parameters, and a few are updated to the second-order moment parameters. However, the present invention is different. The obstacle detection and recognition model constructed by the present invention updates the network parameters by using the DASE-SGDM algorithm. The optimized DASE-SGDM algorithm not only updates to the second-order moment parameters, but also uses an innovative algorithm to update the second-order moment parameters. The optimized second-order moment parameter update algorithm can optimize the disadvantage of excessive oscillation in the traditional SGD algorithm, and effectively prevent the phenomenon of jumping out of the optimal solution during the oscillation process, thereby improving the performance of the model and ultimately improving the detection accuracy of the sweeping robot for indoor obstacles.
[0063] 2. When the direction of gradient change exceeds a certain threshold (i.e., the preset gradient change threshold), the model training enters a flat area or a local minimum. In the present invention, a dynamic learning rate is innovatively used to train the obstacle detection and recognition model. The learning rate is dynamically adjusted according to the direction of gradient change, which can reduce the learning rate to search for the optimal solution more precisely and effectively prevent the phenomenon of jumping out of the optimal solution during the oscillation process, thereby improving the performance of the model and ultimately improving the detection accuracy of the sweeping robot for indoor obstacles. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a schematic diagram of the process of the present invention;
[0065] Figure 2 It is a detailed flow chart of the present invention during training;
[0066] Figure 3 is the mean average precision (mAP50) curve when trained using the SGD optimizer;
[0067] Figure 4 It is the mean average precision (mAP50) curve when training using the innovative DASE-SGDM optimizer in the present invention. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0069] Therefore, based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of the present invention. Embodiment 1
[0070] This embodiment provides an indoor obstacle detection method based on an improved SGD algorithm, which is used to identify the images acquired by the sweeping robot and ultimately identify which obstacles are in the images, such as Figure 1 As shown, the following steps are included:
[0071] Step S1, obtaining indoor obstacle sample images and label data;
[0072] 1.1 Collect indoor obstacle dataset;
[0073] The image acquisition device on the sweeping robot is used to obtain sample images of indoor obstacles to form an indoor obstacle dataset. The obstacles in the sample images of indoor obstacles in the dataset are marked to obtain label data.
[0074] In this embodiment, all sample images are directly obtained by taking pictures of the image acquisition device on the sweeping robot when the sweeping robot moves indoors (such as in a room, an office, a stadium, a gym, and all other indoor environments). The sweeping robot can be selected from existing sweeping robots and can be directly purchased on the market. The sweeping robot and the acquisition of image data by the sweeping robot are both existing technologies and can be directly applied without creative work.
[0075] 1.2 Image preprocessing and data set division;
[0076] Preprocess the collected sample data and divide the data set. The data preprocessing method can use existing technology without creative work. In addition, the data set can be divided into a training set and a test set (7:3).
[0077] Step S2, constructing an obstacle detection and recognition model;
[0078] Build a deep learning neural network, namely the YOLOv8s object detection network.
[0079] In this embodiment, the structure of the deep learning neural network is not the innovative point. The deep learning neural network can adopt the existing network model structure YOLOv8s, that is, the existing YOLOv8s target detection network, without the need for creative work.
[0080] Step S3, training an obstacle detection and recognition model;
[0081] The obstacle detection and recognition model constructed in step S2 is trained using the indoor obstacle sample images and label data in step S1. During training, the specific training method and loss function are also not the innovation point. The existing training method and the existing loss function can be used without creative work.
[0082] The innovation of this implementation lies in the method of updating network parameters during training, that is, using the DASE-SGDM algorithm to update network parameters. The DASE-SGDM algorithm is specifically:
[0083] Step S3-1, initialization parameters , (usually assigned a value of 0), set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value :
[0084] ;
[0085] Step S3-2, update the first-order moment parameters:
[0086] ;
[0087] Step S3-3, update the second-order moment parameters:
[0088] ;
[0089] Step S3-4, update network parameters, gradient values and learning rate:
[0090] ;
[0091] ;
[0092] Detect the direction of gradient change and update the learning rate according to the direction of gradient change;
[0093] Step S3-5, repeating steps S3-2 to S3-4 until the training is completed;
[0094] in, Indicates the network parameters before updating, represents the updated network parameters, represents the first-order moment parameter before updating, represents the updated first-order moment parameter, represents the second-order moment parameter before updating, represents the updated second-order moment parameter, represents the gradient value before update, represents the updated gradient value, represents the differential, It should be noted that the loss function here is not the innovation of this application, and the existing loss function can be used.
[0095] In step S3-4, when detecting the direction of gradient change, the specific method is:
[0096] like ,but ,otherwise ;
[0097] When updating the learning rate according to the direction of gradient change, if If the gradient change threshold is greater than the preset value (for example, 10), the learning rate is updated as follows: ; Otherwise, the learning rate is updated as follows: That is, if we calculate ten times in a row , then directly update the learning rate to: ; Otherwise, the learning rate update algorithm adopts .
[0098] in, represents the performance feedback factor; Indicates the performance change symbol. If the performance improves, then is positive, if the performance decreases, then is negative.
[0099] In addition, the gradient change direction counter needs to be reset periodically. , learning rate is the initial value to prevent the learning rate from becoming too small to escape the local minimum.
[0100] After the obstacle detection and recognition model training is completed, the performance of the obstacle detection and recognition model needs to be evaluated. The evaluation indicators include accuracy and recall rate.
[0101] The calculation formula of the accuracy is:
[0102] ;
[0103] The calculation formula for the recall rate is:
[0104] ;
[0105] Step S4, real-time obstacle identification;
[0106] The image acquisition device on the sweeping robot acquires the indoor obstacle image to be tested in real time, the indoor obstacle image to be tested is input into the obstacle detection and recognition model, and the obstacle detection and recognition model outputs the obstacle detection result.
[0107] In addition to the optimizer algorithm content involved in the above training, in order to further and clearly explain the training process of the obstacle detection and recognition model, such as Figure 2 As shown in the figure, the specific model training steps are:
[0108] Step S3-01, collect data sets, preprocess, divide data sets and modify the optimizer to DASE-SGDM;
[0109] An indoor obstacle dataset is collected, the image data in the dataset is preprocessed, and the data in the dataset is divided. Finally, the algorithm in the optimizer in the obstacle detection and recognition model is modified to the DASE-SGDM algorithm.
[0110] Step S3-02, passing the image into the target detection network (i.e., obstacle detection and recognition model) and determining whether the image is a training set;
[0111] The sample image is input into the obstacle detection and recognition model (i.e., the YOLOv8s target detection network). If the sample image is a sample in the training set, proceed to step S3-03; if the sample image is not a sample in the training set, proceed to step S3-09.
[0112] Step S3-03, extracting features through the target detection network and determining whether it is the first execution;
[0113] The YOLOv8s target detection network performs feature extraction; if the YOLOv8s target detection network performs the feature extraction task for the first time, then proceed to step S3-04; if the YOLOv8s target detection network does not perform the feature extraction task for the first time, then proceed to step S3-06.
[0114] Step S3-04, initialize the DASE-SGDM optimizer.
[0115] Step S3-05, update the initial weights.
[0116] Step S3-06, back propagation updates the gradient value;
[0117] When updating the gradient value, it is determined whether the gradient counter reaches the preset value; if it does not reach the preset value, the optimizer actively updates the learning rate and enters step S3-07; if it reaches the preset value, the optimizer directly reduces the learning rate and then enters step S3-07.
[0118] Step S3-07, the DASE-SGDM optimizer optimizes the network weights.
[0119] Step S3-08, determining whether the image is the last image.
[0120] Determine whether the sample image is the last image; if the current sample image is the last image, proceed to step S3-12; if the current sample image is not the last image, proceed to step S3-03.
[0121] Step S3-09, using the weights optimized by the training set to determine the obstacle type.
[0122] Step S3-10, determining whether the image is the last image;
[0123] Determine whether the image is the last image; if it is the last image, proceed to step S3-11; if it is not the last image, proceed to step S3-09.
[0124] Step S3-11, calculate the accuracy of this test set, calculate the change value of the accuracy of this test set, output the recognized type, and enter step S3-13.
[0125] Step S3-12, training ends.
[0126] Step S3-13, end. Embodiment 2
[0127] This embodiment provides an indoor obstacle detection system based on an improved SGD algorithm, which is used to identify images acquired by a sweeping robot and ultimately identify which obstacles are in the images, which specifically includes:
[0128] The indoor obstacle sample image acquisition module is used to acquire indoor obstacle sample images through the image acquisition device on the sweeping robot, and mark the obstacles in the indoor obstacle sample images to obtain label data.
[0129] In this embodiment, all sample images are directly obtained by taking pictures of the sweeping robot through the image acquisition device on the sweeping robot when the sweeping robot moves indoors. The sweeping robot can be selected from existing sweeping robots and can be directly purchased on the market. The sweeping robot and the acquisition of image data by the sweeping robot are both existing technologies and can be directly applied without creative work.
[0130] Obstacle detection and recognition model building module, used to build deep learning neural networks.
[0131] In this embodiment, the structure of the deep learning neural network is not the innovative point. The deep learning neural network can adopt the existing network model structure yolov8s without any creative work.
[0132] The obstacle detection and recognition model training model is used to train the obstacle detection and recognition model constructed by the obstacle detection and recognition model construction module using the indoor obstacle sample images and label data in the indoor obstacle sample image acquisition module. During training, the specific training method and loss function are also not the innovation point. It can use the existing training method and the existing loss function without creative work.
[0133] The innovation of this implementation lies in the method of updating network parameters during training, that is, using the DASE-SGDM algorithm to update network parameters. The DASE-SGDM algorithm is specifically:
[0134] Step S3-1, initialization parameters , (usually assigned a value of 0), set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value :
[0135] ;
[0136] Step S3-2, update the first-order moment parameters:
[0137] ;
[0138] Step S3-3, update the second-order moment parameters:
[0139] ;
[0140] Step S3-4, update network parameters, gradient values and learning rate:
[0141] ;
[0142] ;
[0143] Detect the direction of gradient change and update the learning rate according to the direction of gradient change;
[0144] Step S3-5, repeating steps S3-2 to S3-4 until the training is completed;
[0145] in, Indicates the network parameters before updating, represents the updated network parameters, represents the first-order moment parameter before updating, represents the updated first-order moment parameter, represents the second-order moment parameter before updating, represents the updated second-order moment parameter, represents the gradient value before update, represents the updated gradient value, represents the differential, It should be noted that the loss function here is not the innovation of this application, and the existing loss function can be used.
[0146] In step S3-4, when detecting the direction of gradient change, the specific method is:
[0147] like ,but ,otherwise ;
[0148] When updating the learning rate according to the direction of gradient change, if If the gradient change threshold is greater than the preset value (for example, 10), the learning rate is updated as follows: ; Otherwise, the learning rate is updated as follows: That is, if we calculate ten times in a row , then directly update the learning rate to: ; Otherwise, the learning rate update algorithm adopts .
[0149] in, represents the performance feedback factor; Indicates the performance change symbol. If the performance improves, then is positive, if the performance decreases, then is negative.
[0150] In addition, the gradient change direction counter needs to be reset periodically. , learning rate is the initial value to prevent the learning rate from becoming too small to escape the local minimum.
[0151] After the obstacle detection and recognition model training is completed, the performance of the obstacle detection and recognition model needs to be evaluated. The evaluation indicators include accuracy and recall rate.
[0152] The calculation formula of the accuracy is:
[0153] ;
[0154] The calculation formula for the recall rate is:
[0155] ;
[0156] in, represents the number of true positive examples, represents the number of false positive examples, Represents the number of false negative examples.
[0157] The obstacle real-time recognition module is used to obtain the indoor obstacle test images in real time through the image acquisition device on the sweeping robot, the indoor obstacle test images are input into the obstacle detection and recognition model, and the obstacle detection and recognition model outputs the obstacle detection results.
[0158] Test example
[0159] In this test case, the obstacle detection and recognition model uses the existing yolov8s model for training and testing. The indoor obstacle sample image data set contains 120,000 images of 47 common obstacle categories in home scenes. Two optimizers (i.e., the traditional SGD optimizer and the innovative DASE-SGDM optimizer of this application) are used to specify the same initial learning rate, and the test is conducted after 100 rounds of training. In this test case, in addition to the conventional Precision and Recall, the evaluation index also uses the mAP evaluation index, especially the two specific forms of mAP50 and mAP50-95.
[0160] Among them, mAP (mean Average Precision) is an important indicator for measuring the performance of target detection algorithms. The formula of the indicator mAP is as follows:
[0161]
[0162] Among them, C represents the total number of categories, Represents the AP value of the i-th class.
[0163] It combines two indicators: precision and recall. These two indicators are defined as follows: Precision: the proportion of all samples predicted to be positive that are actually positive. Recall: the proportion of all samples actually positive that are predicted to be positive.
[0164] mAP50 and mAP50-95 are two specific forms of mAP: mAP50: This refers to the mean average precision calculated when the IoU (Intersection over Union) threshold is 0.5. Simply put, for each category, the area under its Precision-Recall curve (i.e. AP) is calculated, and then the average AP of all categories is taken. The IoU threshold here is fixed at 0.5, which means that if the overlap ratio between the predicted box and the true box reaches 50% or more, the prediction is considered correct.
[0165] mAP50-95: This means that when the IoU threshold is between 0.5 and 0.95, every 0.05 is used as a step size to calculate the average of multiple APs. In other words, it does not only calculate AP when IoU is 0.5, but calculates AP when IoU is 0.5, 0.55, 0.6, ..., 0.95, and then takes the average of these APs as the final mAP50-95. This method evaluates the performance of the model more strictly because it not only examines the detection accuracy under loose conditions, but also examines more stringent conditions.
[0166] After the above test, the test results are shown in Table 1.
[0167] Table 1 Comparison of test results
[0168]
[0169] Among them, SGD in the table represents the existing optimizer algorithm before improvement, DASE-SGDM represents the improved innovative optimizer algorithm (ie, DASE-SGDM algorithm), and Precision, Recall, mAP50, and mAP50-95 represent specific evaluation indicators.
[0170] As can be seen from Table 1, the model trained with the new optimized DASE-SGDM algorithm is significantly better than the model trained with the common optimization algorithm SGD in terms of multiple indicators such as Precision, Recall, mAP50, and mAP50-95. It can be seen that the DASE-SGDM algorithm can optimize the disadvantage of excessive oscillation in the traditional SGD algorithm and effectively prevent the phenomenon of jumping out of the optimal solution during the oscillation process, thereby improving the performance of the model and ultimately improving the detection accuracy of the sweeping robot for indoor obstacles.
[0171] In addition, this test case also simulates training using the traditional SGD optimizer and the innovative DASE-SGDM optimizer, and statistically analyzes the mean average precision (mAP50) in the training results, and draws the corresponding training accuracy curve, as shown below. Figure 3 , Figure 4 As shown. Figure 3 It can be seen that the final training accuracy curve fluctuates greatly when the traditional SGD optimizer is used without automatically adjusting the learning rate. Figure 4 It can be seen that after using the innovative DASE-SGDM optimizer and adjusting the learning rate, the final training accuracy curve changes more smoothly. It can be seen that the DASE-SGDM algorithm can optimize the shortcomings of excessive oscillation in the traditional SGD algorithm, effectively prevent the phenomenon of jumping out of the optimal solution during the oscillation process, thereby improving the performance of the model and ultimately improving the detection accuracy of the sweeping robot for indoor obstacles. Embodiment 3
[0172] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of an indoor obstacle detection method based on an improved SGD algorithm.
[0173] The computer device may be a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote control, a touch pad, or a voice control device.
[0174] The memory includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or D interface display memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is often used to store the operating system and various application software installed on the computer device, such as the program code of the indoor obstacle detection method based on the improved SGD algorithm, etc. In addition, the memory can also be used to temporarily store various types of data that have been output or are to be output.
[0175] The processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run the program code stored in the memory or process data, such as running the program code of the indoor obstacle detection method based on the improved SGD algorithm. Embodiment 4
[0176] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the steps of an indoor obstacle detection method based on an improved SGD algorithm.
[0177] The computer-readable storage medium stores an interface display program, and the interface display program can be executed by at least one processor so that the at least one processor performs the steps of the indoor obstacle detection method based on the improved SGD algorithm as described above.
[0178] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), including a number of instructions for a terminal device (which can be a mobile phone, computer, server or network device, etc.) to execute the indoor obstacle detection method based on the improved SGD algorithm described in the embodiment of the present application.
Claims
1. An indoor obstacle detection method based on an improved SGD algorithm, characterized in that: The steps include: Step S1, obtaining indoor obstacle sample images and label data; Step S2, constructing an obstacle detection and recognition model; Step S3, training an obstacle detection and recognition model; The obstacle detection and recognition model constructed in step S2 is trained using the indoor obstacle sample images and label data in step S1. The DASE-SGDM algorithm is used to update the network parameters during training. The DASE-SGDM algorithm is specifically as follows: Step S3-1, initialization parameters , , set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value : ; Step S3-2, update the first-order moment parameters: ; Step S3-3, update the second-order moment parameters: ; Step S3-4, using the updated first-order moment parameters and second-order moment parameters to update the network parameters and gradient values; the specific algorithm for updating the network parameters and gradient values is: ; ; in, represents the updated network parameters, represents the exponential decay rate, represents the updated first-order moment parameter, represents the updated second-order moment parameter, represents the updated gradient value, represents the differential, represents the loss function; Step S3-5, repeating steps S3-2 to S3-4 until the training is completed; in, Indicates the network parameters before update, represents the first-order moment parameter before updating, represents the second-order moment parameter before updating, Represents the gradient value before updating; Step S4, using the obstacle detection and recognition model to perform real-time obstacle recognition on the indoor image to be tested acquired by the sweeping robot to obtain an obstacle detection result.
2. The indoor obstacle detection method based on the improved SGD algorithm according to claim 1, characterized in that: In step 1, the specific method of obtaining indoor obstacle sample images and label data is as follows: The sweeping robot moves indoors and collects indoor images through an image acquisition device on the sweeping robot. The indoor images obtained by the sweeping robot are indoor obstacle sample images. Mark the obstacles in the indoor obstacle sample image to obtain label data.
3. The indoor obstacle detection method based on the improved SGD algorithm according to claim 1, characterized in that: In step S2, the obstacle detection and recognition model is a deep learning neural network.
4. The indoor obstacle detection method based on the improved SGD algorithm according to claim 3, characterized in that: The deep learning neural network uses the YOLOv8s network.
5. The indoor obstacle detection method based on the improved SGD algorithm according to claim 1, characterized in that: After updating the gradient value, the direction of the gradient change is determined according to the gradient values before and after the update, and the learning rate is updated according to the direction of the gradient change.
6. The indoor obstacle detection method based on the improved SGD algorithm according to claim 5, characterized in that: When updating the learning rate according to the direction of gradient change, the specific method is: like ,but ,otherwise ; When updating the learning rate according to the direction of gradient change, if If it is greater than the preset gradient change threshold, the learning rate update method is: ; Otherwise, the learning rate is updated as follows: ; in, represents the performance feedback factor; Indicates the performance change symbol. If the performance improves, then is positive, if the performance decreases, then is negative.
7. The indoor obstacle detection method based on the improved SGD algorithm according to claim 1, characterized in that: In step S3, the performance of the trained obstacle detection and recognition model is evaluated, and the evaluation indicators include accuracy and recall rate; The accuracy is calculated as follows: ; The calculation formula for recall is: ; in, represents the number of true positive examples, represents the number of false positive examples, Represents the number of false negative examples.
8. An indoor obstacle detection system based on an improved SGD algorithm, characterized in that: The steps include: An indoor obstacle sample image acquisition module is used to acquire indoor obstacle sample images and label data; Obstacle detection and recognition model building module, used to build an obstacle detection and recognition model; Obstacle detection and recognition model training module, used to train obstacle detection and recognition model; The obstacle detection and recognition model constructed by the obstacle detection and recognition model construction module is trained using the indoor obstacle sample images and label data in the indoor obstacle sample image acquisition module. The DASE-SGDM algorithm is used to update the network parameters during training. The DASE-SGDM algorithm is specifically as follows: Step S3-1, initialization parameters , , set the momentum parameter , exponential decay rate , gradient change direction counter , performance feedback factor , and calculate the initial gradient value : ; Step S3-2, update the first-order moment parameters: ; Step S3-3, update the second-order moment parameters: ; Step S3-4, using the updated first-order moment parameters and second-order moment parameters to update the network parameters and gradient values; the specific algorithm for updating the network parameters and gradient values is: ; ; in, represents the updated network parameters, represents the exponential decay rate, represents the updated first-order moment parameter, represents the updated second-order moment parameter, represents the updated gradient value, represents the differential, represents the loss function; Step S3-5, repeating steps S3-2 to S3-4 until the training is completed; in, Indicates the network parameters before update, represents the first-order moment parameter before updating, represents the second-order moment parameter before updating, Represents the gradient value before updating; The obstacle real-time recognition module is used to use the obstacle detection and recognition model to perform real-time obstacle recognition on the indoor test image obtained by the sweeping robot to obtain the obstacle detection result.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Sweeping robot movement obstacle avoidance and route control method and device and sweeping robot
CN113534820A
Dynamic obstacle avoidance method based on real-time construction of local grid map
CN114384920A
Differential privacy protection method and device based on deep learning
CN118133332A
Intelligent sweeper target detection method based on YOLOv7
CN118505973A