iglob file-search improvements

This commit is contained in:
Glenn Jocher 2020-05-16 22:25:21 -07:00
parent 27c7b02fff
commit 37bd5490ef
3 changed files with 9 additions and 0 deletions

View File

@ -183,6 +183,9 @@ if __name__ == '__main__':
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS') parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
parser.add_argument('--augment', action='store_true', help='augmented inference') parser.add_argument('--augment', action='store_true', help='augmented inference')
opt = parser.parse_args() opt = parser.parse_args()
opt.cfg = list(glob.iglob('./**/' + opt.cfg, recursive=True))[0] # find file
opt.names = list(glob.iglob('./**/' + opt.names, recursive=True))[0] # find file
opt.weights = list(glob.iglob('./**/' + opt.weights, recursive=True))[0] # find file
print(opt) print(opt)
with torch.no_grad(): with torch.no_grad():

View File

@ -242,6 +242,9 @@ if __name__ == '__main__':
parser.add_argument('--augment', action='store_true', help='augmented inference') parser.add_argument('--augment', action='store_true', help='augmented inference')
opt = parser.parse_args() opt = parser.parse_args()
opt.save_json = opt.save_json or any([x in opt.data for x in ['coco.data', 'coco2014.data', 'coco2017.data']]) opt.save_json = opt.save_json or any([x in opt.data for x in ['coco.data', 'coco2014.data', 'coco2017.data']])
opt.weights = list(glob.iglob('./**/' + opt.weights, recursive=True))[0] # find file
opt.cfg = list(glob.iglob('./**/' + opt.cfg, recursive=True))[0] # find file
opt.data = list(glob.iglob('./**/' + opt.data, recursive=True))[0] # find file
print(opt) print(opt)
# task = 'test', 'study', 'benchmark' # task = 'test', 'study', 'benchmark'

View File

@ -251,6 +251,7 @@ def train(hyp):
if 'momentum' in x: if 'momentum' in x:
x['momentum'] = np.interp(ni, [0, n_burn], [0.9, hyp['momentum']]) x['momentum'] = np.interp(ni, [0, n_burn], [0.9, hyp['momentum']])
# Multi-Scale # Multi-Scale
if opt.multi_scale: if opt.multi_scale:
if ni / accumulate % 1 == 0: #  adjust img_size (67% - 150%) every 1 batch if ni / accumulate % 1 == 0: #  adjust img_size (67% - 150%) every 1 batch
@ -396,6 +397,8 @@ if __name__ == '__main__':
opt = parser.parse_args() opt = parser.parse_args()
opt.weights = last if opt.resume else opt.weights opt.weights = last if opt.resume else opt.weights
check_git_status() check_git_status()
opt.cfg = list(glob.iglob('./**/' + opt.cfg, recursive=True))[0] # find file
opt.data = list(glob.iglob('./**/' + opt.data, recursive=True))[0] # find file
print(opt) print(opt)
opt.img_size.extend([opt.img_size[-1]] * (3 - len(opt.img_size))) # extend to 3 sizes (min, max, test) opt.img_size.extend([opt.img_size[-1]] * (3 - len(opt.img_size))) # extend to 3 sizes (min, max, test)
device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size) device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size)