Sfoglia il codice sorgente

change weights dir (wdir) to be unique to each run, under log_dir

5.0
Alex Stoken 4 anni fa
parent
commit
4418809cf5
1 ha cambiato i file con 11 aggiunte e 8 eliminazioni
  1. +11
    -8
      train.py

+ 11
- 8
train.py Vedi File

@@ -18,11 +18,6 @@ except:
print('Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex')
mixed_precision = False # not installed

wdir = 'weights' + os.sep # weights dir
os.makedirs(wdir, exist_ok=True)
last = wdir + 'last.pt'
best = wdir + 'best.pt'
results_file = 'results.txt'

# Hyperparameters
hyp = {'lr0': 0.01, # initial learning rate (SGD=1E-2, Adam=1E-3)
@@ -59,13 +54,21 @@ if hyp['fl_gamma']:


def train(hyp):
#write all results to the tb log_dir, so all data from one run is together
log_dir = tb_writer.log_dir

#weights dir unique to each experiment
wdir = os.path.join(log_dir, 'weights') + os.sep # weights dir

os.makedirs(wdir, exist_ok=True)
last = wdir + 'last.pt'
best = wdir + 'best.pt'
results_file = 'results.txt'

epochs = opt.epochs # 300
batch_size = opt.batch_size # 64
weights = opt.weights # initial training weights

#write all results to the tb log_dir, so all data from one run is together
log_dir = tb_writer.log_dir

# Configure
init_seeds(1)
with open(opt.data) as f:

Loading…
Annulla
Salva