glob search bug fix #77
This commit is contained in:
parent
ace56eb5b6
commit
c5966abba8
2
test.py
2
test.py
|
|
@ -255,7 +255,7 @@ if __name__ == '__main__':
|
|||
opt = parser.parse_args()
|
||||
opt.img_size = check_img_size(opt.img_size)
|
||||
opt.save_json = opt.save_json or opt.data.endswith('coco.yaml')
|
||||
opt.data = glob.glob('./**/' + opt.data, recursive=True)[0] # find file
|
||||
opt.data = check_file(opt.data) # check file
|
||||
print(opt)
|
||||
|
||||
# task = 'val', 'test', 'study'
|
||||
|
|
|
|||
4
train.py
4
train.py
|
|
@ -384,8 +384,8 @@ if __name__ == '__main__':
|
|||
parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset')
|
||||
opt = parser.parse_args()
|
||||
opt.weights = last if opt.resume else opt.weights
|
||||
opt.cfg = glob.glob('./**/' + opt.cfg, recursive=True)[0] # find file
|
||||
opt.data = glob.glob('./**/' + opt.data, recursive=True)[0] # find file
|
||||
opt.cfg = check_file(opt.cfg) # check file
|
||||
opt.data = check_file(opt.data) # check file
|
||||
print(opt)
|
||||
opt.img_size.extend([opt.img_size[-1]] * (2 - len(opt.img_size))) # extend to 2 sizes (train, test)
|
||||
device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
import torch.nn as nn
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,16 @@ def check_best_possible_recall(dataset, anchors, thr):
|
|||
'Compute new anchors with utils.utils.kmeans_anchors() and update model before training.' % bpr
|
||||
|
||||
|
||||
def check_file(file):
|
||||
# Searches for file if not found locally
|
||||
if os.path.isfile(file):
|
||||
return file
|
||||
else:
|
||||
files = glob.glob('./**/' + file, recursive=True) # find file
|
||||
assert len(files), 'File Not Found: %s' % file # assert file was found
|
||||
return files[0] # return first file if multiple found
|
||||
|
||||
|
||||
def make_divisible(x, divisor):
|
||||
# Returns x evenly divisble by divisor
|
||||
return math.ceil(x / divisor) * divisor
|
||||
|
|
|
|||
Loading…
Reference in New Issue