yizt / keras-faster-rcnn

keras实现faster rcnn,end2end训练、预测; 持续更新中,见todo... ;欢迎试用、关注并反馈问题
87 stars 36 forks source link

您好,如果想预测出测试集图片后把所有的预测结果图片保存到一个文件夹,不是随机展示,该怎么改呢 #36

Open Wangcancan1127 opened 3 years ago

Wangcancan1127 commented 3 years ago

您好,想问一下如果想预测出测试集图片后把所有的预测结果图片保存到一个文件夹,不是随机展示,该怎么改呢,希望您能回复,非常感激您

yizt commented 3 years ago

@Wangcancan1127 在displayinstances函数中,将`, ax = plt.subplots(1, figsize=figsize)改为,fig, ax = plt.subplots(1, figsize=figsize)`,并返回fig; 然后每个fig保存就好

Wangcancan1127 commented 3 years ago

你好我改了
if not ax: fig, ax = plt.subplots(1, figsize=figsize) auto_show = True return fig 但是inference.py里面也要改吧 image_ids = np.random.choice(len(all_img_info), 9, replace=False) fig = plt.figure(figsize=(20, 20)) for idx, image_id in enumerate(image_ids): ax = fig.add_subplot(3, 3, idx + 1) _show_inference(image_id, ax) fig.savefig('demo_images/inferece_examples.{}.png'.format(np.random.randint(10))) 这块也需要改吧