我正在使用 Pycharm 在 Python 中尝试我的第一个 YOLOv8。 代码很简单。
from ultralytics import YOLO
model = YOLO("yolov8n.yaml")
results = model.train(data="config.yaml", epochs=2)
我得到的错误如下。
RuntimeError: Attempt to start a new process before the current process has finished its bootstrapping phase. This probably means that you are on Windows 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 a executable.
我使用的是以下版本的 MIC-770 V3:
有人遇到过这个问题吗? GPU 或 CPU 是否需要驱动器来处理多处理?
我尝试使用带有以下函数 multiprocessing.freeze_support() 的多处理库,但它不起作用。
此错误意味着您需要将代码放入其中
main
:
if __name__ == '__main__':
from ultralytics import YOLO
model = YOLO("yolov8n.yaml")
results = model.train(data="config.yaml", epochs=2)