资讯动态

工业零件检测的数据集 螺丝螺母螺钉数据集 yolo工业零件数据集 六角螺母数据集

发布时间:2026/9/11 21:51:46 来源:尧图企业网站定制
工业零部件篇——13种工业零件检测数据集 该数据集共有2100张图片数据 已处理成yolo格式、voc格式标签类别及标签个数 Double hexagonal column 双六角柱 917 Flange nut 法兰螺母 867 Hexagon nut 六角螺母 943 Hexagon pillar 六角柱 903 Hexagon screw 六角螺钉 895 Hexagonal steel column 六角钢柱 920 Horizontal bubble 水平仪 897 Keybar 垫片 945 Plastic cushion pillar 塑料缓冲柱 908 Rectangular nut 矩形螺母 924 Round head screw 圆头螺丝 889 Spring washer 弹簧垫圈 940 T-shaped screw T 型螺丝 910使用YOLOv8来训练一个包含2100张图像的13种工业零件检测数据集。这个数据集已经处理成YOLO格式和VOC格式可以直接用于模型训练。数据集描述数据量2100张图像类别0: Double hexagonal column双六角柱1: Flange nut法兰螺母2: Hexagon nut六角螺母3: Hexagon pillar六角柱4: Hexagon screw六角螺钉5: Hexagonal steel column六角钢柱6: Horizontal bubble水平仪7: Keybar垫片8: Plastic cushion pillar塑料缓冲柱9: Rectangular nut矩形螺母10: Round head screw圆头螺丝11: Spring washer弹簧垫圈12: T-shaped screwT型螺丝标注格式YOLO格式、VOC格式应用场景工业零件检测数据集组织假设你的数据集目录结构如下industrial_parts_dataset/├── images/│ ├── train/│ │ ├── 000001.jpg│ │ ├── 000002.jpg│ │ └── …│ ├── val/│ │ ├── 000001.jpg│ │ ├── 000002.jpg│ │ └── …│ └── test/│ ├── 000001.jpg│ ├── 000002.jpg│ └── …├── labels_yolo/│ ├── train/│ │ ├── 000001.txt│ │ ├── 000002.txt│ │ └── …│ ├── val/│ │ ├── 000001.txt│ │ ├── 000002.txt│ │ └── …│ └── test/│ ├── 000001.txt│ ├── 000002.txt│ └── …├── labels_voc/│ ├── train/│ │ ├── 000001.xml│ │ ├── 000002.xml│ │ └── …│ ├── val/│ │ ├── 000001.xml│ │ ├── 000002.xml│ │ └── …│ └── test/│ ├── 000001.xml│ ├── 000002.xml│ └── …└── data.yaml # 数据配置文件数据配置文件创建或确认data.yaml文件是否正确配置了数据集路径和类别信息yaml深色版本train: ./images/train/ # 训练集图像路径val: ./images/val/ # 验证集图像路径test: ./images/test/ # 测试集图像路径Classesnc: 13 # 类别数量names:Double hexagonal columnFlange nutHexagon nutHexagon pillarHexagon screwHexagonal steel columnHorizontal bubbleKeybarPlastic cushion pillarRectangular nutRound head screwSpring washerT-shaped screw # 类别名称列表安装YOLOv8如果你还没有安装YOLOv8可以使用以下命令安装bash深色版本pip install ultralytics训练模型使用YOLOv8训练模型的命令非常简单你可以直接使用以下命令开始训练bash深色版本cd path/to/industrial_parts_dataset/克隆YOLOv8仓库git clone https://github.com/ultralytics/ultralytics.gitcd ultralytics开始训练python yolo.py detect train data…/data.yaml modelyolov8n.pt epochs100 imgsz640 batch16在这个命令中data…/data.yaml指定数据配置文件。modelyolov8n.pt指定预训练权重这里使用的是YOLOv8的小模型。epochs100训练轮数。imgsz640输入图像的大小。batch16批量大小。模型评估训练完成后可以使用以下命令评估模型在验证集上的表现bash深色版本python yolo.py detect val data…/data.yaml modelruns/detect/train/weights/best.pt imgsz640这里的runs/detect/train/weights/best.pt是训练过程中产生的最佳模型权重文件。模型预测你可以使用训练好的模型对新图像进行预测bash深色版本python yolo.py detect predict sourcepath/to/your/image.jpg modelruns/detect/train/weights/best.pt imgsz640 conf0.4 iou0.5查看训练结果训练过程中的日志和结果会保存在runs/detect/目录下你可以查看训练过程中的损失、精度等信息。数据增强为了进一步提高模型性能可以使用数据增强技术。以下是一个简单的数据增强示例安装albumentations库bash深色版本pip install -U albumentations在yolo.py中添加数据增强python深色版本import albumentations as Afrom albumentations.pytorch import ToTensorV2import cv2定义数据增强transform A.Compose([A.RandomSizedCrop(min_max_height(400, 640), height640, width640, p0.5),A.HorizontalFlip(p0.5),A.VerticalFlip(p0.5),A.Rotate(limit10, p0.5, border_modecv2.BORDER_CONSTANT),A.ColorJitter(brightness0.2, contrast0.2, saturation0.2, hue0.2, p0.5),A.GaussNoise(var_limit(10.0, 50.0), p0.5),A.Normalize(mean[0.485, 0.456, 0.406], std[0.229, 0.224, 0.225]),ToTensorV2()], bbox_paramsA.BboxParams(format‘yolo’, label_fields[‘class_labels’]))在数据加载器中应用数据增强def collate_fn(batch):images, targets zip(*batch)transformed_images []transformed_targets []for img, target in zip(images, targets): bboxes target[bboxes] class_labels target[labels] augmented transform(imageimg, bboxesbboxes, class_labelsclass_labels) transformed_images.append(augmented[image]) transformed_targets.append({ bboxes: augmented[bboxes], labels: augmented[class_labels] }) return torch.stack(transformed_images), transformed_targets注意事项数据集质量确保数据集的质量包括清晰度、标注准确性等。模型选择可以选择更强大的模型版本如YOLOv8m、YOLOv8l等以提高性能。超参数调整根据实际情况调整超参数如批量大小batch、图像大小imgsz等。监控性能训练过程中监控损失函数和mAP指标确保模型收敛。通过上述步骤你可以使用YOLOv8来训练一个包含13种工业零件检测的数据集并使用训练好的模型进行预测。

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价