Skip to content

Testing can be done on the whole batch of images. #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from utils import draw_boxes
from frontend import YOLO
import json
import glob

os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
Expand Down Expand Up @@ -83,13 +84,20 @@ def _main_(args):
video_reader.release()
video_writer.release()
else:
image = cv2.imread(image_path)
boxes = yolo.predict(image)
image = draw_boxes(image, boxes, config['model']['labels'])

print(len(boxes), 'boxes are found')
for fnamee in glob.glob(image_path+"*.jpg"):
cache=fnamee.split("/")[0]
fname=fnamee.split("/")[-1]



image = cv2.imread(fnamee)
boxes = yolo.predict(image)
image = draw_boxes(image, boxes, config['model']['labels'])

cv2.imwrite(image_path[:-4] + '_detected' + image_path[-4:], image)
print(len(boxes), 'boxes are found')


cv2.imwrite(cache+"/"+fname[:-4] + '_detected' + fname[-4:], image)

if __name__ == '__main__':
args = argparser.parse_args()
Expand Down