Pārlūkot izejas kodu

val.py `--weights` and `--data` compatibility check (#7292)

Improved error messages for understanding of user error with val.py. May help https://github.com/ultralytics/yolov5/issues/7291
modifyDataloader
Glenn Jocher GitHub pirms 2 gadiem
vecāks
revīzija
d2e7ba2a3a
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. +4
    -0
      val.py

+ 4
- 0
val.py Parādīt failu

@@ -162,6 +162,10 @@ def run(

# Dataloader
if not training:
if pt and not single_cls: # check --weights are trained on --data
ncm = model.model.yaml['nc']
assert ncm == nc, f'{weights[0]} ({ncm} classes) trained on different --data than what you passed ({nc} ' \
f'classes). Pass correct combination of --weights and --data that are trained together.'
model.warmup(imgsz=(1 if pt else batch_size, 3, imgsz, imgsz)) # warmup
pad = 0.0 if task in ('speed', 'benchmark') else 0.5
rect = False if task == 'benchmark' else pt # square inference for benchmarks

Notiek ielāde…
Atcelt
Saglabāt