[Python] YOLOv11 CPU quit without throwing exception

Discussão em 'Python' iniciado por Stack, Junho 22, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use YOLO v11 to do real time object detection, the simple code is:

    from ultralytics import YOLO
    import time
    import gc
    import threading
    import psutil
    import os
    process = psutil.Process(os.getpid())
    model=YOLO("yolo11n.pt")
    while True:
    model.predict("11.jpg")
    print(psutil.cpu_percent())
    num_threads = threading.active_count()
    print(f"{num_threads}")
    print(f"{psutil.virtual_memory().percent}%")
    gc.collect()


    sadly, after running for some epochs, it quits for no reason, no exception.

    One possible reason is that I found that the CPU usage of this Python is continously increasing up to 85%, it may be a potential cause. But the memory usage is stable at 300MB.

    Continue reading...

Compartilhe esta Página