Ultralytics YOLO27: 대기자 명단에 등록해 주십시오.

Weights & Biases를 활용한 YOLO 실험 추적 및 시각화

객체 감지 모델(예: Ultralytics YOLO26은 다양한 컴퓨터 비전 애플리케이션에서 핵심적인 역할을 합니다. 하지만 이러한 복잡한 모델을 학습하고 평가 및 배포하려면 여러 가지 어려움이 따릅니다. 주요 학습 지표 추적, 모델 변형 비교, 모델 동작 분석, 문제 감지에는 상당한 계측 작업과 실험 관리가 필요합니다.



시청: Weights and Biases와 함께 Ultralytics YOLO26을 사용하는 방법

이 가이드에서는 Ultralytics YOLO26과 Weights & Biases를 통합해 실험 추적, 최적 모델 아티팩트 관리, 모델 성능 시각화를 수행하는 방법을 소개합니다. 또한 Weights & Biases의 대화형 기능을 사용해 통합을 설정하고, 모델을 학습하며, 결과를 시각화하는 방법도 설명합니다.

YOLO 체크포인트를 W&B에 기록해 두셨나요? Settings > Integrations > Weights & Biases에서 프로젝트를 Ultralytics Platform으로 가져오세요.

Weights & Biases#

Weights & Biases는 머신러닝 실험을 추적하고 시각화하며 관리하도록 설계된 MLOps 플랫폼입니다. 실험의 완전한 재현성을 위한 학습 메트릭 자동 로깅, 효율적인 데이터 분석을 위한 대화형 UI, 다양한 환경에 배포할 모델을 관리하는 효율적인 도구를 제공합니다.

Weights & Biases를 활용한 YOLO26 학습#

Weights & Biases를 사용하면 YOLO26 학습 프로세스의 효율성과 자동화를 높일 수 있습니다. 이 통합 기능으로 실험을 추적하고 모델을 비교하며, 데이터에 기반한 의사결정을 통해 컴퓨터 비전 프로젝트를 개선할 수 있습니다.

설치#

필수 패키지를 설치하려면 다음을 실행하세요:

설치
# Install the required packages for Ultralytics YOLO and Weights & Biases
pip install -U ultralytics wandb

# Enable W&B logging for Ultralytics
yolo settings wandb=True

설치 과정에 관한 자세한 안내와 모범 사례는 YOLO26 설치 가이드를 확인하세요. YOLO26 필수 패키지를 설치하는 중 문제가 발생하면 해결 방법과 팁은 일반적인 문제 가이드를 참조하세요.

Weights & Biases 구성#

필요한 패키지를 설치한 다음에는 Weights & Biases 환경을 설정해야 합니다. 개발 환경과 W&B 플랫폼을 원활하게 연결하려면 Weights & Biases 계정을 만들고 필요한 API 키를 발급받아야 합니다.

먼저 작업 공간에서 Weights & Biases 환경을 초기화합니다. 다음 명령을 실행하고 안내에 따라 설정하면 됩니다.

초기 SDK 설정
import wandb

# Weights & Biases 환경을 초기화합니다(API 키를 입력하도록 요청하거나 WANDB_API_KEY를 읽습니다).
wandb.login()

Weights & Biases 인증 페이지로 이동하여 API 키를 생성하고 확인하세요. W&B에 환경을 인증하라는 메시지가 표시되면 이 키를 사용하세요.

사용법: Weights & Biases를 활용한 YOLO26 학습#

사용법: Weights & Biases를 활용한 YOLO26 학습
from ultralytics import YOLO

# YOLO 모델 로드
model = YOLO("yolo26n.pt")

# 모델 학습 및 파인튜닝
model.train(data="coco8.yaml", epochs=5, project="ultralytics", name="yolo26n")

Ultralytics가 생성하는 실행은 학습 지표를 epoch에 대해 그래프로 표시합니다. 학습을 시작하기 전에 wandb.init()로 실행을 시작하면 Ultralytics는 해당 실행에 로그를 기록하고, 모든 행에 epoch 값을 포함하며, 사용자가 계속 로그를 기록하고 직접 wandb.finish()을 호출할 수 있도록 실행을 열린 상태로 둡니다. 학습 인수는 해당 실행의 config에 추가되며, 사용자나 W&B sweep에서 이미 설정한 키는 기존 값을 유지합니다.

W&B 인수#

인수기본값설명
projectNone로컬과 W&B에 기록되는 프로젝트의 이름을 지정하며, 여러 실행을 하나로 묶습니다. 설정하지 않으면 W&B 실행 기록은 Ultralytics 프로젝트에 저장됩니다.
nameNone학습 실행의 이름입니다. 이 이름은 하위 폴더를 만들 때와 W&B 기록에 사용됩니다.
saveTrue최적의 체크포인트를 W&B 모델 아티팩트로 업로드할지 여부를 결정합니다.
Weights & Biases 활성화 또는 비활성화

Ultralytics에서 Weights & Biases 기록을 활성화하거나 비활성화하려면 yolo settings 명령을 사용할 수 있습니다. 기본적으로 Weights & Biases 기록은 비활성화되어 있습니다.

# Enable Weights & Biases logging
yolo settings wandb=True

# Disable Weights & Biases logging
yolo settings wandb=False
오프라인 모드 및 재개

네트워크 연결 없이 로그를 기록하도록 WANDB_MODE=offline을 설정한 다음 wandb sync <save_dir>/wandb/offline-run-*을 사용해 실행을 업로드합니다. resume=True로 학습을 재개하면 온라인 또는 오프라인 상태와 운영 체제에 관계없이 동일한 W&B 실행을 이어서 진행합니다. 이를 위해 원래 저장 디렉터리의 wandb/ 디렉터리에 있는 가장 최근 실행 폴더에서 실행 ID를 읽으므로 해당 디렉터리를 그대로 유지해야 합니다.

출력 이해하기#

위의 사용 예제 코드를 실행하면 다음과 같은 주요 출력이 표시됩니다.

  • 학습 프로세스의 시작을 나타내는 고유 ID와 함께 새로운 실행이 설정됩니다.
  • 레이어 및 파라미터 수를 포함하여 모델 구조를 간략하게 요약합니다.
  • 각 학습 에포크 동안 학습 손실, 정밀도, 재현율, mAP 점수와 같은 주요 지표를 정기적으로 업데이트합니다.
  • 학습이 끝나면 모델의 추론 속도와 전반적인 정확도 지표를 포함한 상세 지표가 표시됩니다.
  • 학습 프로세스를 심층 분석하고 시각화할 수 있는 Weights & Biases 대시보드 링크와 로컬 로그 파일 위치 정보가 제공됩니다.

Weights & Biases 대시보드 보기#

사용 예제 코드를 실행한 후 출력에 제공된 링크를 통해 Weights & Biases(W&B) 대시보드에 액세스할 수 있습니다. 이 대시보드에서는 YOLO26 모델의 학습 프로세스를 종합적으로 확인할 수 있습니다.

Weights & Biases 대시보드의 주요 기능#

  • 실시간 지표 추적: 학습 중 변화하는 손실, 정확도, 검증 점수 등의 지표를 확인하여 모델 조정에 필요한 인사이트를 즉시 얻을 수 있습니다. Weights & Biases를 사용하여 실험을 추적하는 방법을 확인하세요.

  • 하이퍼파라미터 비교: 모든 실행에서 학습률과 배치 크기 등의 학습 인수를 기록하므로 실행 간 구성을 비교할 수 있습니다. W&B 로깅을 사용한 자동 검색에는 Ray Tune을 사용합니다.

  • 비교 분석: 플랫폼에서 여러 학습 실행을 나란히 비교할 수 있습니다. 이는 다양한 모델 구성의 영향을 평가하고 어떤 변경 사항이 성능을 높이는지 파악하는 데 필수적입니다.

  • 학습 진행 상황 시각화: 주요 지표를 그래프로 표시하여 에폭 전반에 걸친 모델 성능을 직관적으로 파악할 수 있습니다. Weights & Biases를 통해 검증 결과를 시각화하는 방법을 확인하세요.

  • 리소스 모니터링: CPU, GPU, 메모리 사용량을 추적하여 학습 프로세스의 효율성을 최적화하고 워크플로의 잠재적 병목 현상을 파악할 수 있습니다.

  • 모델 아티팩트 관리: 학습이 끝날 때 W&B 아티팩트로 업로드된 최적 모델 체크포인트에 액세스하고 공유하여 복잡한 프로젝트에서 팀원과 손쉽게 배포하고 협업할 수 있습니다.

이러한 기능을 사용하면 객체 탐지 작업을 위한 YOLO26 모델의 학습을 추적하고 분석하며 최적화할 수 있습니다.

요약#

이 가이드에서는 모델 학습 결과를 추적하고 시각화하는 Ultralytics YOLO와 Weights & Biases의 통합을 다루었습니다. W&B를 사용하면 머신러닝 워크플로를 간소화하고 데이터에 기반한 의사결정을 내리며 모델 성능을 개선할 수 있습니다.

자세한 내용은 이 통합에 관한 YOLO VISION 2023의 Soumik Rakshit 프레젠테이션을 확인하세요.

자주 묻는 질문#

  • Weights & Biases를 Ultralytics YOLO26과 통합하려면 다음 단계를 따르세요.

    1. 필요한 패키지를 설치합니다:

      pip install -U ultralytics wandb
      yolo settings wandb=True
    2. Weights & Biases 계정에 로그인합니다.

      wandb login
    3. W&B 기록을 활성화한 상태로 YOLO26 모델을 학습합니다.

      from ultralytics import YOLO
      
      model = YOLO("yolo26n.pt")
      model.train(data="coco8.yaml", epochs=5, project="ultralytics", name="yolo26n")

    이렇게 하면 지표, 하이퍼파라미터, 모델 아티팩트가 W&B 프로젝트에 자동으로 기록됩니다.

  • 주요 기능은 다음과 같습니다.

    • 학습 중 실시간 지표 추적
    • 실행 간 하이퍼파라미터 비교
    • 다양한 학습 실행 비교 분석
    • 그래프를 통한 학습 진행 상황 시각화
    • 리소스 모니터링(CPU, GPU, 메모리 사용량)
    • 모델 아티팩트 관리 및 공유

    이러한 기능은 YOLO26 프로젝트에서 실험을 추적하고, 모델을 최적화하며, 더욱 효과적으로 협업하는 데 도움이 됩니다.

  • W&B 통합 기능을 사용하여 학습 스크립트를 실행한 후 다음 단계를 따르세요.

    1. 콘솔 출력에 W&B 대시보드 링크가 제공됩니다.
    2. 링크를 클릭하거나 wandb.ai로 이동하여 계정에 로그인합니다.
    3. 프로젝트로 이동하여 상세 지표, 시각화 자료, 모델 성능 데이터를 확인합니다.

    대시보드에서 모델 학습 프로세스에 관한 인사이트를 확인하고 YOLO26 모델을 효과적으로 분석 및 개선할 수 있습니다.

  • 예. 다음 명령을 사용하여 W&B 기록을 비활성화할 수 있습니다.

    yolo settings wandb=False

    기록을 다시 활성화하려면 다음 명령을 사용하세요.

    yolo settings wandb=True

    이렇게 하면 학습 스크립트를 수정하지 않고도 W&B 기록을 사용할 시점을 제어할 수 있습니다.

  • Weights & Biases는 다음과 같은 방식으로 YOLO26 모델을 최적화하는 데 도움이 됩니다.

    1. 학습 지표의 상세한 시각화 자료 제공
    2. 다양한 모델 버전을 쉽게 비교할 수 있도록 지원
    3. 하이퍼파라미터 튜닝 비교를 위해 모든 실행의 학습 인수를 기록합니다
    4. 모델 성능에 대한 공동 분석 지원
    5. 모델 아티팩트 및 결과를 간편하게 공유할 수 있도록 지원

    이러한 기능은 연구자와 개발자가 더 빠르게 반복 작업을 수행하고 데이터 기반 의사결정을 내려 YOLO26 모델을 개선하는 데 도움이 됩니다.

댓글25

질문을 하거나 결과를 공유하거나 다른 사람을 도와주세요.

  1. TJdeWetGitHub

    Hi there,

    I would like to know how (if possible) to log more than just these standard metrics for a yolov8 or v11 model during HP tuning logged with wandb: train/loss, val/loss, metrics/accuracy_top1, metrics_accuracy_top5.

    This is what the code looks like:

    !pip install -U ultralytics wandb !yolo settings wandb=True import wandb from ultralytics import YOLO wandb.login(key="...")

    sweep_config = { 'method': "bayes", 'metric': { 'name': 'val/loss', 'goal': 'minimize', }, 'parameters': { .... } }

    sweep_id = ...

    def train(): run = wandb.init() model = YOLO('yolo11n-cls.pt')

    results = model.train(
        data='...',
        batch=wandb.config.batch,
        lr0=wandb.config.lr0,
        epochs=...,
        optimizer=...,
        momentum=...,
        patience=...,
        save_period=...,
        imgsz=...,
        cache=False,
        save=True
    )

    wandb.agent(sweep_id, train, count=...)

    1. Glenn JocherUltralytics

      @TJdeWet for custom metric logging beyond default training metrics in YOLO11 with W&B, you can access the complete results dictionary during training and log additional metrics manually through W&B's API. The automatically logged metrics vary by task type (detection/classification), but you can extend them using a callback. For implementation details, refer to the Weights & Biases integration documentation.

  2. marcory-hubGitHub
    Integration of Weights & Biases with YOLO11 in Google Colab

    Is it currently possible to integrate Weights & Biases (W&B) with Ultralytics YOLO11 in Google Colab? If yes, where can I find the correct and up-to-date information to set this up properly?

    My Issue

    With YOLOv10, I was able to track all my training metrics in W&B seamlessly. However, when trying to replicate this with YOLO11, only GPU and system-related data are logged to the W&B platform. None of the training metrics or results appear.

    Summary of things I've Tried
    • Following the YouTube tutorial linked at the top of this page.
    • Using the Try on Colab button on W&B's site
    WARNING: Did not find branch or tag 'feat/ultralytics', assuming revision or ref.
      error: subprocess-exited-with-error
      
      × git checkout -q feat/ultralytics did not run successfully.
      │ exit code: 1
      ╰─> See above for output.
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × git checkout -q feat/ultralytics did not run successfully.
    │ exit code: 1
    ╰─> See above for output.
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
    Note: The Ultralytcs integration will be soon available as a fully supported feature on Weights & Biases once this pull request is merged.

    This is because the branch https://github.com/wandb/wandb@feat/ultralytics does not exist. To resolve this, I tried various fixes, including following older tutorials and experimenting with suggestions from forums and community discussions.

    I’m particularly keen to switch to YOLO11 because it shows significant improvements in wildlife detection when compared to YOLOv10.

    Any guidance, updates, or resources on enabling this integration would be greatly appreciated!

    1. Glenn JocherUltralytics

      @marcory-hub yes, you can integrate Weights & Biases (W&B) with YOLO11 in Google Colab. Please ensure the latest ultralytics and wandb packages are installed using pip install -U ultralytics wandb. If training metrics are not being logged, ensure your W&B environment is authenticated (wandb.login(key="<API_KEY>")) and that project and name parameters are correctly specified in model.train(). Detailed setup instructions are available in our documentation: https://docs.ultralytics.com/integrations/weights-biases/. Let us know if further assistance is needed!

    2. marcory-hubGitHub

      Thanks for the suggestions, @glenn-jocker ! I tried starting from scratch with W&B with YOLO11 but unfortunately, only system information showed up in W&B.

      On top of that, it seems like my Colab runtime might be banned due to a potential issue with a compromised package. Hopefully, they'll restore access soon for everyone affected.

    3. marcory-hubGitHub

      Good news! My initial code now works for YOLO11. All metrics are automatically saved to W&B, and training is significantly faster than last week without maxing out Colab's RAM.

      I'm not sure why it's significantly faster today, but I suspect the previous slowness prevented training from progressing beyond the warmup epochs, resulting in only system information being sent to W&B.

    4. Glenn JocherUltralytics

      @marcory-hub glad to hear it's working well now, and thank you for sharing your experience! The faster training could indeed be related to runtime or hardware optimizations in Colab. Feel free to explore additional tips and resources in the YOLO11 W&B integration guide to further enhance your workflow. Let us know if you run into any other issues!

  3. Pushtogithub23GitHub

    I used this code, but it only logs system logs; no training metrics, media, or validation metrics are being logged as shown in the video. How can I log all the training metrics and media as demonstrated in the video? Can anyone help me with this?

    from ultralytics import YOLO
    from wandb.integration.ultralytics import add_wandb_callback
    
    wandb.login()
    wandb.init(project = 'Hand-Gestures-Detection', name = 'yolov8n_5',  job_type='training')
    
    model = YOLO("yolov8n.pt")
    
    add_wandb_callback(model, enable_model_checkpointing=True)
    model.train(data="HAND-GESTURE-DETECTION-1/data.yaml", 
                epochs=5,
                imgsz = 640,
                project = "Hand-Gestures-Detection",
                name = 'yolov8n_5'
                )
    1. Glenn JocherUltralytics

      @Pushtogithub23 to log all training metrics and media with Weights & Biases, ensure you have the latest versions of ultralytics and wandb installed. Also, verify that your Weights & Biases account is properly authenticated. For detailed setup instructions, visit the Weights & Biases integration guide.

  4. TJdeWetGitHub

    Hi!

    I am using wandb to do hyperparameter tuning. Is it possible to maximise validation mAP50? This seems to be maximising the training mAP50 if I am not mistaken?

    metric: name: mAP50 goal: maximise

    Otherwise should I do hyperparameter using something like this instead:

    metric: name: val/box_loss goal: minimize

    Thanks!

    1. Glenn JocherUltralytics(수정됨)

      Hi there!

      For your hyperparameter tuning in Weights & Biases, if you're aiming to maximize validation mAP50 specifically, I recommend adjusting your metric settings accordingly. To focus on validation mAP50, your metric configuration might look something like this:

      metric:
        name: metrics/mAP50(B)
        goal: maximize

      This setup ensures you're targeting the maximization of mAP50 on the validation data directly.

      Using val/box_loss with the goal to minimize can also be effective, especially if you prefer to focus on reducing the box prediction errors during validation:

      metric:
        name: val/box_loss
        goal: minimize

      Both approaches are valid and can be chosen based on your specific model performance goals. Hope this helps! If you have more questions, feel free to ask. 😊

    2. TJdeWetGitHub

      Hi Glenn,

      Thanks for getting back to me. I just tried it, and it doesn't seem that tuning to maximize val/mAP50 is working - the only metrics I see that are being logged are: cls, box, and dfl loss (both train and val), and metrics/mAP50(B), metrics/mAP50-75(B), metrics/Recall(B), and metrics/Precision(B), which I believe are the training metrics? I would like to log those same metrics for validation, and tune based on val/mAP50. Is there a way I can do this?

      Thanks!

    3. Glenn JocherUltralytics(수정됨)

      Hi there!

      In the Ultralytics W&B integration, validation metrics are logged automatically under names such as metrics/mAP50(B) and metrics/mAP50-95(B) (not val/mAP50; the val/ prefix is used for validation losses like val/box_loss). Use that name in your sweep config:

      metric:
        name: metrics/mAP50(B)
        goal: maximize

      Enable the integration with yolo settings wandb=True; no manual wandb.log() call is needed.

  5. JiyongBooGitHub

    Is it possible to train RT-DETR model with wandb? In add_wandb_callback() function, there are nothing about rt-detr. I tried replacing yolov8 with rt-detr in the example code. In the result, I confirmed that runs.summary["Validation-Table"] and runs.summary["Train-Table"] did not appear. How do I solve this problem?

    1. Paula DerrengerUltralytics(수정됨)

      @JiyongBoo hi there! 😊 RT-DETR trains with the same built-in Weights & Biases integration as other Ultralytics models, so you don't need add_wandb_callback() or manual wandb.log() calls. Enable it with yolo settings wandb=True, then train as usual:

      from ultralytics import RTDETR
      
      model = RTDETR("rtdetr-l.pt")
      model.train(data="coco8.yaml", epochs=5, project="ultralytics", name="rtdetr-l")

      See the Weights & Biases integration guide for details.

  6. DungHD-1997GitHub

    from ultralytics import YOLO from wandb.integration.ultralytics import add_wandb_callback import wandb def train(): wandb.login() project_name = "test_ai" # Step 1: Initialize a Weights & Biases run wandb.init(project=project_name, job_type="training",name="old_data")

    # Step 2: Define the YOLOv8 Model and Dataset
    model_name = "yolov8x"
    dataset_name = "C://Users//Administrator//project//yolov5_train_data//data//slant_2024.yaml"
    model = YOLO(f"{model_name}.pt")
    
    # Step 3: Add W&B Callback for Ultralytics
    add_wandb_callback(model, enable_model_checkpointing=True)
    model_name = "train_01"
    # Step 4: Train and Fine-Tune the Model
    model.train(project=project_name,name=model_name, data=dataset_name, epochs=100, imgsz=640, batch = 8)
    
    # Step 5: Validate the Model
    model.val()
    
    # Step 6: Perform Inference and Log Results
    #model(["path/to/image1", "path/to/image2"])
    
    # Step 7: Finalize the W&B Run
    wandb.finish()

    if name == "main": train() I used the above code to train custom data, but when using wandb, the GPU memory continuously increases over epochs until an out of memory error appears. program has been stopped. Error message: torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB. GPU 0 has a total capacity of 15.88 GiB of which 7.62 MiB is free. Of the allocated memory 14.53 GiB is allocated by PyTorch, and 103.44 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

    1. Glenn JocherUltralytics(수정됨)

      Hey there! It looks like you're encountering a memory issue related to using Weights & Biases (W&B) with YOLOv8, specifically the GPU running out of memory during training. This can happen for a few reasons, including excessive memory allocation by PyTorch or W&B logging mechanisms. Here are a couple of suggestions that might help:

      1. Reduce Batch Size: Lowering the batch size can significantly reduce memory usage. Although this might increase training time, it can help avoid out-of-memory errors.

        model.train(batch=4)  # Try reducing the batch size
      2. Clear CUDA Cache: Manually clearing the CUDA cache after each epoch might help release unused memory.

        import torch
        torch.cuda.empty_cache()
      3. Optimize Model and DataLoader: Ensure that your DataLoader is not the source of the memory leak, and try to optimize your model's memory usage.

      4. Disable W&B to isolate the cause: Run yolo settings wandb=False and train again; if the out-of-memory error persists, W&B is not the cause.

      Finally, consider profiling your code to identify specific lines or operations that cause the memory spike. PyTorch and W&B offer tools and documentation on best practices to optimize memory usage. 📘

      Hope this helps! If the issue persists, feel free to reach out with more details or check the W&B and YOLOv8 docs for more insights.

  7. danielst4GitHub

    Hey there, I am trying to make a sweep using WandB but cant quite put together where to insert what into the YOLO call, to use different hyperparameters and track them. Even though I found a site where one has done this he too doesnt describe what he had to do. I am not sure if it is more complicated than I think and if I really have to insert stuff into the training function or if there is an easy way to achieve this. I would be really greatful for help to know what exactly is necessary to make a WandB hyperparameter sweep with YOLO Thanks Daniel

    1. Paula DerrengerUltralytics(수정됨)

      Hey Daniel 👋,

      Great to hear you're exploring hyperparameter sweeps with WandB and YOLO! It's simpler than it might seem at first. Here's a quick guide to get you started:

      1. Initialize WandB: Before starting your training, make sure to log in to WandB in your script or notebook using:
        import wandb
        wandb.login()
      2. Set Up the Sweep: Define your sweep configuration in WandB, using Ultralytics training argument names for the hyperparameters. For example:
        method: random
        metric:
          name: val/box_loss
          goal: minimize
        parameters:
          lr0:
            min: 0.0001
            max: 0.001
          batch:
            values: [16, 32, 64]
      3. Integrate Sweep with YOLO: Enable the built-in integration with yolo settings wandb=True. If a W&B run is already active (as in a sweep agent), Ultralytics logs into it and keeps any config values the sweep already set.
        import wandb
        from ultralytics import YOLO
        
        
        def train():
            wandb.init(project="your_project_name")
            model = YOLO("yolov8n.pt")
            model.train(data="coco128.yaml", epochs=5, imgsz=640, lr0=wandb.config.lr0, batch=wandb.config.batch)
      4. Start the Sweep: Once everything is set up, you can start the sweep in WandB. This will iterate over the defined hyperparameter space, automatically logging each experiment's results.

      Remember, the key parts are enabling the W&B setting and making sure your sweep parameter names match Ultralytics training arguments.

      Hope this helps! If you have any more questions or run into issues, feel free to ask. Happy sweeping! 🚀

    2. danielst4GitHub

      Thank you Paula, this helped a lot! I can make a sweep now but I noticed that the values of the parameters which are given from the sweep to the script dont match the parameters used. Even though the command looks like this: wandb.wandb_agent - INFO - About to run command: /usr/bin/env python training_rtdetr.py --batch=8 --epochs=6 --imgsz=1280 --learning_rate=0.0007013348811086657 where "training_rtdetr.py" is a script with the code you gave me. (I am working with the RTDETR but it shouldnt make a difference as the metrics and calls are the same if I understand correctly?) But then after engine/trainer it says its using epochs=100 and it also uses that number for training. So just to be sure about a few things, I already logged in to WandB, I wrote a script with the code from your 3., I went to wandb, created a sweep there with the code from 2. + the line program: training_rtdetr.py and in a terminal I used the resulting call wandb agent [sweepid] Also I am kinda confused because you used "learning_rate" and "batch_size" but as far as I can tell these are not the parameters I can give for the training and they should be called "lr0" and "batch" respectively (which I both tried but they didnt work) I hope I provided all the necessary information otherwise just tell me what you need to know

    3. Paula DerrengerUltralytics

      @danielst4 hey Daniel,

      It sounds like you're on the right track with setting up your WandB sweep with YOLOv8! Regarding the mismatch in parameter values, it seems like there might be a discrepancy between the parameter names expected by your script and those defined in your WandB sweep configuration.

      For YOLOv8, the correct parameter names for learning rate and batch size are indeed lr0 and batch, respectively. If you're using these parameters in your training_rtdetr.py script, ensure they're correctly parsed from the command line arguments. Here's a quick Python snippet using argparse for reference:

      import argparse
      
      # Parse command line arguments
      parser = argparse.ArgumentParser()
      parser.add_argument('--batch', type=int, help='batch size')
      parser.add_argument('--epochs', type=int, help='number of epochs')
      parser.add_argument('--imgsz', type=int, help='image size')
      parser.add_argument('--learning_rate', type=float, help='learning rate')
      args = parser.parse_args()
      
      # Now you can use args.batch, args.epochs, etc., in your script

      Make sure your WandB sweep configuration uses the same parameter names as those your script expects. For example:

      program: training_rtdetr.py
      method: bayes
      metric:
        name: val/box_loss
        goal: minimize
      parameters:
        learning_rate:
          min: 0.0001
          max: 0.001
        batch:
          values: [8, 16, 32]
        epochs:
          value: 6
        imgsz:
          value: 1280

      If you've already done this and the issue persists, it might be helpful to double-check how your script handles these parameters and ensure they're being correctly applied to your YOLOv8 model configuration.

      Feel free to share more details if you're still encountering issues. We're here to help! 🚀

  8. J0ELhGitHub

    Is it possible to remove logging and only log progress in the command line? For my training process yolov8 seems to automatically connect with my wandb account and start logging. This process is very time-consuming so I'd like to know whether there's a flag like log = False or something like that.

    1. Glenn JocherUltralytics(수정됨)

      Hey there! 👋 If you're looking to disable automatic logging to Weights & Biases (W&B) during your YOLOv8 training to speed things up, you can do so by setting the wandb argument to False when initiating your training command. Here's how you can do it:

      yolo settings wandb=False

      This is a global Ultralytics setting, not a train argument, and it stops YOLOv8 from connecting to your W&B account and logging training progress there. Happy training! 🚀