READING NOTE: FastMask: Segment Multi-scale Object Candidates in One Shot

提出了一种名为FastMask的新框架,能够在近乎实时的情况下实现高效的多尺度训练和推理,达到当前最佳精度水平。该框架包含了一个新颖的权重共享残差颈模块和一个注意力头模块,前者能够缩放CNN的特征图并保持校准的特征语义,后者通过利用注意力模型显著减少背景噪声。

TITLE: FastMask: Segment Multi-scale Object Candidates in One Shot

AUTHOR: Hexiang Hu, Shiyi Lan, Yuning Jiang, Zhimin Cao, Fei Sha

ASSOCIATION: UCLA, Fudan University, Megvii Inc.

FROM: arXiv:1703.03872

CONTRIBUTIONS

  1. A novel weight-shared residual neck module is proposed to zoom out feature maps of CNN while preserving calibrated feature semantics, which enables efficient multi-scale training and inference.
  2. A novel scale-tolerant head module is proposed which takes advantage of attention model and significantly reduces the impact of background noises caused by unmatched receptive fields.
  3. A framework capable for one-shot segment proposal is made up, namely FastMask. The proposed framework achieves the the state-of-the-art results in accuracy while running in near real time on MS COCO benchmark.

METHOD

Network Architecture

The network architecture is illustrated in the following figure.

With the base feature map, a shared neck module is applied recursively to build feature maps with different scales. These feature maps are then fed to a one-by-one convolution to reduce their feature dimensionality. Then we extract dense sliding windows from those feature maps and do a batch normalization across all windows to calibrate and redistribute window feature maps. With a feature map downscaled by factor m , a sliding window of size (k,k) corresponds to a patch of (m×k,m×k) at original image. Finally, a unified head module is used to decode these window features and produce the output confidence score as well as object mask.

Residual Neck

The neck module is actually used to downscale the feature maps so that features with different scales can be extracted.

There are another two choices. One is Max pooling neck, which produces uncalibrated feature in encoding pushing the mean of downscaled feature higher than original. The other one is Average pooling neck, which smoothes out discriminative feature during encoding, making the top feature maps appear to be blurry.

Residual neck is then proposed to learn parametric necks that preserve feature semantics. The following figure illustrates the method.

Attentional Head

Given the feature map of a sliding window as the input, a spatial attention is generated through a fully connected layer, which takes the entire window feature to generate the attention score for each spatial location on the feature map. The spatial attention is then applied to window feature map via the element-wise multiplication across channels. Such operation enables the head module to enhance features on the salient region, where is supposed to be the rough location of the target object. Finally, the enhanced feature map will be fed into a fully connected laye to decode the segmentation mask of the object. This module is illustrated in the following figure.

The feature pyramid is sparse in this work because of the downscale operation. The sparse feature pyramid raises the probability that there exists no suitable feature maps for an object to decode, and also raises the risk of introducing background noises when the object is decoded from an unsuitable feature map with too larger receptive field. So salient region is introduced in this head. With the capability of paying attention to the salient region, a decoding head could reduce the noises from the backgrounds of a sliding window and thus produce high quality segmentation results when the receptive field is unmatched with the scale of object. Also the salient region attention has the tolerance to shift disturbance.

SOME IDEAS

  1. This work shares the similar idea with most one-shot alogrithms, extracting sliding window in the feature map and endcode them with a following network.
  2. How to extract sliding windows?
<think>我们面对的问题:在YAML配置文件中,属性名(key)包含冒号(:)时,如何正确编写配置以避免解析错误。 用户提供的配置片段中,出现了如下的属性名: - manager:topo:osw:fdb: - identityaccess:tenant:sessionid: - ecsp:device.server.route: 问题分析: 在YAML中,冒号(:)通常用于键值对的分隔(key: value)。如果属性名(key)本身包含冒号,那么解析器可能会将冒号误认为是分隔符,导致解析错误。 解决方案: 根据YAML规范,当键(key)包含特殊字符(如冒号、空格等)时,必须用引号将整个键名括起来,以避免歧义。 具体步骤: 1. 将包含冒号的属性名用引号(单引号或双引号)包裹。 2. 注意:如果属性名中已经包含引号,则需要根据情况使用不同类型的引号或使用转义。 以用户配置中的 `manager:topo:osw:fdb:` 为例,应该写成: "manager:topo:osw:fdb:": 同理,其他包含冒号的属性名也应该这样处理。 修改后的配置示例: ```yaml cache: enable-delete-key-by-prefix: true # 注意,这里的属性名包含多个连接符,但不需要引号,因为没有特殊字符 delete-key-by-prefix-cache-name-set: - "monitor:insight:routing:osw" # 列表项是字符串,且包含冒号,所以需要引号 - "monitor:insight:routing:osg" - "monitor:insight:ddns" - "monitor:insight:portforwarding:upnp" - "monitor:insight:portforwarding:user" - "manager.device:device.controller.omadac.refer" # 这里也有冒号,需要引号 - "portal:radius" default-config: #选填,全局默认配置 segment-count: 16 #指定缓存分片数,必须指定 capacity: 1048576 #指定缓存可包含的最大容量,必须指定 compression-strategy: false global-cache: #选填,全局默认缓存 segment-count: 16 #指定缓存分片数,必须指定 capacity: 10000 #指定缓存可包含的最大容量,必须指定 compression-strategy: false cache-names: #选填,单独配置各个cacheName的参数,不配置则统一使用defaultConfig配置参数 "manager:topo:osw:fdb:": # 注意:这里属性名包含冒号,所以用引号括起来 segment-count: 16 capacity: 1048576 # 1Mb compression-strategy: true "identityaccess:tenant:sessionid:": # 同样处理 segment-count: 16 capacity: 1000000 # 1Mb compression-strategy: false "ecsp:device.server.route:": # 同样处理 segment-count: 16 capacity: 100000 # 0.1Mb compression-strategy: false ``` 解释: - 在 `delete-key-by-prefix-cache-name-set` 下的列表项,由于每个项都是字符串,且包含冒号,所以每个字符串都需要引号。 - 在 `cache-names` 下,每个属性名(key)都是一个包含冒号的字符串,因此整个属性名必须用引号括起来。 注意事项: - 如果使用双引号,则字符串内部的双引号需要用反斜杠转义(\")。 - 单引号内不支持转义,所以如果字符串内包含单引号,则需要使用两个单引号来表示(''),或者使用双引号。 验证: 可以使用在线YAML解析工具(如:https://yaml-online-parser.appspot.com/)来验证配置是否正确解析。 补充说明: 在YAML中,如果键(key)只包含字母、数字和下划线,通常不需要引号。但是,当键包含冒号、空格、连字符(在特定位置)等特殊字符时,必须使用引号。 关于用户配置中的其他属性(如`enable-delete-key-by-prefix`)虽然包含连字符,但不需要引号,因为连字符在键名中是允许的,只要整个键名没有被解析器误认为是其他结构(如列表)即可。不过,为了清晰,也可以使用引号,但非必需。 因此,我们只需要对包含冒号的键名和字符串值进行引号包裹即可。 相关问题: 用户之前的问题是关于字符串值中的冒号,而这次是关于键名中的冒号,但解决方案相同:使用引号包裹。 </think>### 解决 YAML 中键名包含冒号的配置问题 在您的缓存配置中,当键名包含冒号(如 `manager:topo:osw:fdb:`)时,YAML 解析器会将其视为嵌套结构而非完整键名。以下是完整的解决方案: #### 解决方案:用引号包裹键名 ```yaml cache: enable-delete-key-by-prefix: true delete-key-by-prefix-cache-name-set: - "monitor:insight:routing:osw" # 字符串值用引号 - "monitor:insight:routing:osg" - "monitor:insight:ddns" - "monitor:insight:portforwarding:upnp" - "monitor:insight:portforwarding:user" - "manager.device:device.controller.omadac.refer" - "portal:radius" default-config: segment-count: 16 capacity: 1048576 compression-strategy: false global-cache: segment-count: 16 capacity: 10000 compression-strategy: false cache-names: "manager:topo:osw:fdb:": # 关键!键名用双引号包裹 segment-count: 16 capacity: 1048576 compression-strategy: true "identityaccess:tenant:sessionid:": # 键名用引号 segment-count: 16 capacity: 1000000 compression-strategy: false "ecsp:device.server.route:": # 键名用引号 segment-count: 16 capacity: 100000 compression-strategy: false ``` #### 关键修改说明: 1. **键名引号规则**: - 所有包含冒号的键名(如 `manager:topo:osw:fdb:`)必须用**双引号**包裹 - 示例:`"manager:topo:osw:fdb:"` 而非 `manager:topo:osw:fdb:` 2. **值引号规则**: - 列表中的字符串值(如 `monitor:insight:routing:osw`)也需要引号 - 示例:`- "monitor:insight:routing:osw"` 3. **解析原理**: - 冒号在 YAML 中是**保留字符**,表示键值对分隔 - 引号强制将 `a:b:c` 识别为**单一字符串**而非嵌套结构 - 无引号时:`key1:key2: value` → 解析为 `{key1: {key2: value}}` - 有引号时:`"key1:key2": value` → 解析为 `{"key1:key2": value}` #### 其他注意事项: 1. **引号类型选择**: - 优先使用双引号(允许转义字符) - 包含双引号时:`"contains \"quote\""` - 单引号需转义单引号:`'It''s single quote'` 2. **Spring Boot 特殊处理**: 在 `@ConfigurationProperties` 类中,使用带冒号的键名需配合注解: ```java @ConfigurationProperties(prefix = "cache") public class CacheConfig { @NestedConfigurationProperty private Map<String, CacheSetting> cacheNames; // 自动映射带冒号的键 } ``` 3. **解析验证工具**: 使用在线 YAML 解析器验证:[YAML Lint](https://www.yamllint.com/) > ⚠️ **重要提示**:修改后重启应用,并通过日志确认配置加载是否正确: > ```log > Loaded cache: manager:topo:osw:fdb: {capacity=1048576, ...} > ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值