Skip to content

Commit

Permalink
Fix issue #445
Browse files Browse the repository at this point in the history
  • Loading branch information
jkjung-avt committed Jul 3, 2021
1 parent 549d50b commit 9665269
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions eval_yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,14 @@ def generate_results(trt_yolo, imgs_dir, jpgs, results_file, non_coco):
def main():
args = parse_args()
check_args(args)
if args.category_num <= 0:
raise SystemExit('ERROR: bad category_num (%d)!' % args.category_num)
if not os.path.isfile('yolo/%s.trt' % args.model):
raise SystemExit('ERROR: file (yolo/%s.trt) not found!' % args.model)

results_file = 'yolo/results_%s.json' % args.model

yolo_dim = args.model.split('-')[-1]
if 'x' in yolo_dim:
dim_split = yolo_dim.split('x')
if len(dim_split) != 2:
raise SystemExit('ERROR: bad yolo_dim (%s)!' % yolo_dim)
w, h = int(dim_split[0]), int(dim_split[1])
else:
h = w = int(yolo_dim)
if h % 32 != 0 or w % 32 != 0:
raise SystemExit('ERROR: bad yolo_dim (%s)!' % yolo_dim)

trt_yolo = TrtYOLO(args.model, (h, w), args.category_num, args.letter_box)
trt_yolo = TrtYOLO(args.model, args.category_num, args.letter_box)

jpgs = [j for j in os.listdir(args.imgs_dir) if j.endswith('.jpg')]
generate_results(trt_yolo, args.imgs_dir, jpgs, results_file,
Expand Down

0 comments on commit 9665269

Please sign in to comment.