在当前进程完成其引导阶段之前,已尝试启动新进程。
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
Run Code Online (Sandbox Code Playgroud)
** 尝试在 python 环境中训练 YOLOv8 模型时会出现此错误** from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n.yaml") # build a new model from scratch
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
# Use the model
results = model.train(data="coco128.yaml", epochs=3) # train the model
results = model.val() # evaluate model performance on the validation set
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
success = YOLO("yolov8n.pt").export(format="onnx") # export a model to ONNX format
Run Code Online (Sandbox Code Playgroud)
Pri*_*rko 15
我通过将模型流程代码保留在顶级环境的名称下(if name == ' main ':) 设法克服了这个问题,如下所示:
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n.yaml") # build a new model from scratch
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
if __name__ == '__main__':
# Use the model
results = model.train(data="coco128.yaml", epochs=3) # train the model
results = model.val() # evaluate model performance on the validation set
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
success = YOLO("yolov8n.pt").export(format="onnx") # export a model to ONNX format
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5112 次 |
最近记录: |