Object detection method, device, terminal equipment and storage medium
Through the training and pruning of the optimized network model, combined with TensorRT framework optimization, the problem of low target detection efficiency of mobile smart products is solved, and efficient and highly accurate object detection is achieved, which is suitable for independent judgment and obstacle avoidance functions.
Patent Information
- Application Number
- CN202110160557.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-02-05
AI Technical Summary
Existing smart products with mobile functions are less efficient in target detection and difficult to meet the requirements of high performance and high accuracy.
By training and pruning the preset optimized network model, the target network model is obtained, and the TensorRT framework is used for optimization to achieve target object detection and improve detection efficiency and accuracy.
It improves the accuracy of object detection, reduces calculation time, improves target detection efficiency, and is suitable for independent judgment and obstacle avoidance functions of mobile smart products.
Smart Images

Figure CN112966565B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to an object detection method, apparatus, terminal device and storage medium. Background Art
[0002] With the rapid development of artificial intelligence technology, various artificial intelligence products have emerged. Smart products with mobile functions can make autonomous judgments on road conditions during driving and need to detect objects to achieve functions such as obstacle avoidance.
[0003] Due to the speed of movement, smart products on the move have very high requirements for the performance and accuracy of target detection algorithms. However, most smart products with mobile functions currently use sensors such as lasers, ultrasonic radars, infrared, or traditional algorithms to detect obstacles, which are less efficient. Summary of the invention
[0004] The embodiments of the present application provide an object detection method, apparatus, terminal device and storage medium, which aim to solve the problem of low efficiency of target detection in existing smart products with mobile functions.
[0005] In a first aspect, an embodiment of the present application provides an object detection method, including:
[0006] Training the preset optimized network model to obtain a pre-trained optimized network model;
[0007] Performing model pruning on the pre-trained optimized network model to obtain a target network model;
[0008] When the target image is acquired, the target object is detected through the target network model to obtain a detection result.
[0009] In one embodiment, after obtaining the detection result, the method further includes: when the detection result includes a target object, obtaining the type and position of the target object;
[0010] According to the type and position of the target object, an operation corresponding to the type and position of the target object is performed.
[0011] In one embodiment, when the target image is acquired, target object detection is performed by the target network model, and before the detection result is obtained, the process includes:
[0012] The target network model is optimized through the TensorRT framework model to obtain the TensorRT engine model.
[0013] In one embodiment, the target network model is optimized by using the TensorRT framework model to obtain a TensorRT engine model, including:
[0014] Converting the target network model into a target network model in a preset format;
[0015] The target network model in the preset format is loaded into the TensorRT framework model to obtain the TensorRT engine model that has loaded the target network model in the preset format.
[0016] In one embodiment, performing target object detection through the target network model to obtain a detection result includes:
[0017] The target object is detected by the TensorRT engine model to obtain the detection result.
[0018] In one embodiment, the performing model pruning on the pre-trained optimized network model to obtain a target network model includes:
[0019] The pre-trained optimized network model is subjected to network structure pruning and network weight pruning according to a preset compression algorithm to obtain a target network model.
[0020] In one embodiment, the optimization network model is built based on the YOLOv5 model and uses the small model of MobileNetV3 as the backbone network.
[0021] In a second aspect, an embodiment of the present application provides an object detection device, including:
[0022] A training module, used to train a preset optimized network model to obtain a pre-trained optimized network model;
[0023] A pruning module, used to perform model pruning on the pre-trained optimized network model to obtain a target network model;
[0024] The detection module is used to perform target object detection through the target network model to obtain a detection result when a target image is acquired.
[0025] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned object detection method when executing the computer program.
[0026] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the object detection method are implemented.
[0027] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the steps of the above-mentioned object detection method.
[0028] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application can obtain a pre-trained optimized network model by training a preset optimized network model; perform model pruning on the pre-trained optimized network model to obtain a target network module, and when a target image is acquired, perform target object detection through the target network model to obtain a detection result. Since pruning the optimized network model after training can improve the accuracy of object detection and reduce the operation time, the efficiency of target detection is improved.
[0029] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0031] Figure 1 is a flowchart of an object detection method provided by an embodiment of the present application;
[0032] Figure 2 This is a flow chart of an object detection method provided by another embodiment of the present application.
[0033] Figure 3 is a structural schematic diagram of an object detection device provided in one embodiment of the present application;
[0034] Figure 4 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0035] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0036] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0037] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0038] As used in the specification and appended claims of this application, 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.
[0039] In addition, in the description of the present application 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.
[0040] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear 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.
[0041] The object detection method provided in the embodiment of the present application can be applied to a robot, and the robot can be a mobile robot, and the mobile robot can be a smart car. The robot can also be a service robot, an entertainment robot, a military robot, an agricultural robot, etc. The embodiment of the present application does not impose any restrictions on the specific type of the robot.
[0042] For example, in one application scenario, the object detection method provided in the embodiment of the present application is applied to a smart car. For example, an autonomous driving smart car usually uses a camera as a sensor, and completes the automatic tracking driving task on a specific path through an automatic tracking algorithm. In order for the smart car to have AI capabilities, it is also necessary to make autonomous judgments on road conditions during autonomous tracking driving, such as giving stop and drive signal feedback to traffic lights on the road, outputting accurate location information of obstacles (such as pedestrians, other vehicles, and obstacles), and correctly identifying traffic signs. The object detection method in the embodiment of the present application can meet the recognition needs of the smart car in addition to path recognition, can efficiently output the location information of various target objects, support the car to make corresponding decisions, and can reflect the AI capabilities of the smart car.
[0043] In order to illustrate the technical solution described in this application, the following embodiments are used for illustration.
[0044] See also Figure 1 , an object detection method provided in an embodiment of the present application includes:
[0045] Step S101, training a preset optimized network model to obtain a pre-trained optimized network model.
[0046] Specifically, an optimization network model can be constructed in advance based on a lightweight network model. According to the multiple object types that need to be identified, a large number of sample images containing the multiple types of objects are prepared, and each sample image includes an object classification labeling corresponding to the object. A large number of sample images are prepared to train the preset optimization network model until the preset loss function of the optimization network model converges, and the optimization network model is determined to be a trained network model (i.e., a pre-trained optimization network model). The preset loss function can be a cross entropy loss function or a mean square error loss function. The target object is detected by the obtained pre-trained optimization network, and the object category and the location information of the object are determined when the target object is detected.
[0047] In one embodiment, the optimization network model is built based on the YOLOv5 model and uses the small model of MobileNetV3 as the backbone network.
[0048] Specifically, a network model is constructed on the basis of YOLOv5. The model size of YOLOv5 is mainly divided into l (large), m (middle), and s (small). Different network widths and different parameter amounts can apply the YOLOv5 algorithm to scenarios with different performance requirements. Since the execution terminal of this application is a mobile intelligent product, the network structure based on the s model, that is, the network structure with the smallest parameter amount, is selected as the benchmark network to be suitable for scenarios with short time consumption and high precision. However, even the s model of YOLOv5 with the smallest parameter amount is still relatively time-consuming to run on a mobile intelligent product. In order to further compress the model size, the model needs to be lightweight. The original backbone of YOLOv5 uses a cross-stage local network (CSPNet), and its l, m, and s models of different sizes are only scaled in terms of model depth and number of channels, and its essential structure has not changed. Therefore, the backbone formed by stacking CSPNet is also relatively heavy for the s model. Therefore, this application adopts the small model of mobilenetv3, which is more friendly to the deployment of mobile terminals, as the backbone network (backbone), which can further compress the model size.
[0049] Step S102, performing model pruning on the pre-trained optimized network model to obtain a target network model.
[0050] Specifically, the parameters in the pre-trained optimized network model are already the parameters that have been adjusted during the training process, but there may be parameters that have little effect on the final detection performance of the model. Therefore, these parameters in the model that have little effect on the final detection performance can be pruned out through a pruning algorithm.
[0051] In one embodiment, the performing model pruning on the pre-trained optimized network model to obtain a target network model includes: performing network structure pruning and network weight pruning on the pre-trained optimized network model according to a preset compression algorithm to obtain a target network model.
[0052] Specifically, the pruning algorithm for the network model can be network structure pruning and network weight pruning. Network structure pruning can be pruning of structured parameters such as filters and channels in the network model, thereby achieving model compression and acceleration. Network weight pruning can be model compression by trimming individual weight parameters in the network model. For example, network structure pruning and network weight pruning can be performed through the analysis and compression algorithm provided by Intel's open source neural network compression library Distiller.
[0053] In one application, filters corresponding to parameters whose structural parameters are less than a first preset threshold are pruned and deleted, and channels corresponding to parameters whose structural parameters are less than a second preset threshold are determined to be unimportant channels and deleted, thereby reducing the complexity of the model.
[0054] Step S103, when the target image is acquired, target object detection is performed through the target network model to obtain a detection result.
[0055] Specifically, during the process of executing terminal movement, an image sensor (such as a camera) may be used to collect an image, which is called a target image. The collected target image is used to detect the target object through a target network model to obtain a detection result. The detection result may specifically be outputting the position information of the target object in the image and the classification label of the target object when the target object is detected.
[0056] In one embodiment, when the target image is acquired, target object detection is performed through the target network model, and before the detection result is obtained, it includes: optimizing the target network model through the TensorRT framework model to obtain the TensorRT engine model.
[0057] Specifically, TensorRT technology can optimize and deploy the pre-trained target network model, improve the model's reasoning speed, and improve the real-time detection of the model when there are multiple target objects. Therefore, the TensorRT framework model is used to optimize the target network model to obtain the TensorRT engine model. For example, the TensorRT framework model can use NVIDIA's graphics processing unit (GPU).
[0058] In one embodiment, optimizing the target network model through the TensorRT framework model to obtain the TensorRT engine model includes: converting the target network model into a target network model in a preset format; loading the target network model in the preset format into the TensorRT framework model to obtain a TensorRT engine model with the target network model in the preset format loaded.
[0059] Specifically, TensorRT supports the Open Neural Network Exchange (NNOX) model, which converts the target network model into an ONNX model first, and then into the engine model of TensorRT. For example, the target network model can be converted into an ONNX model according to the ONNX interface plug-in, and the target network model can be converted into an ONNX model file, that is, a .onnx file. Then use the TensorRT framework model to load the converted ONNX model file to generate the engine model of TensorRT, that is, the TensorRT engine model of the target network model in a preset format. The TensorRT engine model uses FP16 (16-bit floating point) instead of FP32 (32-bit floating point) engine model to further reduce the model size. The FP16 model can double the speed with only a small loss of accuracy.
[0060] Performing target object detection through the target network model to obtain a detection result includes: performing target object detection through the TensorRT engine model to obtain the detection result.
[0061] Specifically, the TensorRT engine model of the target network model in the preset format is loaded with target object detection to obtain the detection result.
[0062] In one embodiment, after obtaining the detection result, the process further includes steps S201 to S202:
[0063] Step S201: when the detection result includes a target object, obtain the type and position of the target object.
[0064] Specifically, when the above detection result is that a target object is detected, the type and position of the target object are determined according to the detection result.
[0065] Step S202: Execute an operation corresponding to the type and position of the target object according to the type and position of the target object.
[0066] Specifically, the type and position of the target object are determined according to the detection result, and the position is the position of the target object in the image coordinate system of the execution terminal. The position of the target object in the image coordinate system is converted into the position of the target object in the world coordinate system according to the calibration parameters of the execution terminal, and the corresponding pre-associated linkage operation is performed according to the type of the target object and the position of the target object in the world coordinate system. For example, if the type of the target object is detected to be a red light, the distance from the red light is determined according to the position of the red light, and the operation pre-associated with the distance under the red light type is performed, so that the type of object (such as pedestrians, other vehicles, obstacles) and position can be determined, and corresponding feedback is made according to the type and position of the object.
[0067] The embodiment of the present application can obtain a pre-trained optimized network model by training a preset optimized network model; perform model pruning on the pre-trained optimized network model to obtain a target network module, and when a target image is acquired, perform target object detection through the target network model to obtain a detection result. Since pruning the optimized network model after training can improve the accuracy of object detection and reduce the operation time, the efficiency of target detection is improved.
[0068] The present application also provides an object detection device for executing the steps in the above-mentioned object detection method embodiment. The object detection device can be a virtual appliance in a terminal device, which is run by a processor of the terminal device, or it can be the terminal device itself.
[0069] like Figure 3 As shown, the object detection device 300 provided in the embodiment of the present application includes:
[0070] The training module 301 is used to train the preset optimized network model to obtain a pre-trained optimized network model;
[0071] A pruning module 302 is used to perform model pruning on the pre-trained optimized network model to obtain a target network model;
[0072] The detection module 303 is used to perform target object detection through the target network model to obtain a detection result when a target image is acquired.
[0073] In one embodiment, the object detection device further includes:
[0074] an acquisition module, for acquiring the type and position of the target object when the detection result includes the target object;
[0075] The execution module is used to execute the operation corresponding to the type and position of the target object according to the type and position of the target object.
[0076] In one embodiment, the object detection device further includes:
[0077] The optimization module is used to detect the target object through the target network model when the target image is acquired, and optimize the target network model through the TensorRT framework model to obtain the TensorRT engine model before obtaining the detection result.
[0078] In one embodiment, the optimization module specifically includes:
[0079] A conversion unit, used for converting the target network model into a target network model in a preset format;
[0080] A loading unit is used to load the target network model in the preset format into the TensorRT framework model to obtain a TensorRT engine model that has loaded the target network model in the preset format.
[0081] In one embodiment, the detection module is specifically used to: perform target object detection through the TensorRT engine model to obtain the detection result.
[0082] In one embodiment, the pruning module is specifically used to: perform network structure pruning and network weight pruning on the pre-trained optimized network model according to a preset compression algorithm to obtain a target network model.
[0083] In one embodiment, the optimization network model is built based on the YOLOv5 model and uses the small model of MobileNetV3 as the backbone network.
[0084] The embodiment of the present application can obtain a pre-trained optimized network model by training a preset optimized network model; perform model pruning on the pre-trained optimized network model to obtain a target network module, and when a target image is acquired, perform target object detection through the target network model to obtain a detection result. Since pruning the optimized network model after training can improve the accuracy of object detection and reduce the operation time, the efficiency of target detection is improved.
[0085] like Figure 4 As shown, one embodiment of the present invention further provides a terminal device 400 including: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401, such as an object detection program. When the processor 401 executes the computer program 403, the steps in the above-mentioned object detection method embodiments are implemented. When the processor 401 executes the computer program 403, the functions of the modules in the above-mentioned device embodiments are implemented, such as Figure 3 Functions of modules 301 to 303 are shown.
[0086] Exemplarily, the computer program 403 may be divided into one or more modules, which are stored in the memory 402 and executed by the processor 401 to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 403 in the terminal device 400. For example, the computer program 403 may be divided into a training module, a pruning module, and a detection module, and the specific functions of each module have been described in the above embodiments and will not be repeated here.
[0087] The terminal device 400 may be a robot with mobile functions, or a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will understand that Figure 4 It is only an example of the terminal device 400 and does not constitute a limitation of the terminal device 400. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0088] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0089] The memory 402 may be an internal storage unit of the terminal device 400, such as a hard disk or memory of the terminal device 400. The memory 402 may also be an external storage device of the terminal device 400, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 400. Further, the memory 402 may also include both an internal storage unit of the terminal device 400 and an external storage device. The memory 402 is used to store the computer program and other programs and data required by the terminal device. The memory 402 may also be used to temporarily store data that has been output or is to be output.
[0090] The technicians in the relevant field 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 for illustration. In practical applications, the above-mentioned function allocation can be 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. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0091] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0092] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0093] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0095] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0097] 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. An object detection method, characterized in that: include: The preset optimized network model is trained to obtain a pre-trained optimized network model; wherein the optimized network model is constructed based on the YOLOv5 model and uses the network structure model with the smallest parameter amount of MobileNetV3 as the backbone network; Performing model pruning on the pre-trained optimized network model to obtain a target network model; When a target image is acquired, target object detection is performed through the target network model to obtain a detection result; The performing model pruning on the pre-trained optimized network model to obtain a target network model includes: The pre-trained optimized network model is subjected to network structure pruning and network weight pruning according to a preset compression algorithm to obtain a target network model; wherein the network structure pruning includes pruning filters and channels in the network model, and the network weight pruning includes model compression by trimming individual weight parameters in the network model; When the target image is acquired, the target object is detected by the target network model, and before the detection result is obtained, the process includes: Converting the target network model into an open neural network exchange model; loading the open neural network exchange model into a TensorRT framework model to obtain a TensorRT engine model of the loaded open neural network exchange model; The target object is detected by the TensorRT engine model to obtain the detection result.
2. The object detection method according to claim 1, characterized in that: After obtaining the test results, it also includes: When the detection result includes a target object, obtaining the type and position of the target object; According to the type and position of the target object, an operation corresponding to the type and position of the target object is performed.
3. An object detection device, characterized in that: include: A training module is used to train a preset optimized network model to obtain a pre-trained optimized network model; wherein the optimized network model is constructed based on the YOLOv5 model and uses the network structure model with the smallest parameter amount of MobileNetV3 as the backbone network; A pruning module, used to perform model pruning on the pre-trained optimized network model to obtain a target network model; A detection module is used to detect the target object through the target network model when the target image is acquired to obtain a detection result; The pruning module is specifically used for: The pre-trained optimized network model is subjected to network structure pruning and network weight pruning according to a preset compression algorithm to obtain a target network model; wherein the network structure pruning includes pruning filters and channels in the network model, and the network weight pruning includes model compression by trimming individual weight parameters in the network model; The object detection device further includes: An optimization module is used to detect the target object through the target network model when the target image is acquired, and optimize the target network model through the TensorRT framework model to obtain the TensorRT engine model before obtaining the detection result; The optimization module specifically includes: A conversion unit, used to convert the target network model into an open neural network exchange model; A loading unit, used to load the open neural network exchange model into the TensorRT framework model to obtain a TensorRT engine model of the loaded open neural network exchange model; The detection module is specifically used to: perform target object detection through the TensorRT engine model to obtain the detection result.
4. A terminal 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 method according to claim 1 or 2 is implemented.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to claim 1 or 2 is implemented.
