Target object detection method and device and computer equipment
By adjusting and detecting the shadowed areas in the image to be detected, the accuracy of target object detection is improved, and the missed detection and false detection problems caused by shadowed areas in traditional technology are solved.
Patent Information
- Application Number
- CN202411586912.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
AI Technical Summary
When traditional object detection technology processes images containing shadowed areas, it is easy to cause missed detection and misdetection problems, resulting in low detection accuracy.
By obtaining the image to be detected, the preset shadow detection model is used to divide the image into shadowed areas and non-shaded areas, the shadow intensity coefficient of the shadowed area is calculated, and the shadowed area is adjusted when the coefficient is higher than the preset threshold, and the adjusted The image to be detected, and then the object detection is performed using the preset object detection model.
By adjusting the shadowed area and then performing object detection, the accuracy of target object detection is significantly improved, and the problem of low detection accuracy in traditional technology is solved.
Smart Images

Figure CN119478366A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a target object detection method, device and computer equipment. Background Art
[0002] With the popularization of artificial intelligence technology, target detection algorithms are often used to detect people in images to be detected when matching people. However, traditional target detection technology directly detects people in images to be detected. In real scenarios, due to the influence of factors such as lighting and camera position, shadow areas will exist in the image, resulting in missed detections and false detections in traditional target detection. Summary of the invention
[0003] The embodiments of the present application provide a target object detection method, apparatus and computer device to at least solve the technical problem of low accuracy in detecting target objects from images to be detected in the related art.
[0004] According to one aspect of an embodiment of the present application, a target object detection method is provided, including: obtaining an image to be detected; dividing the image to be detected into a shadow area and a non-shadow area using a preset shadow detection model; obtaining a shadow intensity coefficient of the shadow area, and when the shadow intensity coefficient is higher than a preset threshold, adjusting the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; and performing target detection on the adjusted image to be detected using a preset target detection model to obtain the target object.
[0005] Optionally, obtaining the shadow intensity coefficient of the shadow area includes: obtaining the number of the shadow areas and the coordinates of all pixel points in each shadow area; determining shadow discrete degree coefficients of multiple shadow areas based on the number of shadow areas and the coordinates of all pixel points in each shadow area, the shadow discrete degree coefficients being used to characterize the discrete degree of the shadow areas; and determining the shadow intensity coefficient based on the shadow discrete degree coefficients of the shadow areas.
[0006] Optionally, determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area includes: obtaining the width of the image to be detected, the height of the image to be detected and the area of the shadow area; determining the proportion coefficient of the shadow area based on the width of the image to be detected, the height of the image to be detected and the area of the shadow area, the proportion coefficient of the shadow area being used to characterize the proportion of the shadow area in the entire picture; determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area and the proportion coefficient of the shadow area.
[0007] Optionally, the shadow area is adjusted to obtain an adjusted image to be detected, including: converting the RGB color space of the shadow area into the HSI color space, and obtaining the average value of the brightness component of the image to be detected; determining the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected; and adjusting the shadow area according to the brightness adaptive gamma correction factor to obtain the adjusted image to be detected.
[0008] Optionally, the brightness adaptive gamma correction factor is determined based on the average value of the brightness component of the image to be detected, including: obtaining the brightness component of the shadow area, and obtaining the ratio of the brightness component of the shadow area to the average value of the brightness component of the image to be detected; and determining the brightness adaptive gamma correction factor according to the ratio.
[0009] Optionally, the shadow area is adjusted according to the brightness adaptive gamma correction factor to obtain an adjusted image to be detected, including: adjusting the brightness components of all pixels in the shadow area to a target brightness component to obtain an adjusted shadow area, wherein the target brightness component is determined based on a target power of the brightness components of the pixels in the shadow area, and the target power is equal to the value of the brightness adaptive gamma correction factor; and splicing the adjusted shadow area with the non-shadow area to obtain the adjusted image to be detected.
[0010] Optionally, the method also includes: acquiring a first training data set and a second training data set, the first training data set including a plurality of images in which the target object is pre-marked, and the second training data set including a plurality of images in which shadow area positions are pre-marked; and respectively using the first training data set and the second training data set to train to obtain the preset target detection model and the preset shadow detection model.
[0011] According to another aspect of an embodiment of the present application, a target object detection device is also provided, including: an acquisition module, used to acquire an image to be detected; a division module, used to divide the image to be detected into a shadow area and a non-shadow area using a preset shadow detection model; an adjustment module, used to obtain a shadow intensity coefficient of the shadow area, and when the shadow intensity coefficient is higher than a preset threshold, adjust the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; and a detection module, used to perform target detection on the adjusted image to be detected using a preset target detection model to obtain the target object.
[0012] According to another aspect of the embodiments of the present application, a computer device is provided, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and is used to execute the above-mentioned target object detection method.
[0013] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned target object detection method by running the computer program.
[0014] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned target object detection method when executed by a processor.
[0015] In an embodiment of the present application, an image to be detected is acquired; a preset shadow detection model is used to divide the image to be detected into a shadow area and a non-shadow area; a shadow intensity coefficient of the shadow area is acquired, and when the shadow intensity coefficient is higher than a preset threshold, the shadow area is adjusted to obtain an adjusted image to be detected, and the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; a preset target detection model is used to perform target detection on the adjusted image to be detected to obtain the target object, thereby achieving the purpose of performing target detection after adjusting the shadow area of the image to be detected, thereby realizing the technical effect of improving the accuracy of target object detection, and further solving the technical problem of low accuracy in detecting target objects from images to be detected in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 is a hardware structure block diagram of a computer terminal for implementing a target object detection method according to an embodiment of the present application;
[0018] Figure 2 is a flow chart of a target object detection method according to an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of a ternary loss training process according to an embodiment of the present application;
[0020] Figure 4 It is a structural diagram of a target object detection device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] The information collected in the embodiments of the present application is information and data authorized by the account or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for the account to choose to authorize or reject the automated decision-making results; if the account chooses to reject, it enters the expert decision-making process.
[0024] In order to solve the problems existing in the related art, the present application embodiment provides a target object detection method, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.
[0025] The target object detection method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a target object detection method. Figure 1As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0026] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0027] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the target object detection method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned target object detection method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0028] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0029] The display may be, for example, a touch screen liquid crystal display (LCD), which may enable the account to interact with the account interface of the computer terminal 10 .
[0030] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.
[0031] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a target object detection method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] Figure 2 is a flow chart of a target object detection method according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0033] Step S202, obtaining an image to be detected;
[0034] Step S204, using a preset shadow detection model to divide the image to be detected into a shadow area and a non-shadow area;
[0035] In step S204, the preset shadow detection model may be a UNet model (a convolutional neural network (CNN) architecture used for image segmentation tasks). In actual application scenarios, the shadow area may be an area with lower clarity in the image area due to lighting or shooting angle.
[0036] Step S206, obtaining a shadow intensity coefficient of the shadow area, and if the shadow intensity coefficient is higher than a preset threshold, adjusting the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected;
[0037] Step S208: Use a preset target detection model to perform target detection on the adjusted image to be detected to obtain the target object.
[0038] In step S208, the preset target detection model may be a commonly used target detection model such as a YoloV5 model.
[0039] Through the above steps S202 to S208, the image to be detected is obtained; the image to be detected is divided into a shadow area and a non-shadow area by using a preset shadow detection model; the shadow intensity coefficient of the shadow area is obtained, and when the shadow intensity coefficient is higher than a preset threshold, the shadow area is adjusted to obtain an adjusted image to be detected, and the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; the preset target detection model is used to perform target detection on the adjusted image to be detected to obtain the target object, thereby achieving the purpose of adjusting the shadow area of the image to be detected before performing target detection, thereby achieving the technical effect of improving the accuracy of target object detection, and further solving the technical problem of low accuracy of detecting target objects from the image to be detected in the related art. The following is a detailed description.
[0040] In step S206 of the target object detection method, the specific steps of obtaining the shadow intensity coefficient of the shadow area are as follows: obtaining the number of the shadow areas and the coordinates of all the pixel points in each shadow area; determining the shadow discrete degree coefficients of the multiple shadow areas based on the number of the shadow areas and the coordinates of all the pixel points in each shadow area, wherein the shadow discrete degree coefficient is used to characterize the discrete degree of the shadow area; determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area.
[0041] Among them, the specific steps of determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area are as follows: obtain the width of the image to be detected, the height of the image to be detected and the area of the shadow area; determine the proportion coefficient of the shadow area based on the width of the image to be detected, the height of the image to be detected and the area of the shadow area, and the proportion coefficient of the shadow area is used to characterize the proportion of the shadow area in the entire picture; determine the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area and the proportion coefficient of the shadow area.
[0042] Taking the image to be detected as P as an example, the image to be detected P is input into the trained image shadow detection UNet model; the image shadow detection UNet model divides the image to be detected P into N shadow areas M i (x i ,y i ),i∈[1,Q] and non-shaded area Q is a positive integer, indicating the number of pixels in the shadow area.
[0043] The shadow dispersion coefficient α is defined to measure the dispersion degree of the shadow area. The calculation formula is as follows:
[0044]
[0045] Define the shadow area ratio coefficient β, which is used to measure the proportion of the shadow area in the entire image. The calculation formula is as follows:
[0046]
[0047] Where W is the width of the image P to be detected, H is the height of the image P to be detected, S M is the area of the shaded region.
[0048] The shadow intensity coefficient γ is obtained based on the shadow dispersion coefficient α and the shadow area ratio coefficient β. The calculation formula is as follows:
[0049]
[0050] In some embodiments of the present application, the shadow area is adjusted to obtain an adjusted image to be detected. The specific method includes: converting the RGB color space of the shadow area into the HSI color space, and obtaining the average value of the brightness component of the image to be detected; determining the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected; adjusting the shadow area according to the brightness adaptive gamma correction factor to obtain the adjusted image to be detected.
[0051] It can be understood that the main purpose of converting the shadow part of the image to be detected from the RGB color space to the HSI (Hue, Saturation, Intensity) color space is to separate the color information and the brightness information, so as to enhance the shadow area more effectively. In the HSI color model: Hue: represents the basic attributes of color, such as red, green, blue, etc. Saturation: represents the purity of color, that is, the ratio between color and gray. Intensity: represents the brightness or lightness of color. Converting the image to the HSI color space allows the brightness (Intensity) component of the image to be operated more directly without affecting its color information (Hue and Saturation). This is especially important for the enhancement of the shadow area, because the shadow mainly affects the brightness of the image, but has little effect on the color. By adjusting the brightness component, only the brightness of the image can be corrected while maintaining the original color, thereby reducing the impact of the shadow on the target detection and improving the detection accuracy. In addition, the HSI color space has better intuitiveness and operability when processing image brightness changes, so it is often used in tasks such as brightness adjustment and color correction in the field of image processing and computer vision. In the shadow compensation algorithm, by adjusting the intensity component, the brightness of the shadow area can be adaptively enhanced without causing color distortion.
[0052] In actual application scenarios, the preset threshold can be set as needed, for example: 0.5.
[0053] In an optional manner, the process of determining the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected is as follows: obtaining the brightness component of the shadow area, and obtaining the ratio of the brightness component of the shadow area to the average value of the brightness component of the image to be detected; determining the brightness adaptive gamma correction factor according to the ratio.
[0054] Specifically, the shadow part of the image to be detected is converted from the RGB color space to the HSI color space.
[0055] Calculate the average value of the brightness component of the image to be detected The calculation formula is as follows:
[0056]
[0057] In the formula, (x m ,y n ) represents the coordinates of each pixel in the image to be detected, m represents the number of horizontal coordinates, and n represents the number of vertical coordinates.
[0058] Calculate the brightness adaptive gamma correction factor γ, the calculation formula is as follows:
[0059]
[0060] Among them, I M It is the brightness component of the pixels in the shadow area.
[0061] In some embodiments of the present application, the shadow area is adjusted according to the brightness adaptive gamma correction factor to obtain the adjusted image to be detected. The process is as follows: the brightness components of all pixels in the shadow area are adjusted to the target brightness components to obtain the adjusted shadow area, and the target brightness component is determined based on the target power of the brightness components of the pixels in the shadow area, and the target power is equal to the value of the brightness adaptive gamma correction factor; the adjusted shadow area is spliced with the non-shadow area to obtain the adjusted image to be detected.
[0062] Specifically, the shadow part of the image is adjusted in combination with the brightness adaptive gamma correction factor, and the calculation formula is as follows:
[0063]
[0064] Where M E represents the shadow area after adjustment, M represents the shadow area before adjustment, and M γ Indicates that the shadow area is adjusted using a gamma correction factor.
[0065] An optional manner is to adjust the brightness components of the pixels in the shadow area to the target brightness components to obtain the adjusted pixels in the shadow area.
[0066] There are many ways to splice the adjusted shadow area with the non-shadow area, for example: directly replacing the shadow area in the image to be detected with the adjusted shadow area, cropping the image to be detected, cropping the shadow area, and splicing the adjusted shadow area with the cropped image to be detected.
[0067] It can be understood that the training method of the preset target detection model and the preset shadow detection model is as follows: obtain a first training data set and a second training data set, the first training data set includes a plurality of images of the target object pre-marked, and the second training data set includes a plurality of images of shadow area positions pre-marked; use the first training data set and the second training data set to train respectively to obtain the preset target detection model and the preset shadow detection model.
[0068] In actual application scenarios, the training process of the preset shadow detection model is as follows:
[0069] Step 1: Collect a large number of images with shadows to build a dataset, including but not limited to scenes such as communities, roads, schools, and drone aerial photography;
[0070] Step 2: Manually mark the shadow position in each image using computer annotation software, and divide 10% of the images as the test set;
[0071] Step 3: Train the model with the labeled images and test it with the test set. If the accuracy rate reaches 80% or above, the model training is completed. If not, return to step 1 and continue to collect data sets for retraining until the accuracy rate reaches the target.
[0072] The training process of the preset shadow detection model is as follows:
[0073] Step 1: Collect a large number of images with people to build a dataset, including but not limited to scenes such as communities, roads, schools, and drone aerial photography;
[0074] Step 2: Manually mark the shadow position in each image using computer annotation software, and divide 10% of the images as the test set;
[0075] Step 3: Train the model with the labeled images and test it with the test set. If the accuracy rate reaches 80% or above, the model training is completed. If not, return to step 1 and continue to collect data sets for retraining until the accuracy rate reaches the target.
[0076] Figure 3 Another target object detection method is shown, such as Figure 3 As shown, step 1 is to train the image shadow detection UNet model; step 2 is to train the personnel detection YoloV5 model; step 3 is to detect the shadow part of the image to be detected based on the trained image shadow detection UNet model, and divide the image into a shadow part and a non-shadow part; step 4 is to calculate the shadow intensity coefficient based on the shadow intensity evaluation method; step 5 is to enhance the shadow part of the image based on the brightness adaptive gamma shadow compensation algorithm; step 6 is to combine the enhanced image shadow part with the image non-shadow part to obtain the final shadow image compensation result; step 7 is to detect and identify the person in the image based on the trained personnel detection YoloV5 model.
[0077] Figure 4 is a structural diagram of a target object detection device according to an embodiment of the present application, such as Figure 4 As shown, the device comprises:
[0078] An acquisition module 40 is used to acquire an image to be detected;
[0079] A division module 42, used for dividing the image to be detected into a shadow area and a non-shadow area by using a preset shadow detection model;
[0080] An adjustment module 44 is used to obtain a shadow intensity coefficient of the shadow area, and when the shadow intensity coefficient is higher than a preset threshold, adjust the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected;
[0081] The detection module 46 is used to perform target detection on the adjusted image to be detected using a preset target detection model to obtain the target object.
[0082] Through the above-mentioned target object detection device, the following is achieved: obtaining an image to be detected; using a preset shadow detection model to divide the image to be detected into a shadow area and a non-shadow area; obtaining a shadow intensity coefficient of the shadow area, and when the shadow intensity coefficient is higher than a preset threshold, adjusting the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; using a preset target detection model to perform target detection on the adjusted image to be detected to obtain the target object, thereby achieving the purpose of performing target detection after adjusting the shadow area of the image to be detected, thereby realizing the technical effect of improving the accuracy of target object detection, and further solving the technical problem of low accuracy in detecting target objects from images to be detected in related technologies.
[0083] The adjustment module 44 in the above-mentioned target object detection device includes: an acquisition submodule, which is used to obtain the shadow intensity coefficient of the shadow area, including: obtaining the number of the shadow areas and the coordinates of all pixel points in each shadow area; determining the shadow discrete degree coefficients of multiple shadow areas based on the number of shadow areas and the coordinates of all pixel points in each shadow area, and the shadow discrete degree coefficient is used to characterize the discrete degree of the shadow area; determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area.
[0084] The acquisition submodule includes: a determination unit, which is used to determine the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area, including: obtaining the width of the image to be detected, the height of the image to be detected and the area of the shadow area; determining the proportion coefficient of the shadow area based on the width of the image to be detected, the height of the image to be detected and the area of the shadow area, and the proportion coefficient of the shadow area is used to characterize the proportion of the shadow area in the entire image; determining the shadow intensity coefficient based on the shadow discrete degree coefficient of the shadow area and the proportion coefficient of the shadow area.
[0085] The adjustment module 44 also includes: an adjustment submodule, which is used to adjust the shadow area to obtain an adjusted image to be detected, including: converting the RGB color space of the shadow area into the HSI color space, and obtaining the average value of the brightness component of the image to be detected; determining the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected; adjusting the shadow area according to the brightness adaptive gamma correction factor to obtain the adjusted image to be detected.
[0086] The adjustment submodule includes: a correction unit and an adjustment unit. The correction unit is used to determine the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected, including: obtaining the brightness component of the shadow area, and obtaining the ratio of the brightness component of the shadow area to the average value of the brightness component of the image to be detected; determining the brightness adaptive gamma correction factor according to the ratio.
[0087] An adjustment unit is used to adjust the shadow area according to the brightness adaptive gamma correction factor to obtain an adjusted image to be detected, including: adjusting the brightness components of all pixels in the shadow area to a target brightness component to obtain an adjusted shadow area, wherein the target brightness component is determined according to a target power of the brightness components of the pixels in the shadow area, and the target power is equal to the value of the brightness adaptive gamma correction factor; and splicing the adjusted shadow area with the non-shadow area to obtain the adjusted image to be detected.
[0088] The above-mentioned target object detection device also includes: a training module, used to obtain a first training data set and a second training data set, the first training data set includes a plurality of images of the target object pre-marked, and the second training data set includes a plurality of images of shadow area positions pre-marked; the first training data set and the second training data set are respectively used to train to obtain the preset target detection model and the preset shadow detection model.
[0089] It should be noted that Figure 4 The target object detection device shown is used to perform Figure 2 The target object detection method shown in the figure, therefore the relevant explanations in the above target object detection method are also applicable to the target object detection device, and will not be repeated here.
[0090] An embodiment of the present application further provides a computer device, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and is used to execute the above-mentioned target object detection method.
[0091] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored computer program, wherein a device where the non-volatile storage medium is located executes the above-mentioned target object detection method by running the computer program.
[0092] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the target object detection method in the present application are implemented.
[0093] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the target object detection method in the present application.
[0094] The embodiment of the present application also provides a computer program, which, when executed by a processor, implements the steps of the target object detection method in the present application.
[0095] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0096] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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 units or modules, which can be electrical or other forms.
[0098] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0099] In addition, each functional unit in each embodiment of the present application 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.
[0100] If the integrated unit 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 technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0101] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A target object detection method, characterized in that: include: Acquire the image to be detected; Using a preset shadow detection model to divide the image to be detected into a shadow area and a non-shadow area; Obtaining a shadow intensity coefficient of the shadow area, and if the shadow intensity coefficient is higher than a preset threshold, adjusting the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; A preset target detection model is used to perform target detection on the adjusted image to be detected to obtain the target object.
2. The method according to claim 1, characterized in that Obtaining the shadow intensity coefficient of the shadow area includes: Obtain the number of shadow areas and the coordinates of all pixels in each shadow area; Determine a shadow dispersion degree coefficient of a plurality of the shadow areas based on the number of the shadow areas and the coordinates of all the pixels in each shadow area, wherein the shadow dispersion degree coefficient is used to characterize the dispersion degree of the shadow area; The shadow intensity coefficient is determined based on the shadow dispersion degree coefficient of the shadow area.
3. The method according to claim 2, characterized in that Determining the shadow intensity coefficient based on the shadow dispersion coefficient of the shadow area includes: Obtaining the width of the image to be detected, the height of the image to be detected and the area of the shadow area; Determine a proportion coefficient of the shadow area based on the width of the image to be detected, the height of the image to be detected, and the area of the shadow area, where the proportion coefficient of the shadow area is used to characterize the proportion of the shadow area in the entire image; The shadow intensity coefficient is determined based on the shadow dispersion coefficient of the shadow area and the proportion coefficient of the shadow area.
4. The method according to claim 1, characterized in that: Adjusting the shadow area to obtain an adjusted image to be detected includes: Convert the RGB color space of the shadow area into the HSI color space, and obtain the average value of the brightness component of the image to be detected; Determine a brightness adaptive gamma correction factor based on an average value of a brightness component of the image to be detected; The shadow area is adjusted according to the brightness adaptive gamma correction factor to obtain an adjusted image to be detected.
5. The method according to claim 4, characterized in that Determining the brightness adaptive gamma correction factor based on the average value of the brightness component of the image to be detected includes: Acquire the brightness component of the shadow area, and acquire the ratio of the brightness component of the shadow area to the average value of the brightness component of the image to be detected; The brightness adaptive gamma correction factor is determined according to the ratio.
6. The method according to claim 4, characterized in that The shadow area is adjusted according to the brightness adaptive gamma correction factor to obtain an adjusted image to be detected, including: Adjusting the brightness components of all pixels in the shadow area to a target brightness component to obtain an adjusted shadow area, wherein the target brightness component is determined according to a target power of the brightness components of the pixels in the shadow area, and the target power is equal to the value of the brightness adaptive gamma correction factor; The adjusted shadow area is spliced with the non-shadow area to obtain the adjusted image to be detected.
7. The method according to claim 1, characterized in that The method further comprises: Acquire a first training data set and a second training data set, wherein the first training data set includes a plurality of images with the target object pre-marked, and the second training data set includes a plurality of images with shadow area positions pre-marked; The preset target detection model and the preset shadow detection model are trained using the first training data set and the second training data set respectively.
8. A target object detection device, characterized in that: include: An acquisition module, used for acquiring an image to be detected; A division module, used for dividing the image to be detected into a shadow area and a non-shadow area by using a preset shadow detection model; an adjustment module, used to obtain a shadow intensity coefficient of the shadow area, and when the shadow intensity coefficient is higher than a preset threshold, adjust the shadow area to obtain an adjusted image to be detected, wherein the shadow intensity coefficient is used to characterize the degree of influence of the shadow area on the image to be detected; The detection module is used to perform target detection on the adjusted image to be detected using a preset target detection model to obtain the target object.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory, and is used to execute the target object detection method described in any one of claims 1 to 7.
10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the target object detection method according to any one of claims 1 to 7 is implemented.