Intelligent Construction Site AI Algorithm Development and AI Box IntegrationIssuing time:2025-06-17 14:15 AI Algorithm Application Scenarios inConstruction Sites Construction site algorithm scenarios arerelatively complex, varying across different site environments. They includedozens of recognition scenarios, such as safety helmet detection, human formdetection, flame detection, target tracking, safety visual analysis, personnel detection (personnel loitering detection), fall recognition, workuniform reflective strip recognition, etc.
The algorithm can be used in conjunctionwith Dingchang's AI edge computing box. The 6TOPS high computing power ofRK3588 meets the development and practical application of AI algorithms inintelligent construction sites, industrial production, and other fields.
Here, the editor from Dingchang takes theclassic safety helmet AI recognition as an example for a brief introduction. I. Safety Helmet Recognition: A TargetDetection Algorithm This involves steps such as safety helmetimage dataset collection, training data processing, and targetrecognition.
Example: First, create a folder on thecomputer: E:\AI数据集\ztl_safe_hat_dataset_2024.11.81636\.Inside this folder, create an `images` folder for storing all images to beannotated and a `labels` folder for storing label files after annotation withthe labelimg tool. In this example, the `images` folder contains 3,769 dataset images. Notes: 1. Data Collection: Dataset images shouldinclude features such as people wearing safety helmets (60%), people notwearing safety helmets (40%), diverse scenarios, multiple angles, various typesof safety helmets, different distances, clear images, and minimalobstructions. 2. Dataset Diversity: Ensure diversity toenable the trained model to have good generalization ability. 3. Image Quality: Images should be clearwith minimal obstructions and blurry targets, as this allows the dataset toextract clearer features during training, reducing misrecognition. 4. Ideal Dataset Size: Typically, around10,000 images and 50,000 anchor boxes are ideal. While thousands of images cantrain models that perform well in specific environments, extreme quantities(too many or too few) may not be optimal. 5. Dataset Impact: Some datasets positivelyaffect model performance, while others may have negative effects. For AImodels, both positive and negative impacts serve purposes. Quality matters morethan quantity or mere diversity. 6. Model Effect Determinants: The datasetcreation and training methods significantly influence AI model performance,requiring extensive experimentation and experience summarization to developmodels that meet scenario requirements. Steps to Build labelimg AnnotationEnvironment: 1. Open labelimg, select Open Directory →choose the folder `E:\AI数据集\ztl_safe_hat_dataset_2024.11.81636\images`and confirm.
2. Select the path to store labels, choosethe folder `E:\AI数据集\ztl_safe_hat_dataset_2024.11.81636\labels`and confirm.
Once the labelimg annotation environment isset up, annotation can begin. After annotating data, labels and coordinates areautomatically saved to the `labels` directory.
II.Safety Helmet Dataset Splitting Method Split the dataset into 80% training set(train) and 20% validation set (val), which yields an ideal modelperformance.
Key Points for Splitting Train and ValSets: Ensure onetoone correspondence between`images` and `labels`. Manual splitting is tedious and errorprone. Below is anautomated dataset splitting code and explanation: ```python (ultralytics_yolov8) root@dev:/jwq/script catrun_split_train_val.py import os import random import shutil 设置文件夹路径 base_dir ='/jwq/test/ztl_safe_hat_dataset_2024.11.81636' images_dir = os.path.join(base_dir,'images') labels_dir = os.path.join(base_dir,'labels') train_dir = os.path.join(base_dir, 'train') val_dir = os.path.join(base_dir, 'val') 确保目标文件夹存在 os.makedirs(os.path.join(train_dir,'images'), exist_ok=True) os.makedirs(os.path.join(train_dir,'labels'), exist_ok=True) os.makedirs(os.path.join(val_dir,'images'), exist_ok=True) os.makedirs(os.path.join(val_dir,'labels'), exist_ok=True) 支持的图片格式 image_extensions = ('.jpg', '.jpeg','.png', '.bmp', '.tiff') 获取所有图片文件名 image_files = [f for f inos.listdir(images_dir) if f.lower().endswith(image_extensions)] 清除没有对应标签文件的图片 image_files_with_labels = [f for f inimage_files if os.path.isfile(os.path.join(labels_dir, f.rsplit('.', 1)[0] +'.txt'))] 打印清理前后的图片数量 print(f"Total images before cleaning:{len(image_files)}") print(f"Total images after cleaning:{len(image_files_with_labels)}") 随机打乱列表 random.shuffle(image_files_with_labels) 计算分割点 split_index =int(len(image_files_with_labels) 0.8) 分割成训练集和验证集 train_images =image_files_with_labels[:split_index] val_images =image_files_with_labels[split_index:] 复制图片和标签到相应的文件夹 def copy_files(file_list, target_image_dir,target_label_dir): for file_name in file_list: 复制图片 shutil.copy2(os.path.join(images_dir, file_name),os.path.join(target_image_dir, file_name)) 复制标签 label_file = file_name.rsplit('.', 1)[0] + '.txt' shutil.copy2(os.path.join(labels_dir, label_file),os.path.join(target_label_dir, label_file)) 复制训练集 copy_files(train_images,os.path.join(train_dir, 'images'), os.path.join(train_dir, 'labels')) 复制验证集 copy_files(val_images,os.path.join(val_dir, 'images'), os.path.join(val_dir, 'labels')) 打印分割后的集合大小 print(f"Training set size:{len(train_images)}") print(f"Validation set size:{len(val_images)}") ``` III.Safety Helmet Recognition Training and Model Evaluation Train according to the YoloV8 trainingchapter in this document. YoloV8 Training 1.jpg Notes: 1. Training Details: 1,000 dataset images,200 epochs, 2hour training. 80% train set, 20% val set. 2. Results: mAP50 for `head` is 0.989,`safe_hat` is 0.99, and `all` is 0.99, indicating good training but risk ofoverfitting. Adding diverse scenario data can reduce overfitting. 3. Performance Gap: `head` has lower mAP50than `safe_hat`, possibly due to fewer `head` samples. Supplementing `head`data can prevent `safe_hat` from being misrecognized as `head`.
Notes: 1. Inference Result: In clear images,YoloV8M model shows `safe_hat` confidence around 0.88 (ideal should be~0.95). 2. Misrecognition Example: A hand featureis misrecognized as `safe_hat` with 0.33 confidence, likely due to: Blurry/small target "dirty data" inannotations causing similar features to be recognized. Insufficient negative samples, failing tosuppress background features. 3. Improvement Directions: Refine the dataset to exclude lowqualitydata. Add diverse scenario datasets to suppressbackground features. While confidence thresholds can be adjusted inthe AI application layer, improving the model itself leaves more room foroptimization.
Notes: 1. Training Details: ~3,760 images, 179epochs, 2hour training. 80% train set, 20% val set. 2. Efficiency Comparison: 1,000 imagesrequired 200 epochs, while 3,760 images completed in 179 epochs, indicating themodel fit faster with more precise data, efficiently extracting commonfeatures.
Notes: 1. Latest Inference: The previous 0.33misrecognition target has disappeared, confirming the effectiveness ofimprovements. 2. Accuracy Enhancement Strategies: Useprecise datasets, introduce diverse scenario data, and leverage negativesamples to enhance model learning, collectively improving AI algorithm accuracyin target detection.
For any questions, please contact ourcustomer service via phone or add us for further assistance. We are dedicated to serving you. Declaration: This article is originally created by the editor of Guangzhou Dingchang Electronics. Some materials are from our own factory, cooperative customers and the Internet. In case of any rights issues or content errors, you can contact the editor via email (91hui@163.com) for handling and correction. Reprinting is welcome, but please indicate the source link.https://enpc.gzdcsmt.com/sys-nd/3213.html
|
Your name * WhatsApp OR WeChat ID Your company name Your email address * Phone Number Additional Messages Submit NOW! |