Add callbacks (#7315)
* Add `on_train_start()` callback * Update * Update
This commit is contained in:
1 parent
32661f75ac
commit
245d6459a9
3 files changed
+12
No files matched your search
@@ -188,8 +188,10 @@ def run(
|
||||
dt, p, r, f1, mp, mr, map50, map = [0.0, 0.0, 0.0], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
|
||||
loss = torch.zeros(3, device=device)
|
||||
jdict, stats, ap, ap_class = [], [], [], []
|
||||
callbacks.run('on_val_start')
|
||||
pbar = tqdm(dataloader, desc=s, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
|
||||
for batch_i, (im, targets, paths, shapes) in enumerate(pbar):
|
||||
callbacks.run('on_val_batch_start')
|
||||
t1 = time_sync()
|
||||
if cuda:
|
||||
im = im.to(device, non_blocking=True)
|
||||
@@ -260,6 +262,8 @@ def run(
|
||||
f = save_dir / f'val_batch{batch_i}_pred.jpg' # predictions
|
||||
Thread(target=plot_images, args=(im, output_to_target(out), paths, f, names), daemon=True).start()
|
||||
|
||||
callbacks.run('on_val_batch_end')
|
||||
|
||||
# Compute metrics
|
||||
stats = [np.concatenate(x, 0) for x in zip(*stats)] # to numpy
|
||||
if len(stats) and stats[0].any():
|
||||
|
||||
Reference in new issue
Block a user