mask-rcnn解读(一):clip_boxes_graph
此部分为mask-rcnn中clip_boxes_graph()函数的使用。首先利用代码解决基本函数的使用,然后运行代码,其细节如下:
代码如下:
import tensorflow as tf
import numpy as np
import random
sess=tf.Session()
window=[0.0,0.0,1.0,1.0] box_rand=np.array([round(random.random( ),1) for i in range(32)]).reshape((8,4)) # 随机生成[0,1]之间的数去模拟box坐标
box_rand=box_rand.astype(np.float32)
print('show box_rand=',box_rand) # 显示模拟的box wind_split=tf.split(window, 4)
wind_sp=sess.run(wind_split)
print('wind_split=',wind_sp) # 查看split的分割情况
print(np.array(wind_split).shape) # 打印维度
y1, x1, y2, x2 = tf.split(box_rand, 4, axis=1) # 表示延第二个维度分割成4个张量
y=sess.run(y1) # 显示第一个分割内容,其它语气类似
print('show value y1=',y) def clip_boxes_graph(boxes, window):
"""
boxes: [N, (y1, x1, y2, x2)]
window: [4] in the form y1, x1, y2, x2
"""
# Split
wy1, wx1, wy2, wx2 = tf.split(window, 4)
y1, x1, y2, x2 = tf.split(boxes, 4, axis=1)
# Clip
# 以y1为例,要求wy1 < y1 < wy2,其余类似,相当与x1/y1/x2/y2取值范围为[0,1]闭区间
y1 = tf.maximum(tf.minimum(y1, wy2), wy1)
x1 = tf.maximum(tf.minimum(x1, wx2), wx1)
y2 = tf.maximum(tf.minimum(y2, wy2), wy1)
x2 = tf.maximum(tf.minimum(x2, wx2), wx1)
clipped = tf.concat([y1, x1, y2, x2], axis=1, name="clipped_boxes")
clipped.set_shape((clipped.shape[0], 4))
return clipped clip=clip_boxes_graph(box_rand,window)
clip=sess.run(clip)
print('show function value clipped=',clip)
print('show function value shape clipped=',clip.shape) 结果如下:
show box_rand= [[0. 0.5 0.1 0.7]
[0.3 0.5 0.6 0.2]
[0.1 0.6 0.6 0.6]
[0.8 0.8 0.9 0.6]
[0.5 0.1 0.8 0.3]
[0.2 0.2 0.1 0.7]
[1. 0.3 1. 0.2]
[0.1 0.8 0. 0.1]]
wind_split= [array([0.], dtype=float32), array([0.], dtype=float32), array([1.], dtype=float32), array([1.], dtype=float32)]
(4,)
show value y1= [[0. ]
[0.3]
[0.1]
[0.8]
[0.5]
[0.2]
[1. ]
[0.1]]
show function value clipped= [[0. 0.5 0.1 0.7]
[0.3 0.5 0.6 0.2]
[0.1 0.6 0.6 0.6]
[0.8 0.8 0.9 0.6]
[0.5 0.1 0.8 0.3]
[0.2 0.2 0.1 0.7]
[1. 0.3 1. 0.2]
[0.1 0.8 0. 0.1]]
show function value shape clipped= (8, 4)
mask-rcnn解读(一):clip_boxes_graph的更多相关文章
- 目标检测论文解读11——Mask R-CNN
目的 让Faster R-CNN能做实例分割的任务. 方法 模型的结构图如下. 与Faster R-CNN相比,主要有两点变化. (1) 用RoI Align替代RoI Pool. 首先回顾一下RoI ...
- [Network Architecture]Mask R-CNN论文解析(转)
前言 最近有一个idea需要去验证,比较忙,看完Mask R-CNN论文了,最近会去研究Mask R-CNN的代码,论文解析转载网上的两篇博客 技术挖掘者 remanented 文章1 论文题目:Ma ...
- mask rcnn和roi-align
faster-rcnn的github源码中是round四舍五入 但kaiming he的ppt是直接取整 1.讲roi-align和roi-pooling区别并且详细阐述roi-align过程的博客: ...
- 论文笔记:Mask R-CNN
之前在一次组会上,师弟诉苦说他用 UNet 处理一个病灶分割的任务,但效果极差,我看了他的数据后发现,那些病灶区域比起整张图而言非常的小,而 UNet 采用的损失函数通常是逐像素的分类损失,如此一来, ...
- mask rcnn
Mask RCNN Mask RCNN 中主要改进是在faster rcnn中box regression 的branch 上加入mask prediction branch,能够得到点到点的预测. ...
- 论文阅读笔记三十六:Mask R-CNN(CVPR2017)
论文源址:https://arxiv.org/pdf/1703.06870.pdf 开源代码:https://github.com/matterport/Mask_RCNN 摘要 Mask R-CNN ...
- Mask RCNN 源码阅读(update)
之前看了Google官网的object_dectect 的源码,感觉Google大神写的还不错.最近想玩下Mask RCNN,就看了下源码,这里刚好当做总结和梳理.链接如下: Google官网的obj ...
- 目标检测网络之 Mask R-CNN
Mask R-CNN 论文Mask R-CNN(ICCV 2017, Kaiming He,Georgia Gkioxari,Piotr Dollár,Ross Girshick, arXiv:170 ...
- Mask RCNN 学习笔记
下面会介绍基于ResNet50的Mask RCNN网络,其中会涉及到RPN.FPN.ROIAlign以及分类.回归使用的损失函数等 介绍时所采用的MaskRCNN源码(python版本)来源于GitH ...
- [Object Tracking] **Mask R-CNN
From: 如何评价 Kaiming He 最新的 Mask R-CNN? 如何跟进这些人,是个能力,要慢慢掌握. https://github.com/CharlesShang/FastMaskRC ...
随机推荐
- JVM 对象查询语言(OQL)[转载]
最近生产环境出现一个很奇怪的问题,测试环境无法重现,本地直连生产无法重现.于是用上 jmap + Java VisualVM 的 OQL (Object Query Language) 分析问题. 关 ...
- Alpha版本1
这个作业属于哪个课程 https://edu.cnblogs.com/campus/xnsy/2019autumnsystemanalysisanddesign/ 这个作业要求在哪里 https:// ...
- Eclipse的server选项卡中找不到tomcat配置项
1.在Eclipse中,如果想开发j2ee,必须要先安装插件.至于具体的插件安装方法,这里不再赘述. 2.当进行到配置tomcat服务器的时候,有时候会出现这种情况: 3.在server选项卡的Run ...
- 创建war类型项目(六)
1. 创建maven project时选择packaging为war: 2. 在webapp文件夹下新建META-INF和WEB-INF/web.xml web.xml模板 <?xml vers ...
- Vue (表单、斗篷、条件、循环指令,分隔符成员、计算属性成员、属性的监听、vue组件、子组件、各个常见的钩子函数)
表单指令 <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF- ...
- LeetCode 112. Path Sum路径总和 (C++)
题目: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up ...
- angularjs 运行时报错ERROR in node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ';' expected. node_modules/rxjs/internal/types.d.ts(81,74): error TS1005: ';' expected. node_modules/rxjs/internal/t
解决方法: 在package.json文件里面 修改 "rxjs": "^6.0.0" 为 "rxjs": "6.0.0" ...
- JAVA基础概念(三)
JAVA方法入参和返回类型 方法入参 基础数据类型 引用数据类型 修饰符 返回类型 方法名(参数类型 参数名,参数类型 参数名...){//方法体return} 方法返回类型 return xxx 具 ...
- numpy cookbook
1.第一章 import numpy as np import matplotlib.pyplot as plt import scipy import PIL import scipy.misc l ...
- Redis删除特定前缀key的优雅实现
还在用keys命令模糊匹配删除数据吗?这就是一颗随时爆炸的炸弹! Redis中没有批量删除特定前缀key的指令,但我们往往需要根据前缀来删除,那么究竟该怎么做呢?可能你一通搜索后会得到下边的答案 re ...