修改yolo_video.py:
直接上代码:
if FLAGS.image:
"""
Image detection mode, disregard any remaining command line arguments
"""
print("Image detection mode")
if "input" in FLAGS:
print(" Ignoring remaining command line arguments: " + FLAGS.input + "," + FLAGS.output)
detect_xml(YOLO(**vars(FLAGS)))
# detect_img(YOLO(**vars(FLAGS)))
def detect_xml(yolo):
llist=get_all_file('/home/user07/MyProjects/yolo/keras-yolo3-master/datasets/tjzt/JPEGImages')
folder='/home/user07/MyProjects/yolo/keras-yolo3-master/datasets/tjPersonXml'
num_count=0
for index in range(len(llist)):
img=llist[index]
image = Image.open(img)
lxml=os.path.join(folder,os.path.splitext(img.split('/')[-1])[0])
r_image = yolo.detect_xml(image,lxml)
num_count +=1
print('这是第%d张图'%num_count)
yolo.close_session()
修改yolo.py:
def detect_xml(self, image,lxml):
start = timer()
if self.model_image_size != (None, None):
assert self.model_image_size[0]%32 == 0, 'Multiples of 32 required'
assert self.model_image_size[1]%32 &