Deep learning target detection and counting optimization method in low-light environment
Through deep learning target detection methods and image preprocessing technology, combined with the YOLO11 and Zero_DCE models, the problem of low accuracy in small target detection in low-light environments is solved, efficient automatic recognition and counting are achieved in industrial sites, and detection accuracy and speed are improved.
Patent Information
- Application Number
- CN202511000901.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-09-05
AI Technical Summary
Existing technologies have low accuracy in detecting small targets in low-light environments, and are significantly affected by lighting changes, making it difficult to achieve efficient automated identification and counting in industrial sites.
A deep learning target detection method is used, combined with the YOLO11 model and the Zero_DCE model. Image preprocessing is used to enhance brightness and contrast, small targets are detected in stages, and tensorRT is used to optimize the model inference speed to achieve lightweight and fast detection.
The accuracy and efficiency of target detection are improved in low-light environments, and target counting can be achieved more efficiently and accurately, thereby improving production efficiency and quality control levels.
Smart Images

Figure CN120599197A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence recognition, and in particular to a deep learning target detection and counting optimization method in a low-light environment. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, deep learning object detection algorithms have been widely applied in numerous fields, significantly improving production efficiency. Object detection technology plays a vital role in various sectors, from scientific research to industry and agriculture. In production, object detection algorithms identify objects in images, classify them, and locate their positions, enabling automated counting and other tasks. This significantly reduces labor costs and improves work efficiency.
[0003] The development of object detection technology has undergone a transition from traditional computer vision methods to deep learning approaches. Early object detection primarily relied on hand-crafted feature extraction methods, such as Haar features and HOG (Histogram of Oriented Gradients) features, combined with classifiers such as support vector machines (SVMs). However, these traditional methods often struggled to achieve optimal detection results in complex scenes. With the rise of deep learning, object detection algorithms based on convolutional neural networks (CNNs) have gradually become mainstream. For example, the R-CNN (Region-based Convolutional Neural Networks) family of algorithms significantly improved the accuracy and efficiency of object detection by incorporating deep learning models. Subsequently, the emergence of single-stage object detection algorithms, such as YOLO (You Only Look Once) and SSD (Single Shot MultiBox Detector), further improved detection speed, enabling object detection technology to be more effectively applied in real-time scenarios.
[0004] Object detection algorithms play a key role in practical applications such as industrial production and agricultural monitoring. For example, in industrial production, they can be used for parts counting and quality inspection; in agriculture, they can be used for crop counts and pest monitoring. In recent years, object detection-based counting technology has made significant progress, providing technical support for related tasks and improving efficiency and accuracy.
[0005] However, existing algorithms still face numerous challenges in practical application. For one thing, the target to be detected occupies fewer pixels in the original image, resulting in lower resolution and less expressiveness. Furthermore, in the field or at industrial sites, lighting conditions are poor and it is difficult to install supplemental lighting. Variations in light intensity significantly impact image quality. In low light, target images are blurred and difficult to distinguish, making target detection algorithms more difficult and reducing their accuracy. Improving target detection accuracy in low-light conditions and for small targets has become a pressing technical challenge in the current industrial landscape. Summary of the Invention
[0006] The purpose of the present invention is to provide a deep learning target detection and counting optimization method in a low-light environment to solve the problems of the existing technology. It can efficiently and automatically identify and distinguish small targets and the existing lighting problems in the existing technology. At the same time, it can widely adapt to the complexity of on-site work and has a high accuracy rate.
[0007] To achieve the above technical objectives, the present invention provides a deep learning target detection and counting optimization method in a low-light environment, which runs on a GPU, including: S1: using a surveillance camera to collect image data of the area to be detected, and then preprocessing the collected data to divide it into a training set, a test set, and a validation set; S2: training a YOLO11 target detection model, respectively training a model for the area to be detected and a detection model for the drill rod in the detection area; S3: deploying an inference low-light compensation model and a target detection model to implement the counting task.
[0008] This paper provides a deep learning method for optimizing target detection and counting in low-light environments. Addressing the existing challenges of small target detection and illumination, this paper proposes a deep learning small target detection algorithm that can adapt to diverse lighting conditions. By preprocessing images to enhance brightness and contrast, the algorithm improves its low-light recognition capabilities. This application is expected to enable more efficient and accurate target counting in actual production, further enhancing production efficiency and quality control.
[0009] As a further improvement, step one includes: S101: cleaning the collected image data, deleting blurry image data and identical image data; S102: randomly dividing the cleaned data set into a training set, a test set, and a validation set in a ratio of 8:1:1; S103: using a labeling tool to label the labels of the areas to be inspected in the training set and the test set images and the category labels of the targets to be inspected in the inspection areas.
[0010] As a further improvement, in S2, the model of the area to be detected and the detection model of the drill rod in the detection area are trained respectively according to the following corresponding steps, including: S201: selecting model specifications, determining the size parameters of the model, and selecting the s model in the YOLO series target detection model for the detection task; S202: setting the model depth and width, setting the depth and width of the module in the model and the number of input and output channels to lighten the model parameters and speed up the inference speed in the deployment stage; S203: determining the upper limit of training rounds and the number of categories, the upper limit N of the number of model training times and the number nc of categories of the training model.
[0011] As a further improvement, S2 also includes: S204: loss function, precision rate, and recall rate of model training, and judging whether they are greater than the patience value of the early stopping mechanism; S205: optimal model, when it is judged that it is greater than the patience value of the early stopping mechanism, it becomes the optimal model and the training ends, otherwise it returns to S204 to continue.
[0012] As a further improvement, in S202, the depth, width, and number of input and output channels of the selected s model are halved to effectively reduce the number of convolutional layers. At the same time, reducing the width and the number of input and output channels can reduce the number of parameters of the convolutional layer.
[0013] As a further improvement, in S204, in order to prevent overfitting in the training of the YOLO model, the training code of the YOLO model comprehensively assesses the classification error of the detection category, the regression error accuracy and recall rate of the detection box, and the mAP50 and mAP50-95 values to set the patience value of the early stopping mechanism of the model training, and sets a large upper limit for the number of training times.
[0014] As a further improvement, the S3 includes: S301: grayscale the image and calculate the average brightness; S308: extract ROI, extract the ROI area predicted by the model of the area to be detected, and then deploy the detection model of the drill rod in the detection area to detect the drill rod target; S309: traverse the detection targets, traverse the targets detected in the current image, if the drill rod is detected, start the counting function, otherwise return to continue traversing the targets detected in the current image; S310: obtain the counting result, and finally count and obtain the total number of detected targets.
[0015] As a further improvement, after the S301, it is determined whether the image brightness is lower than the threshold. If it is lower than the threshold, the following are executed: S302: deploying the image data preprocessing of the Zero_DCE model, using the resize interface function in OpenCV to adjust the image to the size accepted by the Zero_DCE model, then converting the BGR color channel of the image to the RGB color channel, and finally dividing each pixel value by 255 to normalize it to between 0 and 1; S303: building the inference engine of the Zero_DCE model to accelerate the inference speed of the model; S304: decoding the Zero_DCE post-processing, decoding the post-processing part of the Zero_DCE model, denormalizing the model inference result, converting it into eight-bit unsigned three-channel format data, then adjusting the size to make it consistent with the original input image size, and finally converting the RGB color channel to the BGR color channel and saving it, thereby obtaining the enhanced image. image data and enter S305; if it is not lower than the threshold, execute: S305: YOLO11 target detection image preprocessing, deploy the image preprocessing part of the YOLO11 target detection model, perform letterbox processing on the enhanced image in turn, adjust the size to a size acceptable to the detection model, convert the BGR channel of the image to an RGB channel, and finally divide each pixel value by 255 to normalize it to between 0 and 1; S306: Build the inference engine of the YOLO11 model, use the tensorRT API interface to convert the trained detection model into a tensorRT inference engine, and save it in the form of a .engine binary file; S307: Decode YOLO11 post-processing, decode the center point coordinates, width, height, confidence and category information of each detection box predicted by the model, first remove the detection boxes with low confidence, and then use NMS to remove redundant target boxes.
[0016] As a further improvement, in 301, the image data to be detected is prepared, the imread interface function of OpenCV is called to read the image, and the image is grayscaled through the cvtColor interface function, all pixels of the grayscale image are traversed, their sum is calculated, and the average is taken as the average brightness of the current image; in 303, tensorRT is used to optimize the Zero_DCE model to achieve faster reasoning performance, and after obtaining the Zero_DCE model weight, the pt format model is first converted into an ONNX model structure, and then the model conversion API interface of tensorRT is used to convert the ONNX model into a tensorRT reasoning engine, and finally saved as a .engine binary file; in 308, the ROI area predicted by the model of the area to be detected is extracted by executing S305, S306, and S307, and then the detection model of the drill rod in the detection area is deployed by repeatedly executing S305, S306, and S307 to detect the drill rod target.
[0017] As a further improvement, after S308, determine whether it is the detection result of the second stage, if so, execute S309, if not, return to repeatedly execute S305, S306, S307, S308; after S309, determine whether the current target needs to be counted, if so, execute S310, if not, return to repeatedly execute 309; after S310, the program ends. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic flow chart of step S2 of the method of the present invention; Figure 2 This is a schematic flow chart of step S3 of the method of the present invention; Figure 3 Originally collected drill pipe data; Figure 4 Single-stage model detection effect; Figure 5 Second-stage detection effect; Figure 6 Detection effect of controlled trials. DETAILED DESCRIPTION
[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0020] like Figures 1 to 2As shown, the present invention provides a deep learning target detection and counting optimization method in a low-light environment, which runs on a GPU, including: S1: using a surveillance camera to collect image data of the area to be detected, then preprocessing the collected data, and dividing it into a training set, a test set, and a validation set; S2: training a YOLO11 target detection model, respectively training a model for the area to be detected and a detection model for the drill rod in the detection area; S3: deploying an inference low-light compensation model and a target detection model to implement the counting task.
[0021] This paper provides a deep learning method for optimizing target detection and counting in low-light environments. Addressing the existing challenges of small target detection and illumination, this paper proposes a deep learning small target detection algorithm that can adapt to diverse lighting conditions. By preprocessing images to enhance brightness and contrast, the algorithm improves its low-light recognition capabilities. This application is expected to enable more efficient and accurate target counting in actual production, further enhancing production efficiency and quality control.
[0022] As a further improvement, step one includes: S101: cleaning the collected image data, deleting blurry image data and identical image data; S102: randomly dividing the cleaned data set into a training set, a test set, and a validation set in a ratio of 8:1:1; S103: using a labeling tool to label the labels of the areas to be inspected in the training set and the test set images and the category labels of the targets to be inspected in the inspection areas.
[0023] As a further improvement, in S2, the model of the area to be detected and the detection model of the drill rod in the detection area are trained respectively according to the following corresponding steps, including: S201: selecting model specifications, determining the size parameters of the model, and selecting the s model in the YOLO series target detection model for the detection task; S202: setting the model depth and width, setting the depth and width of the module in the model and the number of input and output channels to lighten the model parameters and speed up the inference speed in the deployment stage; S203: determining the upper limit of training rounds and the number of categories, the upper limit N of the number of model training times and the number nc of categories of the training model.
[0024] As a further improvement, S2 also includes: S204: loss function, precision rate, and recall rate of model training, and judging whether they are greater than the patience value of the early stopping mechanism; S205: optimal model, when it is judged that it is greater than the patience value of the early stopping mechanism, it becomes the optimal model and the training ends, otherwise it returns to S204 to continue.
[0025] As a further improvement, in S202, the depth, width, and number of input and output channels of the selected s model are halved to effectively reduce the number of convolutional layers. At the same time, reducing the width and the number of input and output channels can reduce the number of parameters of the convolutional layer.
[0026] As a further improvement, in S204, in order to prevent overfitting in the training of the YOLO model, the training code of the YOLO model comprehensively assesses the classification error of the detection category, the regression error accuracy and recall rate of the detection box, and the mAP50 and mAP50-95 values to set the patience value of the early stopping mechanism of the model training, and sets a large upper limit for the number of training times.
[0027] As a further improvement, the S3 includes: S301: grayscale the image and calculate the average brightness; S308: extract ROI, extract the ROI area predicted by the model of the area to be detected, and then deploy the detection model of the drill rod in the detection area to detect the drill rod target; S309: traverse the detection targets, traverse the targets detected in the current image, if the drill rod is detected, start the counting function, otherwise return to continue traversing the targets detected in the current image; S310: obtain the counting result, and finally count and obtain the total number of detected targets.
[0028] As a further improvement, after the S301, it is determined whether the image brightness is lower than the threshold. If it is lower than the threshold, the following are executed: S302: deploying the image data preprocessing of the Zero_DCE model, using the resize interface function in OpenCV to adjust the image to the size accepted by the Zero_DCE model, then converting the BGR color channel of the image to the RGB color channel, and finally dividing each pixel value by 255 to normalize it to between 0 and 1; S303: building the inference engine of the Zero_DCE model to accelerate the inference speed of the model; S304: decoding the Zero_DCE post-processing, decoding the post-processing part of the Zero_DCE model, denormalizing the model inference result, converting it into eight-bit unsigned three-channel format data, then adjusting the size to make it consistent with the original input image size, and finally converting the RGB color channel to the BGR color channel and saving it, thereby obtaining the enhanced image. image data and enter S305; if it is not lower than the threshold, execute: S305: YOLO11 target detection image preprocessing, deploy the image preprocessing part of the YOLO11 target detection model, perform letterbox processing on the enhanced image in turn, adjust the size to a size acceptable to the detection model, convert the BGR channel of the image to an RGB channel, and finally divide each pixel value by 255 to normalize it to between 0 and 1; S306: Build the inference engine of the YOLO11 model, use the tensorRT API interface to convert the trained detection model into a tensorRT inference engine, and save it in the form of a .engine binary file; S307: Decode YOLO11 post-processing, decode the center point coordinates, width, height, confidence and category information of each detection box predicted by the model, first remove the detection boxes with low confidence, and then use NMS to remove redundant target boxes.
[0029] As a further improvement, in 301, the image data to be detected is prepared, the imread interface function of OpenCV is called to read the image, and the image is grayscaled through the cvtColor interface function, all pixels of the grayscale image are traversed, their sum is calculated, and the average is taken as the average brightness of the current image; in 303, tensorRT is used to optimize the Zero_DCE model to achieve faster reasoning performance, and after obtaining the Zero_DCE model weight, the pt format model is first converted into an ONNX model structure, and then the model conversion API interface of tensorRT is used to convert the ONNX model into a tensorRT reasoning engine, and finally saved as a .engine binary file; in 308, the ROI area predicted by the model of the area to be detected is extracted by executing S305, S306, and S307, and then the detection model of the drill rod in the detection area is deployed by repeatedly executing S305, S306, and S307 to detect the drill rod target.
[0030] As a further improvement, after S308, determine whether it is the detection result of the second stage, if so, execute S309, if not, return to repeatedly execute S305, S306, S307, S308; after S309, determine whether the current target needs to be counted, if so, execute S310, if not, return to repeatedly execute 309; after S310, the program ends.
[0031] like Figures 1 to 2 As shown in FIG, as a preferred embodiment of the present invention, the present invention provides a deep learning target detection and counting optimization method in a low-light environment, which runs on a GPU and includes: Step 1: Use a surveillance camera to collect image data of the area to be inspected, and then preprocess the collected data. The specific steps include the following: a) Clean the collected image data. The purpose of data cleaning is to delete blurry images and identical images. b) The cleaned dataset is randomly divided into training set, test set and validation set in a ratio of 8:1:1; c) Use annotation tools to label the labels of the areas to be inspected and the category labels of the objects to be inspected in the inspection areas in the training and test set images; Step 2: Train the YOLO11 target detection model, which includes the following steps: a) Determine the model size parameters. In the YOLO series of object detection models, there are five model size parameters: n, s, m, l, and x. These five models are designed in descending order of module depth, width, and the number of input and output channels per module. Generally, the s model is sufficient for detection tasks.
[0032] b) Set the depth and width of the model modules and the number of input and output channels. This setting aims to reduce model parameters and speed up inference during deployment. The forward propagation process of the detection model is essentially the result of multiplying multiple high-dimensional matrices. The number of parameters affects the speed of forward propagation. For the selected s model, its depth, width, and number of input and output channels are each halved. Since the number of parameters for each convolution operator is calculated as:
[0033] Therefore, reducing the depth parameters of the model can effectively reduce the number of convolutional layers, while reducing the width and the number of input and output channels can reduce the number of parameters of the convolutional layer.
[0034] c) The upper limit N for the number of training cycles and the number nc of training models. To prevent overfitting during YOLO model training, the YOLO model training code comprehensively evaluates the classification error of the detection category, the regression error of the detection box, the precision and recall rate, and the mAP50 and mAP50-95 values to set the early stopping point for model training. To achieve the optimal model prediction rate, the upper limit for the number of training cycles can be set to a large value.
[0035] d) According to the corresponding steps above, train the model of the area to be inspected (model_1) and the detection model of the drill rod in the inspection area (model_2) respectively.
[0036] Step 3: Deploy the inference low-light compensation model and target detection model to implement the counting task a) Prepare the image data to be tested. Call OpenCV's imread function to read the image and convert it to grayscale using the cvtColor function. Iterate through all pixels in the grayscale image, calculate their sum, and then find the average. This average value is used as the average brightness of the current image.
[0037] b) Deploy the Zero_DCE model to preprocess the image data. Use the resize interface function in OpenCV to resize the image to the size accepted by the Zero_DCE model. Then convert the BGR color channels of the image to RGB color channels. Finally, divide each pixel value by 255 to normalize it to between 0 and 1.
[0038] c) Build the inference engine of the Zero_DCE model to accelerate the inference speed of the model.
[0039] The Zero_DCE model mainly uses convolutional neural networks to extract image features and designs four loss functions (spatial consistency loss, exposure control loss, color constancy loss, and lighting smoothness loss) between the enhanced image and the input image to guide the model's backpropagation and obtain the model weights of the optimal solution.
[0040] To adapt to real-time detection in industrial environments, we use TensorRT to optimize the Zero_DCE model for faster inference performance. After obtaining the Zero_DCE model weights, we first convert the pt format model to an ONNX model structure. Then, using the TensorRT model conversion API, we convert the ONNX model to the TensorRT inference engine and save it as a .engine binary file.
[0041] d) Decode the post-processing part of the Zero_DCE model, denormalize the model inference result, convert it into 8-bit unsigned three-channel format data, then resize it to match the original input image size, and finally convert the RGB color channels into BGR color channels and save it to obtain the enhanced image data.
[0042] e) Deploy the image preprocessing part of the YOLO11 object detection model, perform letterboxing on the enhanced image, resize it to a size acceptable to the detection model, convert the image's BGR channels to RGB channels, and finally divide each pixel value by 255 to normalize it to between 0 and 1.
[0043] f) Use the tensorRT API to convert the trained detection model into a tensorRT inference engine and save it as a .engine binary file.
[0044] g) Decode the center coordinates, width, height, confidence level, and category information of each detection box predicted by the decoding model. Remove low-confidence detection boxes first, then use NMS to remove redundant object boxes.
[0045] h) Extract the ROI area predicted by model_1, and then repeat steps e, f, and g to deploy model_2 to detect the drill pipe target.
[0046] i) Traverse the targets detected in the current image. If a drill rod is detected, start the counting function.
[0047] j) Finally, the total number of detected targets is counted and obtained.
[0048] Compared with the prior art, the technical solution of the present invention includes the following improvements and beneficial effects: First, to address the problem of dark images and the difficulty of detection in low-light conditions, this invention innovatively introduces the Zero_DCE model to enhance images. This improvement effectively improves the detection model's accuracy in low-light environments, enabling more accurate object identification even in scenes with poor lighting conditions, broadening the detection model's application scope.
[0049] Second, in the target detection process, this invention adopts a two-stage detection model. The first stage accurately detects the ROI, providing precise regional positioning for small target detection in the second stage. This phased detection approach effectively improves the accuracy of small target detection and avoids missed and false detections caused by directly detecting small targets within the entire image.
[0050] Third, in terms of model optimization, this paper proposes a simpler lightweight method, successfully lightweighting the YOLO11 object detection model. This not only significantly reduces the model's inference parameters but also significantly improves its inference speed, enabling it to complete detection tasks more quickly while maintaining detection accuracy, thus improving the model's real-time performance and efficiency in practical applications.
[0051] In order to verify the reliability of the detection of the present invention, this embodiment is tested on the data set collected by drill rod detection to verify the accuracy of the model detection. On the same data set, the label data of the single-stage detection and the label data of the two-stage detection are marked respectively, and then the model of the single-stage detection of drill rod and the model of the two-stage detection of drill rod are trained respectively. 150 identical test data sets are used to verify the detection accuracy of the two methods. The collected data images are shown in Figure 3 , the single-stage detection effect is presented in Figure 4 , the two-stage detection effect is shown in Figure 5 The detection effects of the two detection methods on the same test set were statistically analyzed, and the number of drill rods calculated by the two detection methods was statistically analyzed.
[0052] From Table 1 (Drill pipe accuracy statistics of single-stage and two-stage detection), it can be seen that the accuracy of two-stage detection is significantly higher than that of single-stage detection.
[0053] Table 1: Drill pipe accuracy statistics for single-stage and two-stage inspections Statistical accuracy Single-stage detection Two-stage detection 100% 0% 100% 95%-99% 17.25% 0% 90%-94% 31.84% 0% In order to verify the detection effect of the patent of this invention under low-light conditions, we used the two-stage detection model trained previously for experimental verification. For this purpose, two groups of control experiments were designed. For the same batch of low-light drill pipe images collected, the first group of experiments was based on the idea of the patent of this invention. The images were first processed by Zero_DCE and then input into the detection model; the second group of experiments directly input the low-light images into the detection model. Finally, we compared and analyzed the detection effects of the two groups of experimental models. Figure 6 (Detection effect of the control test) It can be seen that the confidence level and the number of detection accuracy of the images detected by the model after Zero_DCE data enhancement processing are significantly higher than those of the images without enhancement processing.
[0054] It should be understood that the scope of the present invention is not limited to the non-limiting embodiments, and it should be understood that the non-limiting embodiments are only provided as examples. The substantial scope of protection required by this application is further reflected in the scope provided by the independent claims and their dependent claims.
Claims
1. A deep learning object detection and counting optimization method in low-light environments, running on a GPU, characterized by: include: S1: Use surveillance cameras to collect image data of the area to be inspected, then preprocess the collected data and divide it into training, test, and validation sets; S2: Train the YOLO11 target detection model, and train the model of the area to be detected and the detection model of the drill rod in the detection area respectively; S3: Deploy the inference low-light compensation model and object detection model to implement the counting task.
2. The deep learning target detection and counting optimization method in a low-light environment according to claim 1, characterized in that: The step one includes: S101: Cleaning the collected image data, deleting blurry image data and identical image data; S102: randomly divide the cleaned dataset into training set, test set and validation set in a ratio of 8:1:1; S103: Using a labeling tool, labels of the areas to be inspected and category labels of the targets to be inspected in the inspection areas in the training set and the test set images are labeled.
3. The deep learning target detection and counting optimization method in a low-light environment according to claim 2, characterized in that: In S2, the model of the area to be inspected and the detection model of the drill rod in the inspection area are trained respectively according to the following corresponding steps, including: S201: Select model specifications, determine the size parameters of the model, and select the s model from the YOLO series of target detection models for the detection task; S202: Set the model depth and width, including the depth and width of the modules in the model and the number of input and output channels, to reduce model parameters and speed up inference in the deployment phase. S203: Determine the upper limit of the number of training rounds and the number of categories, the upper limit N of the number of model training times and the number of categories nc of the training model.
4. The deep learning target detection and counting optimization method in a low-light environment according to claim 3, characterized in that: Said S2 also includes: S204: The loss function, precision, and recall of the model training are determined, and whether they are greater than the patience value of the early stopping mechanism; S205: Optimal model: If it is judged that the value is greater than the patience value of the early stopping mechanism, it becomes the optimal model and the training ends; otherwise, it returns to S204 to continue.
5. The deep learning target detection and counting optimization method in a low-light environment according to claim 4, characterized in that: In S202, the depth, width, and number of input and output channels of the selected s model are halved to effectively reduce the number of convolutional layers. Reducing the width and the number of input and output channels can also reduce the number of parameters of the convolutional layers.
6. The deep learning target detection and counting optimization method in a low-light environment according to claim 5, characterized in that: In S204, to prevent overfitting in the training of the YOLO model, the training code of the YOLO model comprehensively assesses the classification error of the detection category, the regression error accuracy and recall rate of the detection box, and the mAP50 and mAP50-95 values to set the patience value of the early stopping mechanism of the model training, and sets a large upper limit for the number of training times.
7. The deep learning target detection and counting optimization method in a low-light environment according to claim 6, characterized in that: Said S3 includes: S301: Grayscale the image and calculate the average brightness; S308: Extracting ROI, extracting the ROI area predicted by the model of the area to be detected, and then deploying the detection model of the drill rod in the detection area to detect the drill rod target; S309: Traverse the detection targets, traverse the targets detected in the current image, and if a drill rod is detected, start the counting function, otherwise return to continue traversing the targets detected in the current image; S310: Obtain counting results, and finally count and obtain the total number of detected targets.
8. The deep learning target detection and counting optimization method in a low-light environment according to claim 7, characterized in that: After S301, it is determined whether the image brightness is lower than a threshold. If it is lower than the threshold, the following steps are executed: S302: Deploy the Zero_DCE model to preprocess the image data. Use the resize interface function in OpenCV to resize the image to the size accepted by the Zero_DCE model. Then convert the BGR color channel of the image to RGB color channel. Finally, divide each pixel value by 255 to normalize it to between 0 and 1. S303: Build an inference engine for the Zero_DCE model to accelerate the inference speed of the model; S304: Decode Zero_DCE post-processing, decode the post-processing part of the Zero_DCE model, denormalize the model inference result, convert it into eight-bit unsigned three-channel format data, then adjust the size to make it consistent with the original input image size, and finally convert the RGB color channel into BGR color channel and save it, thereby obtaining the enhanced image data and entering S305; If it is not lower than the threshold, execute: S305: YOLO11 target detection image preprocessing: Deploy the image preprocessing part of the YOLO11 target detection model, perform letterbox processing on the enhanced image, resize it to a size acceptable to the detection model, convert the image's BGR channel to RGB channel, and finally divide each pixel value by 255 to normalize it to between 0 and 1. S306: Build the inference engine of the YOLO11 model. Using the tensorRT API, convert the trained detection model into a tensorRT inference engine and save it as a .engine binary file. S307: Decode YOLO11 post-processing, decode the center point coordinates, width, height, confidence and category information of each detection box predicted by the model, first remove the detection boxes with low confidence, and then use NMS to remove redundant target boxes.
9. The deep learning target detection and counting optimization method in a low-light environment according to claim 8, characterized in that: In the step 301, the image data to be detected is prepared, the imread interface function of OpenCV is called to read the image, and the image is grayscaled using the cvtColor interface function. All pixels of the grayscale image are traversed, their sum is calculated, and the average is calculated as the average brightness of the current image. In step 303, tensorRT is used to optimize the Zero_DCE model to achieve faster inference performance. After obtaining the Zero_DCE model weights, the pt format model is first converted to an ONNX model structure. Then, the tensorRT model conversion API is used to convert the ONNX model to a tensorRT inference engine, and finally saved as a .engine binary file. In step 308 , the ROI area predicted by the model of the area to be detected is extracted by executing S305 , S306 , and S307 , and then the detection model of the drill rod in the detection area is deployed by repeatedly executing S305 , S306 , and S307 to detect the drill rod target.
10. The deep learning target detection and counting optimization method in a low-light environment according to claim 9, characterized in that: After S308, determine whether it is the detection result of the second stage, if yes, execute S309, if not, return to and repeat S305, S306, S307, S308; After S309, it is determined whether the current target needs to be counted, if yes, the step S310 is executed, if not, the step S309 is repeated; After S310 , the program ends.
Citation Information
Cited By
Digital detection method and system for number of tunnel anchor rods
CN121437513A
Tunnel anchor rod quantity digital detection method and system
CN121437513B
