yolov8蒸馏训练
161 字
1 分钟
yolov8蒸馏训练
1、分别训练学生模型和教师模型
这里用的是yolov8x.pt为权重训练教师模型,yolov8s.pt作为学生模型
import osfrom ultralytics import YOLOimport torchos.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
def main(): model = YOLO("yolov8x.pt") # model = YOLO("yolov8s.pt") # 训练为学生模型,也可以自己剪枝 model.train(data="data.yaml", Distillation = None, loss_type='None', amp=False, imgsz=640, epochs=50, batch=20, device=0, workers=0)
if __name__ == '__main__': main()2、蒸馏训练
import osfrom ultralytics import YOLOimport torch
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
def main(): model_t = YOLO('runs/detect/yolov8x/weights/best.pt') # the teacher model model_s = YOLO('runs/detect/yolov8s/weights/best.pt') # the student model """ Attributes: Distillation: the distillation model loss_type: mgd, cwd amp: Automatic Mixed Precision """ model_s.train(data="data.yaml", Distillation=model_t.model, loss_type='mgd', amp=False, imgsz=640, epochs=100, batch=20, device=0, workers=0, lr0=0.001)
if __name__ == '__main__': main()参考链接:
https://blog.csdn.net/W_extend/article/details/140902235?spm=1001.2014.3001.5502
yolov5蒸馏训练项目链接:
https://github.com/tangjunjun966/yolov5-6.0-distillation-master
支持与分享
如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!
相关文章 智能推荐
1
图像增强库Albumentations使用
AI 参考链接: https://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/116460996
2
Mxnet-GPU-102版本安装
AI 1、安装10.2版本的CUDA硬件加速环境 本blog的安装教程的跳转连接:https://blog.cherrylord.cn/article/post 29 2、创建conda虚拟环境 要创建的环境的python版本需要3.7.13的版本 3、直接安装mxnet cu102的
3
Yolo模型转换
AI 以下都以yolo的姿态检测模型为例 1、准备需要用的程序 第一个工程:rknn toolkit2, 用于安装模型转换所需环境 ,github地址:https://github.com/airockchip/rknn toolkit2/releases 第二个工程:ultralyt
4
开源Paddleocr+人脸提取实现身份证信息识别
AI 1、安装 根据自己的环境安装对应的依赖 参考链接:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux pip.html 2、Pa
5
Yolo_Pose姿态模型在arm linux的验证与部署
AI 1、下载模型转换项目 rknn model zoo github链接:https://github.com/airockchip/rknn model zoo/tree/main 2、在板子 瑞芯微 配置后对应的运行环境 rknn toolkit2: https://github
随机文章 随机推荐