Skip to content

Commit

Permalink
Update plot_lr_scheduler() (ultralytics#5864)
Browse files Browse the repository at this point in the history
shallow copy modify originals
  • Loading branch information
daikankan authored Dec 3, 2021
1 parent f45cee0 commit 756a91e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import math
import os
from copy import copy
from copy import deepcopy
from pathlib import Path

import cv2
Expand Down Expand Up @@ -243,7 +243,7 @@ def plot_images(images, targets, paths=None, fname='images.jpg', names=None, max

def plot_lr_scheduler(optimizer, scheduler, epochs=300, save_dir=''):
# Plot LR simulating training for full epochs
optimizer, scheduler = copy(optimizer), copy(scheduler) # do not modify originals
optimizer, scheduler = deepcopy(optimizer), deepcopy(scheduler) # do not modify originals
y = []
for _ in range(epochs):
scheduler.step()
Expand Down

0 comments on commit 756a91e

Please sign in to comment.