---
title: cv_cspnet_video-object-detection_longshortnet
canonical_url: "https://www.modelscope.cn/models/iic/cv_cspnet_video-object-detection_longshortnet"
md_url: "https://www.modelscope.cn/models/iic/cv_cspnet_video-object-detection_longshortnet.md"
repository: iic/cv_cspnet_video-object-detection_longshortnet
chinese_name: "LongShortNet实时视频目标检测-自动驾驶领域"
last_updated: 2023-04-06
license: "Apache License 2.0"
pipeline_tag: video-object-detection
tasks:
  - video-object-detection
model_type:
  - YOLOX
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 16697
stars: 14
tags:
  - "自动驾驶"
  - "流感知"
  - "视频目标检测"
---

# cv_cspnet_video-object-detection_longshortnet

> cv_cspnet_video-object-detection_longshortnet - iic 在 ModelScope 开源的模型。任务说明 本模型所述的任务为流感知（Streaming Perception）任务，该任务为视频目标检测（Video Object Detection, VOD）任务的一个新的细分方向。如上图上半部分所示，传统的VOD采用离线的处理模式，没有考虑模型的延时，所以模型检测结果和真实环境存在由于模型延时造成的误差。而流感知任务在关注模型精度的同时，也考虑了模型的延时，如上图下半…

iic/cv_cspnet_video-object-detection_longshortnet 是 ModelScope 魔搭社区上的video-object-detection模型，采用 Apache License 2.0 许可。

- **Repository**: iic/cv_cspnet_video-object-detection_longshortnet
- **License**: Apache License 2.0
- **Tasks**: video-object-detection
- **Tags**: 自动驾驶, 流感知, 视频目标检测
- **Downloads**: 16697
- **Stars**: 14
- **Last updated**: 2023-04-06

Source: https://www.modelscope.cn/models/iic/cv_cspnet_video-object-detection_longshortnet

---

<!--- 以下model card模型说明部分，请使用中文提供（除了代码，bibtex等部分） --->

# LongShortNet 模型介绍
<div align="center"><img src="assets/intro.jpg" width="500"></div>

## 任务说明
本模型所述的任务为流感知（Streaming Perception）任务，该任务为视频目标检测（Video Object Detection, VOD）任务的一个新的细分方向。如上图上半部分所示，传统的VOD采用离线的处理模式，没有考虑模型的延时，所以模型检测结果和真实环境存在由于模型延时造成的误差。而流感知任务在关注模型精度的同时，也考虑了模型的延时，如上图下半部分所示，这样得到的检测结果与真实环境更加匹配。所以说，流感知任务是一个更加贴近自动驾驶真实应用场景的任务。

## 模型描述
LongShortNet是对流感知任务已有方法[StreamYOLO](https://modelscope.cn/models/damo/cv_cspnet_video-object-detection_streamyolo/summary)的改进，主要的改进点有以下几个方面：

1. 在流感知任务中首次引入长时序信息。原有的StreamYOLO方法仅使用当前帧和前一帧两帧信息作为输入，这样的短时序信息无法表征复杂的运动状态，如：非匀速运动、非直线运动、物体遮挡等；
2. 本模型提出了一种长短时序融合模块（Long-Short Fusion Module, LSFM）。探索了不同的时序融合方式，最终得到一种在精度和速度上能有较好平衡的融合方式；
3. 本模型在流感知的公开评测数据集Argoverse-HD上，在几乎不增加推理耗时的前提下，达到了SOTA水平。
- 在模型结构方面，LongShortNet与StreamYOLO保持一致，采用YOLOX作为基础网络结构。

LongShortNet的整体框图如下图所示：

<div align="center"><img src="assets/longshortnet.jpg" width="2000"></div>

## 期望模型使用方式以及适用范围
该模型适用于自动驾驶场景目标预测检测，，支持8类交通目标检测，具体的类别信息如下：

| 类别ID | 类别名称 |
| ------------ | ------------ |
| 1 | person |
| 2 | bicycle |
| 3 | car |
| 4 | motorcycle |
| 5 | bus |
| 6 | truck |
| 7 | traffic_light |
| 8 | stop_sign |

### 如何使用
在ModelScope框架上，提供输入视频，即可以通过简单的Pipeline调用使用当前模型，得到视频中目标位置及类别。

#### 推理代码范例
基础示例代码。下面的示例代码展示的是如何通过一个视频作为输入，得到图片对应的交通目标坐标信息。
```python
import cv2
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys

model_id = 'damo/cv_cspnet_video-object-detection_longshortnet'
test_video = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/videos/test_realtime_vod.mp4'
# 初始化实时检测pipeline
realtime_video_object_detection = pipeline(
    Tasks.video_object_detection, model=model_id)

# 进行实时检测 
result = realtime_video_object_detection(test_video)
if result:
    bboxes_list = result[OutputKeys.BOXES]
    print(bboxes_list)
else:
    raise ValueError('process error')
```

## 模型局限性以及可能的偏差

- 对于非自动驾驶前置摄象机场景会出现明显检测性能下降的情况。

## 训练数据介绍
Argoverse-HD 数据集是最近提出的自动驾驶数据集，该数据集与其他的自动驾驶相比，数据规模中等，复杂程度较高，是一个较有代表性的数据集。更重要的是，Argoverse-HD 是第一个提出流感知任务的数据集，并且设计了Stream AP评测标准。该标准将感知时延充分考虑，实现对模型的性能-速度的全面、有效评价。

<div align="center"><img src="assets/datasets.png"></div>

## 训练
本模型暂时不支持finetune， 具体离线训练细节如下：

- 在Argoverse-HD 上训练8个epoch
- 使用SGD优化算法，线性 LR 策略
- 使用flip数据增强， 多尺度训练增强

## 输入预处理

- 输入图像根据短边resize到640后，padding 为640x960的矩形进行推理
- 图像归一化

## 数据评估及结果
模型在Argoverse-HD的验证集上客观指标如下：

|Model |size |velocity | sAP<br>0.5:0.95 | sAP50 |sAP75| weights | COCO pretrained weights |
| ------        |:---: | :---:       |:---:     |:---:  | :---: | :----: | :----: |
|LongShortNet-S    |600×960  |1x  |29.8 |50.4| 29.5 |[official](https://drive.google.com/file/d/13ESdjetcccOKnU0fg54b6czuxBH76C_7/view?usp=share_link) |[official](https://github.com/yancie-yjr/StreamYOLO/releases/download/0.1.0rc/yolox_l.pth) |
|LongShortNet-M    |600×960  |1x  |34.1 |54.8| 34.6 |[official](https://drive.google.com/file/d/1AFzD2bTSTtuCCWBk2AnU1t9uHVGD1cM_/view?usp=share_link) |[official](https://github.com/yancie-yjr/StreamYOLO/releases/download/0.1.0rc/yolox_l.pth) |
|LongShortNet-L    |600×960  |1x  |37.1 |57.8| 37.7 |[official](https://drive.google.com/file/d/15D6VL_QcL1qBYjBmZCAEa0PNp0TM67vg/view?usp=share_link) |[official](https://github.com/yancie-yjr/StreamYOLO/releases/download/0.1.0rc/yolox_l.pth) |

### 相关论文以及引用信息

```BibTeX
 @article{LongShortNet,
  title={LongShortNet: Exploring Temporal and Semantic Features Fusion in Streaming Perception},
  author={Chenyang Li, Zhi-Qi Cheng, Jun-Yan He, Pengyu Li, Bin Luo, Han-Yuan Chen, Yifeng Geng, Jin-Peng Lan and Xuansong Xie},
  journal={ICASSP},
  year={2023}
}
```
