赞
踩
链接:https://pan.baidu.com/s/1_9hI8ZshNCJSMJVXNTVxbQ?pwd=1234
提取码:1234
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-cls.pt" # 数据集yaml文件路径 data_path = r"D:\YoloV8Manual\dataset\DogCat-cls" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Cls" predict_ImgPath = r"dataset/DogCat-cls/test/cat" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 model.train(data=data_path, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(data=data_path) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO import os # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Cls\weights\best.pt" # 数据集yaml文件路径 data_path = r"D:\YoloV8Manual\dataset\DogCat-cls" # 训练轮数 epochs = 1 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Cls" predict_ImgPath = r"dataset/DogCat-cls/test/cat" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 #model.train(data=data_path, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(workers=0) # 在验证集上评估模型性能 # 4 模型预测 #results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) #model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO import os # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Cls\weights\best.pt" # 数据集yaml文件路径 data_path = r"D:\YoloV8Manual\dataset\DogCat-cls" # 训练轮数 epochs = 1 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Cls" predict_ImgPath = r"dataset/DogCat-cls/val/cat" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 #model.train(data=data_path, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(workers=0) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) #model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO import os # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Cls\weights\best.pt" # 数据集yaml文件路径 data_path = r"D:\YoloV8Manual\dataset\DogCat-cls" # 训练轮数 epochs = 1 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Cls" predict_ImgPath = r"dataset/DogCat-cls/val/cat" save_predictImg_flag = True exportType= "engine" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_path, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType)
from ultralytics import YOLO import os # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Cls\weights\best.pt" # 数据集yaml文件路径 data_path = r"D:\YoloV8Manual\dataset\DogCat-cls" # 训练轮数 epochs = 1 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Cls" predict_ImgPath = r"dataset/DogCat-cls/val/cat" save_predictImg_flag = True exportType= "openvino" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_path, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\det_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Det" predict_ImgPath = r"dataset/DogCat-det/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(data=data_yaml) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Det\weights\best.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\det_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Det" predict_ImgPath = r"dataset/DogCat-det/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) # model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Det\weights\best.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\det_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Det" predict_ImgPath = r"dataset/DogCat-det/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) # model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Det\weights\best.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\det_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Det" predict_ImgPath = r"dataset/DogCat-det/images/val" save_predictImg_flag = True exportType= "engine" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"D:\YoloV8Manual\AIModel\CatAndDog_Det\weights\best.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\det_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Det" predict_ImgPath = r"dataset/DogCat-det/images/val" save_predictImg_flag = True exportType= "openvino" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-seg.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\seg_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Seg" predict_ImgPath = r"dataset/DogCat-seg/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(data=data_yaml) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-seg.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\seg_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Seg" predict_ImgPath = r"dataset/DogCat-seg/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 metrics = model.val(data=data_yaml) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) # model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-seg.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\seg_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Seg" predict_ImgPath = r"dataset/DogCat-seg/images/val" save_predictImg_flag = True exportType= "onnx" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) # model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-seg.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\seg_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Seg" predict_ImgPath = r"dataset/DogCat-seg/images/val" save_predictImg_flag = True exportType= "engine" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
from ultralytics import YOLO # 0 参数配置 # 模型路径 model_path = r"./yolov8s-seg.pt" # 数据集yaml文件路径 data_yaml = r"D:\YoloV8Manual\data_yaml\seg_data.yaml" # 训练轮数 epochs = 500 imgsz = 224 batch = 4 project = r"./AIModel" name = "CatAndDog_Seg" predict_ImgPath = r"dataset/DogCat-seg/images/val" save_predictImg_flag = True exportType= "openvino" exist_ok = True # 1 加载模型 model = YOLO(model_path) # 2 训练模型 # model.train(data=data_yaml, epochs=epochs, imgsz=imgsz,batch=batch,workers=0,project=project,name=name,exist_ok=True) # 3 验证模型 # metrics = model.val(data=data_yaml,workers=0) # 在验证集上评估模型性能 # 4 模型预测 # results = model.predict(source=predict_ImgPath, imgsz=imgsz ,save=save_predictImg_flag,batch=batch) # save plotted images # 5 导出所需模式(以onnx为例) model.export(format=exportType, imgsz=imgsz)
如何解决安装Anaconda后,使用pip install 包名 安装的包未出现在Anaconda目录的sit-site-packages,而出现在C盘python的sitepackag里问题
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。