READING NOTE: Face Detection with End-to-End Integration of a ConvNet and a 3D Model

本文提出了一种简单而有效的方法,将卷积神经网络(ConvNet)与三维模型进行端到端集成,并使用多任务损失函数进行人脸检测。该方法解决了在野外环境下更快的RCNN用于人脸检测时存在的两个限制:通过利用三维模型消除了锚点框的启发式设计;用配置池化代替了通用且预定义的区域兴趣池化,充分利用了潜在的对象结构配置。

TITLE: Face Detection with End-to-End Integration of a ConvNet and a 3D Model

AUTHOR: Yunzhu Li, Benyuan Sun, Tianfu Wu, Yizhou Wang

ASSOCIATION: Peking University, North Carolina State University

FROM: arXiv:1606.00850

CONTRIBUTIONS

  1. It presents a simple yet effective method to integrate a ConvNet and a 3D model in an end-to-end learning with multi-task loss used for face detection in the wild.
  2. It addresses two limitations in adapting the state-of-the-art faster-RCNN for face detection: eliminating the heuristic design of anchor boxes by leveraging a 3D model, and replacing the generic and predefined RoI pooling with a configuration pooling which exploits the underlying object structural configurations.
  3. It obtains very competitive state-of-the-art performance in the FDDB and AFW benchmarks.

METHOD

The main scheme of inferring is shown in the following figure.

The input image is sent into a ConvNet, e.g. VGG, with an upsampling layer. Then the network will generate face proposals based on the score of summing the log probability of the keypoints, which is predicted by the predefined 3D face model.

some details

  1. The loss of keypoint labels is defined as

    Lcls(ω)=12mi=12mlog(pxili)

    where ω stands for the learnable weights of ConvNet, m is the number of the keypoints, and pxili is the probability of the point in location xi , which can be obtained by annotations, belongs to label li .

  2. The loss of keypoit locations is defined as

    Lptloc(ω)=1m2i=1mi=1mt{x,y}Smooth(tit^i,j)

    where smooth() is the smooth l1 loss. For each ground-truth keypoint, we can generate a set of predicted keypoints based on the 3D face model and the 3D transformation parameters. If for each face we have m keypoints, then we will generate m sets of predicted keypoints. For each keypoint, m locations will be predicted.

  3. The Configuration Pooling Layer is similar to the ROI Pooling Layer in faster-RCNN. Features are extracted based on the locations and relations of the keypoints, rather than based on the predefined perceptive field.
<think>我们收到了一个关于JSON解析错误的用户查询。用户遇到了"Unexpected end-of-input within/between Object entries"错误,并且嵌套异常是com.fasterxml.jackson.core.JsonParseException。根据用户提供的引用和问题描述,我们将分析可能的原因并提供解决方案。 引用[1]提到错误是由于JSON格式错误,具体是在对象末尾多了一个逗号。例如: ```json { "key": "value", } ``` 这里最后一个属性后面的逗号是多余的,会导致解析错误。正确的应该是去掉逗号: ```json { "key": "value" } ``` 引用[2]显示的错误是因为在对象属性之间缺少逗号,或者出现了不该出现的字符(如双引号)。错误信息提示“was expecting comma to separate Object entries”,意思是期望用逗号分隔对象属性,但遇到了双引号。 引用[3]则是因为JSON格式不符合预期,在解析时遇到了一个字符'C',而解析器期望的是空格(用于分隔根级别的值)。这通常发生在JSON格式不正确,例如在字符串外部出现了意外的字符。 现在用户遇到的是“Unexpected end-of-input within/between Object entries”,这个错误通常表示JSON数据不完整或者在对象属性之间突然结束。可能的原因有: 1. JSON数据在对象内部被截断,例如在对象开始后没有完整的键值对就结束了。 2. 在对象属性之间缺少逗号,或者有多余的逗号(尤其是在最后一个属性后)。 3. 引号不匹配,例如键名或字符串值没有用双引号闭合。 解决方案: 1. 检查JSON数据是否完整。确保对象和数组都有正确的开始和结束符号({}和[])。 2. 验证JSON格式是否正确,特别注意: - 键名必须用双引号括起来。 - 字符串值必须用双引号括起来(单引号无效)。 - 属性之间用逗号分隔,但最后一个属性后面不能有逗号。 3. 使用JSON验证工具(如在线JSON验证器)来检查JSON字符串的语法。 例如,一个典型的错误格式: ```json { "name": "Alice", "age": 30 } ``` 这里,在"age"属性后面缺少逗号(如果后面还有属性的话),但如果是最后一个属性,则没有问题。而用户遇到的是“end-of-input”,可能是数据在中间就结束了。 另一个例子: ```json { "name": "Alice", "hobbies": ["reading", "swimming",] } ``` 这里数组的最后一个元素后面多了一个逗号,这在某些解析器中是允许的(根据JSON规范不允许),但有些严格的解析器会报错。 此外,用户提到的错误信息中包含了“within/between Object entries”,这通常意味着在一个对象中,解析器期望有更多的属性,但是输入已经结束。也就是说,可能是一个未完成的对象。 步骤: 1. 检查发送的JSON字符串是否完整。可能是由于网络问题或客户端生成错误导致的数据截断。 2. 检查是否有转义字符的问题。例如,字符串中包含双引号而没有正确转义,导致解析器认为字符串提前结束。 3. 在开发过程中,可以使用格式化工具(如Postman的Pretty格式)来查看JSON结构,从而更容易发现问题。 总结:用户需要检查他们的JSON数据,确保其符合规范,并且完整无误。常见的错误包括多余的逗号、缺失的逗号、引号不匹配以及数据截断。 根据以上分析,我们将形成回答。 </think>### JSON解析错误:Unexpected end-of-input within/between Object entries 解决方案 此错误表示JSON数据在解析过程中被意外截断,导致Jackson解析器无法完整读取对象结构。根本原因是**JSON格式不完整或存在语法错误**,解决方法如下: #### 1. 检查JSON结构完整性 - **对象/数组未闭合**:确保所有`{`都有对应的`}`,所有`[`都有对应的`]` - **缺失属性值**:每个键必须对应完整值,例如: ```json // 错误示例(缺少值) {"name": "Alice", "age": } // 正确示例 {"name": "Alice", "age": 30} ``` #### 2. 验证逗号使用规范 - **禁止结尾逗号**:对象或数组的最后一个元素后不可加逗号 ```json // 错误示例(末尾逗号) {"key1": "value1", "key2": "value2",} // 正确示例 {"key1": "value1", "key2": "value2"} ``` - **属性间必须用逗号分隔**: ```json // 错误示例(缺少逗号) {"key1": "value1" "key2": "value2"} // 正确示例 {"key1": "value1", "key2": "value2"} ``` #### 3. 检查特殊字符处理 - **转义双引号**:字符串中的双引号需转义 ```json // 错误示例 {"message": "He said "hello""} // 正确示例 {"message": "He said \"hello\""} ``` - **非ASCII字符处理**:中文字符等建议显式编码或确保传输编码一致(推荐UTF-8) #### 4. 数据截断问题排查 - **网络传输限制**:检查HTTP请求大小限制(如Tomcat的`max-http-post-size`) - **缓冲区溢出**:确认Jackson的`JsonParser.Feature.AUTO_CLOSE_SOURCE`配置 - **日志截断**:检查日志系统是否截断了完整JSON(通过Debug模式获取完整payload) #### 5. 调试工具使用 - **在线校验器**:使用[JSONLint](https://jsonlint.com/)验证语法 - **Postman预处理**:在`Pre-request Script`中添加格式化逻辑: ```javascript try { JSON.parse(pm.request.body.raw); } catch (e) { console.error("Invalid JSON:", e.message); } ``` - **Jackson严格模式**:启用`FAIL_ON_TRAILING_TOKENS`检测多余内容 ```java ObjectMapper mapper = new ObjectMapper(); mapper.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION); ``` #### 6. 框架特定处理 Spring Boot项目中添加全局异常处理: ```java @ControllerAdvice public class JsonExceptionHandler { @ExceptionHandler(HttpMessageNotReadableException.class) public ResponseEntity<String> handleJsonError(HttpMessageNotReadableException ex) { // 提取原始错误信息 Throwable rootCause = ex.getRootCause(); if (rootCause instanceof JsonParseException) { return ResponseEntity.badRequest() .body("JSON格式错误: " + rootCause.getMessage()); } return ResponseEntity.status(500).body("服务器错误"); } } ``` > **关键预防措施**:使用IDE的JSON插件实时校验,在CI流程中加入JSON校验步骤,推荐库:`org.json:json`的`JSONObject#isValid`方法[^1][^2][^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值