我正在尝试导出边界框并将其保存到文件中,以供以后在对象分类中使用使用Tensorflow 2

问题描述

Tree with leaf detection

我已经尝试了几种解决方案,但是所有解决方案都倾向于仅提取数字或灰色和黑色。 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 (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...