Skip to content

Commit

Permalink
Added prints for extra run info
Browse files Browse the repository at this point in the history
  • Loading branch information
manole-alexandru committed Mar 10, 2023
1 parent 85f3dc9 commit a3da843
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,15 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio
else:
model = Model(cfg, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create

'''
Extra model print
'''
layers = [module for module in model.modules() if not isinstance(module, nn.Sequential)]
for layer in layers:
print(layer)
assert(False)

'''
end
'''
amp = check_amp(model) # check AMP

# Freeze
Expand Down
6 changes: 6 additions & 0 deletions utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def __init__(self,
nl = len(np.concatenate(labels, 0)) # number of labels
assert nl > 0 or not augment, f'{prefix}All labels empty in {cache_path}, can not start training. {HELP_URL}'
self.labels = list(labels)
print('Labels:', self.labels)
self.shapes = np.array(shapes)
self.im_files = list(cache.keys()) # update
self.label_files = img2label_paths(cache.keys()) # update
Expand All @@ -516,6 +517,8 @@ def __init__(self,
include = np.array([len(x) >= min_items for x in self.labels]).nonzero()[0].astype(int)
LOGGER.info(f'{prefix}{n - len(include)}/{n} images filtered from dataset')
self.im_files = [self.im_files[i] for i in include]
print('IMFILES', self.im_files[0])
print('INCLUDE', include)
self.label_files = [self.label_files[i] for i in include]
self.labels = [self.labels[i] for i in include]
self.segments = [self.segments[i] for i in include]
Expand Down Expand Up @@ -547,6 +550,7 @@ def __init__(self,
s = self.shapes # wh
ar = s[:, 1] / s[:, 0] # aspect ratio
irect = ar.argsort()
print('IRECT:', irect)
self.im_files = [self.im_files[i] for i in irect]
self.label_files = [self.label_files[i] for i in irect]
self.labels = [self.labels[i] for i in irect]
Expand Down Expand Up @@ -580,7 +584,9 @@ def __init__(self,
for i, x in pbar:
if cache_images == 'disk':
b += self.npy_files[i].stat().st_size
print('DISK')
else: # 'ram'
print('RAM')
self.ims[i], self.im_hw0[i], self.im_hw[i] = x # im, hw_orig, hw_resized = load_image(self, i)
b += self.ims[i].nbytes
pbar.desc = f'{prefix}Caching images ({b / gb:.1f}GB {cache_images})'
Expand Down

0 comments on commit a3da843

Please sign in to comment.