Set a seed of generator with an option for more randomness when training several models with different seeds (#10486)

* set seed with parameter

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>

* make seed to be a large number

* set seed with a parameter

* set a seed of dataloader with opt for more randomness

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Yonghye KwonandGlenn Jocher authored and GitHub committed 2022-12-19 10:27:34 +01:00
1 parent b2a0f1cdc5
commit 10e93d295f
3 files changed
+8 -5

No files matched your search

+2 -1
View File
@@ -198,7 +198,8 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio
image_weights=opt.image_weights,
quad=opt.quad,
prefix=colorstr('train: '),
shuffle=True)
shuffle=True,
seed=opt.seed)
labels = np.concatenate(dataset.labels, 0)
mlc = int(labels[:, 0].max()) # max label class
assert mlc < nc, f'Label class {mlc} exceeds nc={nc} in {data}. Possible class labels are 0-{nc - 1}'