Fluorescent clothes identification algorithm based on color segmentation
By using a color segmentation-based fluorescent clothing recognition algorithm, the problem of identifying and alarming those not wearing fluorescent clothing in factories has been solved, improving safety production efficiency and model running speed.
Patent Information
- Application Number
- CN202410968752.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2025-11-11
AI Technical Summary
In factory environments, especially at night or in poor lighting conditions, workers not wearing fluorescent clothing increases the risk of safety accidents, and existing monitoring models are insufficient for efficient identification and alarm activation.
A color segmentation-based fluorescent clothing recognition algorithm is adopted. By collecting and labeling fluorescent clothing images, PyTorch and yolov8s and yolov9e models are used for training and optimization. Combined with TensorRT acceleration, the video stream is decoded to perform pedestrian detection and fluorescent clothing recognition, and a threshold is set to trigger an alarm.
It enables timely alerts for workers not wearing fluorescent clothing, improving factory safety and enhancing the model's inference speed and performance on GPUs.
Smart Images

Figure CN120932166A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision and image processing, and more particularly to a fluorescent clothing recognition algorithm based on color segmentation. Background Technology
[0002] In factories, safety is always paramount. With increasingly sophisticated management models and equipment, blind spots in safety risks often lie with personnel, especially in specific scenarios where the correct wearing of fluorescent vests is crucial. These vests offer high visibility both day and night, providing safety precautions for on-site operators. Currently, factory work rarely relies on human supervision; most factories have adopted remote video monitoring. Therefore, video-based detection of whether workers are wearing fluorescent vests maximizes the efficiency of human supervision. In existing factory environments, especially at night or in low-light conditions, workers wearing fluorescent vests increase their visibility, thus reducing the risk of accidents. However, if workers forget or intentionally do not wear fluorescent vests, their visibility decreases, increasing the risk of accidents. To address these issues, this invention proposes a color segmentation-based fluorescent vest recognition algorithm. Summary of the Invention
[0003] The main objective of this invention is to provide a color segmentation-based fluorescent clothing recognition algorithm to solve the problems raised in related technologies.
[0004] To achieve the above objectives, according to one aspect of the present invention, a fluorescent clothing recognition algorithm based on color segmentation is provided, comprising the following steps:
[0005] S1: Collect over 10,000 images of various types of fluorescent clothing found in factories, perform semantic segmentation and annotation on each image, and standardize the annotated data;
[0006] S2: PyTorch was selected as the open-source deep learning object detection framework, and yolov8s and yolov9e were used as pre-trained models for semantic segmentation and pedestrian detection, respectively. The trained models were then optimized using TensorRT.
[0007] S3: Decode the video stream, use yolov9e to detect pedestrians, and prepare for fluorescent clothing recognition;
[0008] S4: The detection is made by the fluorescent clothing segmentation model. If no fluorescent clothing is being worn, an alarm is immediately triggered.
[0009] S5: Display the detection results on video frames and integrate the detection results into the business logic through the GstPlugin interface.
[0010] Furthermore, the various types of fluorescent clothing in S1 include red fluorescent clothing, green fluorescent clothing, yellow fluorescent clothing, and blue fluorescent clothing.
[0011] Furthermore, the standardization process in S1 includes size unification, grayscale conversion, and normalization to ensure the consistency of the dataset.
[0012] Furthermore, the specific steps of semantic segmentation annotation in S1 are as follows:
[0013] S1.1: Select Labelme as the image annotation tool;
[0014] S1.2: For each image, use the annotation tool to manually draw the outline of the fluorescent clothing to distinguish it from the background and other objects;
[0015] S1.3: Save the annotation information as an annotation file compatible with the image format.
[0016] Furthermore, the operation steps of S2 are as follows:
[0017] S2.1: A deep learning framework using PyTorch as the algorithm implementation;
[0018] S2.2: Train the YOLOv8s model using the standardized and labeled fluorescent clothing segmentation dataset; train the YOLOv9e model using the pedestrian detection labeled dataset;
[0019] S2.3: Evaluate the trained semantic segmentation model and pedestrian detection model using the test set;
[0020] S2.4: The model is then optimized using TensorRT to improve inference speed and performance on the GPU.
[0021] Furthermore, the specific steps for TensorRT to optimize the model in S2.4 are as follows:
[0022] S2.4.1: Convert the PyTorch model to ONNX, a format supported by TensorRT;
[0023] S2.4.2: Use the optimization strategies provided by TensorRT to further improve the inference speed and performance of the model;
[0024] S2.4.3: After optimization, use benchmarking tools to measure the model's actual inference speed and performance on the GPU and compare it with that before optimization.
[0025] Furthermore, the specific operation steps in S3 are as follows:
[0026] S3.1: Employs an H.264 decoder;
[0027] S3.1: The input video stream is decoded using an H.264 decoder in conjunction with hardware.
[0028] S3.2: Input the decoded video frames into the yolov9e model for pedestrian detection and locate pedestrians in the video;
[0029] S3.3: For each detected pedestrian, crop the area of that pedestrian in the original image;
[0030] S3.4: Input the extracted region into the YOLOv8s fluorescent clothing segmentation model to identify fluorescent clothing.
[0031] Furthermore, the specific operation steps in S4 are as follows:
[0032] S4.1: Set the threshold for fluorescent clothing;
[0033] S4.2: Based on the fluorescent clothing segmentation results, compare with the threshold to determine whether the preset threshold is exceeded. If it is exceeded, determine that the pedestrian is wearing a fluorescent clothing; otherwise, determine that the pedestrian is not wearing a fluorescent clothing.
[0034] S4.3: If the judgment result is that the person is not wearing a fluorescent vest, an alarm will be triggered.
[0035] Furthermore, the specific steps of S5 are as follows:
[0036] S5.1: Mark the detection frame around the detected pedestrian with different colors or patterns to distinguish between those who have been identified as wearing fluorescent clothing and those who are not;
[0037] S5.2: Use OSD technology to display the detected pedestrian bounding boxes, fluorescent clothing areas, etc. on the video frames;
[0038] S5.3: Then, through the GstPlugin interface, the information on whether fluorescent clothing is being detected is integrated into the business logic;
[0039] S5.4: The detection results are then displayed on the desktop via EGL and other sinks for easy real-time monitoring and management.
[0040] Furthermore, the method for integrating information into business logic in S5.3 includes logging, sending warning emails or SMS notifications to security management personnel.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] By collecting a large number of fluorescent clothing images and performing semantic segmentation and annotation, and using a fluorescent clothing recognition algorithm, it is possible to accurately determine whether workers are wearing fluorescent clothing. For workers who are not wearing fluorescent clothing, an alarm can be triggered immediately to remind managers to take timely measures, thereby improving the safety level of the factory. At the same time, by using the PyTorch framework and pre-trained models yolov8s and yolov9e, combined with TensorRT optimization, the inference speed and performance of the model on the GPU are significantly improved, making the fluorescent clothing recognition process more efficient. Attached Figure Description
[0043] Figure 1 This is a flowchart illustrating the overall method of the present invention;
[0044] Figure 2 This is a flowchart of the algorithm operation of the present invention. Detailed Implementation
[0045] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0046] Reference Figures 1 to 2 This invention provides a fluorescent clothing recognition algorithm based on color segmentation, comprising the following steps:
[0047] S1: Collect over 10,000 images of various types of fluorescent clothing found in factories, perform semantic segmentation and annotation on each image, and standardize the annotated data;
[0048] S2: PyTorch was selected as the open-source deep learning object detection framework, and yolov8s and yolov9e were used as pre-trained models for semantic segmentation and pedestrian detection, respectively. The trained models were then optimized using TensorRT.
[0049] S3: Decode the video stream, use yolov9e to detect pedestrians, and prepare for fluorescent clothing recognition;
[0050] S4: The detection is made by the fluorescent clothing segmentation model. If no fluorescent clothing is being worn, an alarm is immediately triggered.
[0051] S5: Display the detection results on video frames and integrate the detection results into the business logic through the GstPlugin interface.
[0052] S1 includes various types of fluorescent clothing, such as red fluorescent clothing, green fluorescent clothing, yellow fluorescent clothing, and blue fluorescent clothing.
[0053] Standardization in S1 includes size unification, grayscale conversion, and normalization to ensure the consistency of the dataset.
[0054] The specific steps for semantic segmentation annotation in S1 are as follows:
[0055] S1.1: Select Labelme as the image annotation tool;
[0056] S1.2: For each image, use the annotation tool to manually draw the outline of the fluorescent clothing to distinguish it from the background and other objects;
[0057] S1.3: Save the annotation information as an annotation file compatible with the image format.
[0058] The operation steps for S2 are as follows:
[0059] S2.1: A deep learning framework using PyTorch as the algorithm implementation;
[0060] S2.2: Train the YOLOv8s model using the standardized and labeled fluorescent clothing segmentation dataset; train the YOLOv9e model using the pedestrian detection labeled dataset;
[0061] S2.3: Evaluate the trained semantic segmentation model and pedestrian detection model using the test set;
[0062] S2.4: The model is then optimized using TensorRT to improve inference speed and performance on the GPU.
[0063] The specific steps for TensorRT to optimize the model in S2.4 are as follows:
[0064] S2.4.1: Convert the PyTorch model to ONNX, a format supported by TensorRT;
[0065] S2.4.2: Use the optimization strategies provided by TensorRT to further improve the inference speed and performance of the model;
[0066] S2.4.3: After optimization, use benchmarking tools to measure the model's actual inference speed and performance on the GPU and compare it with that before optimization.
[0067] The specific operation steps in S3 are as follows:
[0068] S3.1: Employs an H.264 decoder;
[0069] S3.1: The input video stream is decoded using an H.264 decoder in conjunction with hardware.
[0070] S3.2: Input the decoded video frames into the yolov9e model for pedestrian detection and locate pedestrians in the video;
[0071] S3.3: For each detected pedestrian, crop the area of that pedestrian in the original image;
[0072] S3.4: Input the extracted region into the YOLOv8s fluorescent clothing segmentation model to identify fluorescent clothing.
[0073] The specific operation steps in S4 are as follows:
[0074] S4.1: Set the threshold for fluorescent clothing;
[0075] S4.2: Based on the fluorescent clothing segmentation results, compare with the threshold to determine whether the preset threshold is exceeded. If it is exceeded, determine that the pedestrian is wearing a fluorescent clothing; otherwise, determine that the pedestrian is not wearing a fluorescent clothing.
[0076] S4.3: If the judgment result is that the person is not wearing a fluorescent vest, an alarm will be triggered.
[0077] The specific steps of S5 are as follows:
[0078] S5.1: Mark the detection frame around the detected pedestrian with different colors or patterns to distinguish between those who have been identified as wearing fluorescent clothing and those who are not;
[0079] S5.2: Use OSD technology to display the detected pedestrian bounding boxes, fluorescent clothing areas, etc. on the video frames;
[0080] S5.3: Then, through the GstPlugin interface, the information on whether fluorescent clothing is being detected is integrated into the business logic;
[0081] S5.4: The detection results are then displayed on the desktop via EGL and other sinks for easy real-time monitoring and management.
[0082] In S5.3, methods for integrating information into business logic include logging, sending warning emails or SMS notifications to security management personnel.
[0083] In this embodiment, a color segmentation-based fluorescent clothing recognition algorithm is described as follows: First, over 10,000 images of various types of fluorescent clothing found in factories are collected. Semantic segmentation and annotation are performed on each image, and the annotated data is standardized. The collection tools used are high-resolution cameras or smartphones to ensure clear imaging. The types of fluorescent clothing include red, green, yellow, and blue fluorescent clothing. Standardization processing includes size unification, grayscale conversion, and normalization to ensure dataset consistency. The specific steps of semantic segmentation and annotation are: S1.1: Select Labelme as the image annotation tool; S1.2: For each image, manually draw the outline of the fluorescent clothing using the annotation tool to distinguish it from the background and other objects; S1.3: Save the annotation information as an annotation file compatible with the image format. Image format: such as COCO or PASCALVOC. Then, PyTorch was chosen as the open-source deep learning object detection framework, and YOLOv8s and YOLOv9e were used as pre-trained models for semantic segmentation and pedestrian detection, respectively. The trained models were then optimized using TensorRT. The steps were as follows: S2.1: Use PyTorch as the deep learning framework for algorithm implementation; S2.2: Train the YOLOv8s model using a standardized and labeled fluorescent clothing segmentation dataset; train the YOLOv9e model using a pedestrian detection labeled dataset; S2.3: Evaluate the trained semantic segmentation model and pedestrian detection model using a test set; S2.4: Optimize the models using TensorRT to improve inference speed and performance on GPUs. The specific steps for TensorRT to optimize the model in S2.4 are as follows: S2.4.1: Convert the PyTorch model to the ONNX format supported by TensorRT; S2.4.2: Use optimization strategies provided by TensorRT to further improve the inference speed and performance of the model; optimization strategies include layer fusion, memory optimization, and accuracy calibration; S2.4.3: After optimization, use benchmark tools to measure the actual inference speed and performance of the model on the GPU and compare it with that before optimization. Next, decode the video stream, use YOLOv9e to detect pedestrians, and prepare for fluorescent clothing recognition; the specific steps are as follows: S3.1: Use an H.264 decoder; S3.1: Decode the input video stream using an H.264 decoder combined with hardware; S3.2: Input the decoded video frames into the YOLOv9e model for pedestrian detection and locate pedestrians in the video; pedestrians are enclosed by rectangular frames. S3.3: For each detected pedestrian, crop the region of that pedestrian in the original image; S3.4: Input the cropped region into the YOLOv8s fluorescent clothing segmentation model to identify fluorescent clothing.The model part uses DeepStream's nvinfer interface to load the TensorRT-optimized model. It uses fluorescent clothing segmentation to detect and determine if the pedestrian is wearing fluorescent clothing; if not, an alarm is immediately triggered. The specific steps are: S4.1: Set a threshold for fluorescent clothing; S4.2: Compare the fluorescent clothing segmentation results with the threshold to determine if the threshold is exceeded. If it is exceeded, the pedestrian is considered to be wearing fluorescent clothing; otherwise, they are considered not to be wearing fluorescent clothing; S4.3: If the result indicates no fluorescent clothing is being worn, an alarm is triggered. Alarm methods include: sound alarm, flashing lights, and sending alarm information to the monitoring center or the mobile devices of management personnel. The detection results are displayed on the video frame and integrated into the business logic through the GstPlugin interface. The specific steps are: S5.1: Mark the detection box around the detected pedestrian with different colors or styles to distinguish between those wearing fluorescent clothing and those not wearing it; draw a polygon with red for the alarm area, red for the person frame, and green for the non-alarm area. S5.2: Use OSD technology to display the detected pedestrian bounding boxes and fluorescent clothing areas on the video frames; S5.3: Then, through the GstPlugin interface, integrate the information on whether fluorescent clothing is being worn into the business logic; S5.4: Finally, use EGL or other sinks to display the detection results on the desktop for convenient real-time monitoring and management. Specific usage steps: Input video stream, decode using an H.264 decoder combined with hardware, then input the model. The model part uses DeepStream's nvinfer interface to load the TensorRT-optimized model, and combines it with OSD to display detection boxes, detection areas, etc., and finally displays it on the desktop through EGL or other sinks. For the detection results, the GstPlugin interface can be used to integrate them with the business logic. In the algorithm, the pedestrian detection model checks if a pedestrian is detected. If a pedestrian is detected, a screenshot of the pedestrian on the original image is passed to the YOLOv8s fluorescent clothing segmentation model. If the fluorescent clothing mask is segmented, it indicates that the pedestrian is wearing fluorescent clothing; otherwise, no fluorescent clothing is being worn, and an alarm is generated.
[0084] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A fluorescent clothing recognition algorithm based on color segmentation, characterized in that, Includes the following steps: S1: Collect over 10,000 images of various types of fluorescent clothing found in factories, perform semantic segmentation and annotation on each image, and standardize the annotated data; S2: PyTorch was selected as the open-source deep learning object detection framework, and yolovSs and yolov9e were used as pre-trained models for semantic segmentation and pedestrian detection, respectively. The trained models were then optimized using TensorRT. S3: Decode the video stream, use yolov9e to detect pedestrians, and prepare for fluorescent clothing recognition; S4: The detection is made by the fluorescent clothing segmentation model. If no fluorescent clothing is being worn, an alarm is immediately triggered. S5: Display the detection results on video frames and integrate the detection results into the business logic through the GstPlugin interface.
2. The fluorescent clothing recognition algorithm based on color segmentation according to claim 1, characterized in that, The fluorescent clothing in S1 includes red fluorescent clothing, green fluorescent clothing, yellow fluorescent clothing and blue fluorescent clothing.
3. The fluorescent clothing recognition algorithm based on color segmentation according to claim 2, characterized in that, The standardization process in S1 includes size unification, grayscale conversion, and normalization to ensure the consistency of the dataset.
4. The fluorescent clothing recognition algorithm based on color segmentation according to claim 3, characterized in that, The specific steps for semantic segmentation annotation in S1 are as follows: S1.1: Select Labelme as the image annotation tool; S1.2: For each image, use the annotation tool to manually draw the outline of the fluorescent clothing to distinguish it from the background and other objects; S1.3: Save the annotation information as an annotation file compatible with the image format.
5. The fluorescent clothing recognition algorithm based on color segmentation according to claim 1, characterized in that, The operation steps of S2 are as follows: S2.1: A deep learning framework using PyTorch as the algorithm implementation; S2.2: Train the YOLOv8s model using the standardized and labeled fluorescent clothing segmentation dataset; train the YOLOv9e model using the pedestrian detection labeled dataset; S2.3: Evaluate the trained semantic segmentation model and pedestrian detection model using the test set; S2.4: The model is then optimized using TensorRT to improve inference speed and performance on the GPU.
6. The fluorescent clothing recognition algorithm based on color segmentation according to claim 5, characterized in that, The specific steps for TensorRT to optimize the model in S2.4 are as follows: S2.4.1: Convert the PyTorch model to ONNX, a format supported by TensorRT; S2.4.2: Use the optimization strategies provided by TensorRT to further improve the inference speed and performance of the model; S2.4.3: After optimization, use benchmarking tools to measure the model's actual inference speed and performance on the GPU and compare it with that before optimization.
7. The fluorescent clothing recognition algorithm based on color segmentation according to claim 1, characterized in that, The specific operation steps in S3 are as follows: S3.1: Employs an H.264 decoder; S3.1: The input video stream is decoded using an H.264 decoder in conjunction with hardware. S3.2: Input the decoded video frames into the yolov9e model for pedestrian detection and locate pedestrians in the video; S3.3: For each detected pedestrian, crop the area of that pedestrian in the original image; S3.4: Input the extracted region into the YOLOv8s fluorescent clothing segmentation model to identify the fluorescent clothing.
8. The fluorescent clothing recognition algorithm based on color segmentation according to claim 1, characterized in that, The specific operation steps in S4 are as follows: S4.1: Set the threshold for fluorescent clothing; S4.2: Based on the fluorescent clothing segmentation results, compare with the threshold to determine whether the preset threshold is exceeded. If it is exceeded, determine that the pedestrian is wearing a fluorescent clothing; otherwise, determine that the pedestrian is not wearing a fluorescent clothing. S4.3: If the judgment result is that the person is not wearing a fluorescent vest, an alarm will be triggered.
9. The fluorescent clothing recognition algorithm based on color segmentation according to claim 1, characterized in that, The specific steps of S5 are as follows: S5.1: Mark the detection frame around the detected pedestrian with different colors or patterns to distinguish between those who have been identified as wearing fluorescent clothing and those who are not; S5.2: Use OSD technology to display the detected pedestrian bounding boxes, fluorescent clothing areas, etc. on the video frames; S5.3: Then, through the GstPlugin interface, the information on whether fluorescent clothing is being detected is integrated into the business logic; S5.4: The detection results are then displayed on the desktop via EGL and other sinks for easy real-time monitoring and management.
10. The fluorescent clothing recognition algorithm based on color segmentation according to claim 9, characterized in that, The methods for integrating information into business logic in S5.3 include logging, sending warning emails or SMS notifications to security management personnel.