- 上篇文章写了,yolov11对象检测软件,这篇文章再加入训练的功能
- 环境配置环境配置onnx 1.16.1,onnx-graphsurgeon 0.5.2,onnxruntime 1.19.2,onnxruntime-gpu 1.19.2,onnxslim 0.1.34,torch 2.3.1+cu121,torchaudio 2.3.1+cu121,torchvision 0.18.1+cu121,PySide6 6.6.1,PySide6-Addons 6.6.1,PySide6-Essentials 6.6.1
- 分类使用的数据集,halcon的pill_bag对象检测的数据集
4.软件界面
5.核心代码
def TrainThrExecut(self):_monitor_train.TrainSimple = Trueimagedealwith._image_deal_with.Model = YOLO(imagedealwith._image_deal_with.TrainPreprocessModelPath)results = imagedealwith._image_deal_with.Model.train(data=imagedealwith._image_deal_with.TrainingYamlFilePath,project=imagedealwith._image_deal_with.TrainSaveDataPath,epochs=imagedealwith._image_deal_with.Epoches,batch=imagedealwith._image_deal_with.BatchSize,imgsz=imagedealwith._image_deal_with.PreprocessImageSize,amp=False)print(results)sucess = imagedealwith._image_deal_with.Model.export(format='onnx')_monitor_train.TrainSimple = Falseimagedealwith._image_deal_with.ImageDealWithStatus = ImageDealWithStatusEnu.Inferenceself.pbtn_train.setText("Train")self.lab_train_status.setText("")pass