tensorflow在图像中加入标注框
来源:互联网 发布:淘宝 充话费 退款 编辑:程序博客网 时间:2024/06/17 08:58
tensorflow提供了给图像加入标注框的函数。tf.image.draw_bounding_boxes(img, boxes).img是目标图像,不过需要变成四维,增加一个维度,利用tf.expand_dims函数,这个函数。boxes是一个三维的数组,里面的元素有4个维度,分别表示框的位置,这些数值是相对位置,
例如:
import matplotlib.pyplot as plt;import tensorflow as tf;image_raw_data_jpg = tf.gfile.FastGFile('11.jpg', 'r').read()with tf.Session() as sess:img_data_jpg = tf.image.decode_jpeg(image_raw_data_jpg)img_data_jpg = tf.expand_dims(tf.image.convert_image_dtype(img_data_jpg, dtype=tf.float32), 0)boxes = tf.constant([[[0.05, 0.5, 0.9, 0.7]]])result = tf.image.draw_bounding_boxes(img_data_jpg, boxes)# print sess.run(img_data_jpg).shapeplt.figure(1)plt.imshow(result.eval().reshape([1200, 1920, 3]))plt.show()
结果:
阅读全文
2 0
- tensorflow在图像中加入标注框
- TensorFlow学习--tensorflow图像处理--添加标注框
- Tensorflow 在损失函数中加入正则项(Normalization)
- 用百度地图的API画多边形,并在多边形中加入文本标注
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在Asp.net中为图像加入版权信息
- 在ASP.NET中为图像加入版权信息
- Qt中使用QCharts基础总结
- BLE协议栈 – ATT
- 记录学习过程中的疑问和解决方案,不断提高自己
- LeetCode
- linux-vim基本命令
- tensorflow在图像中加入标注框
- 数据库连接字符串大全
- 从文件中读取数据
- 『ORACLE』 DBLINK(11g)
- 数组指针和指针数组的区别
- 新闻客户端——SmartImageView——AsyncHttpClient
- Intent和Intent过滤器
- JavaWeb会话管理之用户上次访问时间
- 搜索算法总结