如何解决我正在尝试导出边界框并将其保存到文件中,以供以后在对象分类中使用使用Tensorflow 2
我已经尝试了几种解决方案,但是所有解决方案都倾向于仅提取数字或灰色和黑色。 This is one of the solutions I have tried. Here is the second set
# Test image Directory
image_dir = 'C:/Users/tbrau/Documents/SeniorProject/TensorFlow/workspace/training_demo-
/images/test/LeafType1Test'
elapsed = []
for i in range(5):
image_path = os.path.join(image_dir,'out' + str(i + 1) + '.jpg')
image_np = load_image_into_numpy_array(image_path)
input_tensor = np.expand_dims(image_np,0)
start_time = time.time()
detections = detect_fn(input_tensor)
end_time = time.time()
elapsed.append(end_time - start_time)
plt.rcParams['figure.figsize'] = [100,100]
label_id_offset = 1
image_np_with_detections = image_np.copy()
viz_utils.visualize_Boxes_and_labels_on_image_array(
image_np_with_detections,detections['detection_Boxes'][0].numpy(),detections['detection_classes'][0].numpy().astype(np.int32),detections['detection_scores'][0].numpy(),category_index,use_normalized_coordinates=True,max_Boxes_to_draw=200,min_score_thresh=.40,agnostic_mode=False)
plt.imsave(str(i) + '.jpg',image_np_with_detections)
plt.subplot(5,1,i+1)
plt.imshow(image_np_with_detections)
plt.savefig('LeafType1.jpg')
mean_elapsed = sum(elapsed) / float(len(elapsed))
print('Elapsed time: ' + str(mean_elapsed) + ' second per image')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。