diff --git a/train.py b/train.py index 174d9763..10f9e578 100644 --- a/train.py +++ b/train.py @@ -122,6 +122,10 @@ def train( else: cutoff = load_darknet_weights(model, weights + 'darknet53.conv.74') + # Remove old results + for f in glob.glob('*_batch*.jpg') + glob.glob('results.txt'): + os.remove(f) + # Scheduler https://github.com/ultralytics/yolov3/issues/238 # lf = lambda x: 1 - x / epochs # linear ramp to zero # lf = lambda x: 10 ** (hyp['lrf'] * x / epochs) # exp ramp @@ -170,10 +174,6 @@ def train( from apex import amp model, optimizer = amp.initialize(model, optimizer, opt_level='O1') - # Remove old results - for f in glob.glob('*_batch*.jpg') + glob.glob('results.txt'): - os.remove(f) - # Start training model.hyp = hyp # attach hyperparameters to model model.class_weights = labels_to_class_weights(dataset.labels, nc).to(device) # attach class weights