From ed9cd3c458f1e61145c1b10f87bd37cba53233cd Mon Sep 17 00:00:00 2001 From: akanazawa Date: Wed, 1 May 2019 18:41:19 -0700 Subject: [PATCH] minor chnages in demo.py so only images in the specified directory (not deeper) gets ran --- demo.py | 7 +++++-- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/demo.py b/demo.py index b33b2033..fc57c55f 100644 --- a/demo.py +++ b/demo.py @@ -7,6 +7,7 @@ import torch.utils.data import numpy as np from opt import opt +from glob import glob from dataloader import ImageLoader, DetectionLoader, DetectionProcessor, DataWriter, Mscoco from yolo.util import write_results, dynamic_write_results @@ -36,8 +37,10 @@ if len(inputlist): im_names = open(inputlist, 'r').readlines() elif len(inputpath) and inputpath != '/': - for root, dirs, files in os.walk(inputpath): - im_names = files + # @kanazawa: only run on images in the directory. + im_names = sorted(glob(inputpath + '/*.png')) + # for root, dirs, files in os.walk(inputpath): + # im_names = files else: raise IOError('Error: must contain either --indir/--list') diff --git a/requirements.txt b/requirements.txt index 6e1f58e0..06b51fad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,4 @@ pandas tqdm matplotlib opencv-python -ntpath +#ntpath