[Python] error The kernel for Untitled1.ipynb appears to have died. It will restart...

Discussão em 'Python' iniciado por Stack, Maio 2, 2025.

  1. Stack

    Stack Membro Participativo

    i run this code

    import os from PIL
    import Image
    import torch from yolov5
    import train
    import yaml
    os.environ['CUDA_VISIBLE_DEVICES'] = '0'
    folder_path = "C:\\Users\\masou\\OneDrive\\Desktop\\New folder (5)"
    for filename in os.listdir(folder_path):
    file_path = os.path.join(folder_path, filename)
    if filename.endswith(".txt"):
    with open(file_path, "r", encoding="utf-8") as file:
    content = file.read()
    print(f"content :{filename}:\n{content}\n")
    elif filename.endswith(".jpg"):
    image = Image.open(file_path)
    #image.show()
    from ultralytics import YOLO
    model = YOLO("yolov8n.pt") model.to("cuda")
    try:
    model.train(data="dataset.yaml", epochs=5 , workers=1 ,batch=8,amp=Falseو, mosaic=0.0, augment=False)
    except Exception as e:
    print(f"error: {e}")


    But error The kernel for Untitled1.ipynb appears to have died. It will restart automatically happened.

    Continue reading...

Compartilhe esta Página