Browse Source

"updata"

master
Ren Wenhao 2 years ago
parent
commit
6de7ef0e38
11 changed files with 491 additions and 0 deletions
  1. +8
    -0
      .idea/.gitignore
  2. +1
    -0
      .idea/.name
  3. +11
    -0
      .idea/aws.xml
  4. +36
    -0
      .idea/deployment.xml
  5. +6
    -0
      .idea/inspectionProfiles/profiles_settings.xml
  6. +4
    -0
      .idea/misc.xml
  7. +8
    -0
      .idea/modules.xml
  8. +11
    -0
      .idea/siamfc-project.iml
  9. +6
    -0
      .idea/vcs.xml
  10. +203
    -0
      readme-CN.md
  11. +197
    -0
      readme.md

+ 8
- 0
.idea/.gitignore View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../:\siamfc-project\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

+ 1
- 0
.idea/.name View File

@@ -0,0 +1 @@
siamfc.mindrecord

+ 11
- 0
.idea/aws.xml View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="accountSettings">
<option name="activeRegion" value="us-east-1" />
<option name="recentlyUsedRegions">
<list>
<option value="us-east-1" />
</list>
</option>
</component>
</project>

+ 36
- 0
.idea/deployment.xml View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" autoUpload="On explicit save action" serverName="root@192.168.88.97:22" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true">
<serverData>
<paths name="root@183.129.171.130:6483">
<serverdata>
<mappings>
<mapping deploy="/root/HRBEU-MedAI/renwenhao2" local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</paths>
<paths name="root@183.129.171.130:6483 (1)">
<serverdata>
<mappings>
<mapping deploy="/root/HRBEU-MedAI/renwenhao" local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
<paths name="root@183.129.171.130:6483 (2)">
<serverdata>
<mappings>
<mapping deploy="/root/HRBEU-MedAI/renwenhao2" local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</paths>
<paths name="root@192.168.88.97:22">
<serverdata>
<mappings>
<mapping deploy="/root/HRBEU-MedAI/renwenhao2" local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</paths>
</serverData>
<option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
</component>
</project>

+ 6
- 0
.idea/inspectionProfiles/profiles_settings.xml View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

+ 4
- 0
.idea/misc.xml View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Remote Python 3.7.6 (sftp://root@192.168.88.97:22/root/archiconda3/envs/wks/bin/python3.7)" project-jdk-type="Python SDK" />
</project>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/siamfc-project.iml" filepath="$PROJECT_DIR$/.idea/siamfc-project.iml" />
</modules>
</component>
</project>

+ 11
- 0
.idea/siamfc-project.iml View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Remote Python 3.7.6 (sftp://root@192.168.88.97:22/root/archiconda3/envs/wks/bin/python3.7)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

+ 203
- 0
readme-CN.md View File

@@ -0,0 +1,203 @@
# 目录

<!-- TOC -->

- [目录](#目录)
- [SiamFC描述](#SiamFC描述)
- [模型架构](#模型架构)
- [数据集](#数据集)
- [环境要求](#环境要求)
- [快速入门](#快速入门)
- [脚本说明](#脚本说明)
- [脚本及样例代码](#脚本及样例代码)
- [脚本参数](#脚本参数)
- [训练过程](#训练过程)
- [训练](#训练)
- [评估过程](#评估过程)
- [评估](#评估)
- [模型描述](#模型描述)
- [性能](#性能)
- [评估性能](#评估性能)
________________________________________________________

# [SiamFC描述](#目录)

SiamFC提出一种新的全卷积孪生网络作为基本的跟踪算法,这个网络在ILSVRC15的目标跟踪视频数据集上进行端到端的训练。我们的跟踪器在帧率上超过了实时性要求,尽管它非常简单,但在多个benchmark上达到最优的性能。

[paper](https://arxiv.org/pdf/1606.09549.pdf) Luca Bertinetto Jack Valmadre Jo˜ao F. Henriques Andrea Vedaldi Philip H. S. Torr
Department of Engineering Science, University of Oxford

# [模型架构](#目录)

Siamfc首先采用全卷积alexnet进行在线和离线的特征提取,然后采用twin网络分别训练模板和背景。在线上,在得到第一帧的box后,进行centercrop,然后加载checkpoint来跟踪后续的帧。为了找到box,需要对得分图进行一系列的惩罚,最后通过二次三线性插值得到最终的预测点。


#[数据集](#目录)

使用的数据集:[ILSVRC2015-VID](http://bvisionweb1.cs.unc.edu/ilsvrc2015/ILSVRC2015_VID.tar.gz)

- 数据集大小:85GB,共30个类
- 训练集:共3862个视频及其对应的帧图片和box位置
- 验证集:共555个视频及对应图片和box位置
- 测试集:共973个视频及对应图品和box位置
- 数据格式:图片为H*W*C格式图片,box位置包括左下角和右上角坐标,格式为xml,需要解析xml.



#[环境要求](#目录)

- 硬件:(Ascend)
- 准备Ascend处理器搭建硬件环境
- 框架:
- [Mindspore](https://www.mindspore.cn/install)
- 如需查看详情,请参见如下资源:
- [MindSpore教程](https://www.mindspore.cn/tutorial/training/zh-CN/master/index.html)
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/zh-CN/master/index.html)

#[快速入门](#目录)

通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:

```
#运行python脚本,预处理数据集
python create_dataset_ILSVRC.py [Data_dir]='你的数据集位置' [Output_dir]='处理完数据集输出位置'

#运行python脚本,创建lmdb
python create_lmdb [DATA_PATH]='预处理数据集位置' [Output_dir]='lmdb数据库位置,注意要加.lmdb'

例:
Data_dir = '/data/VID/ILSVRC_VID_CURATION_train'
Output_dir = '/data/VID/ILSVRC_VID_CURATION_train.lmdb'

#运行脚本进行训练
sh run_standalone_train_ascend.sh --[Device_ID] --[Dataset_path]注:为预处理后训练集位置

本例为单卡训练,也可以多卡训练训练脚本为run_distribution_ascend.sh

#运行脚本进行评估
python eval.py

```
#[脚本说明](#内容)

## 脚本及样例代码

```

├── SiamFc
├── README.md // SiamFC相关说明
├── create_dataset_ILSVRC.py // 创建数据集
├── create_lmdb.py //创建lmdb
├── scripts
│ ├──ma-pre-start.sh // modelarts训练前创建环境
│ ├──run_standalone_train_ascend.sh // 在Ascend中单卡训练
│ ├──run_distribution_ascend.sh // 在Ascend中多卡分布式训练
├── src
│ ├──alexnet.py // 创建数据集
│ ├──config.py // AlexNet架构
│ ├──custom_transforms.py //数据集处理
│ ├──dataset.py //GeneratorDataset
│ ├──Groupconv.py //mindspore暂不支持分组卷积,此为替代方案
│ ├──lr_generator.py //动态学习率
│ ├──tracker.py //追踪脚本
│ ├──utils.py // utils
├── train.py // 训练脚本
├── eval.py // 评估脚本
```

## 脚本参数

```
python
train.py和config.py中主要参数如下:

--data_path:到训练和评估数据集的绝对完整路径。
--epoch_size:总训练轮次。
--batch_size:训练批次大小。
--exemplar_size:模板大小。
--instance_size:样例大小。
--lr:学习率。
--frame_range:选取模板和样例的帧间隔。
--response_scale:得分图缩放倍数

```
## 训练过程

### 训练

- Ascend处理器环境运行

```
python train.py

```

经过训练后,损失值如下:

```
# grep "loss is " log
epoch: 1 step: 1, loss is 1.14123213
...
epoch: 1 step: 1536, loss is 0.5234123
epoch: 1 step: 1537, loss is 0.4523326
epoch: 1 step: 1538, loss is 0.6235748
...
```

模型检查点保存在当前目录下。


```

经过训练后,损失值如下:

```
# grep "loss is " log
epoch: 30 step: 1, loss is 0.12534634
...
epoch: 30 step: 1560, loss is 0.2364573
epoch: 30 step: 1561, loss is 0.156347
epoch: 30 step: 1561, loss is 0.173423
```
## 评估过程

在运行以下命令之前,请检查用于评估的检查点路径。

- Ascend处理器环境运行

```
python eval.py

结果为:

SiamFC_159_50_6650.ckpt -prec_score:0.777 -succ_score:0.589 _succ_rate:0.754
```

#[模型描述](#目录)

## 性能

### 评估性能
| 参数 | Ascend |

| 资源 | Ascend 910;CPU 2.60GHz, 192核;内存:755G |

| 上传日期 | 2021年5月20日|

| mindspore版本 | mindspore1.2.0|

| 训练参数 | epoch=50,step=6650,batch_size=8,lr_init=1e-2,lr_endl=1e-5 |

| 优化器 | SGD优化器,momentum=0.0,weight_decay=0.0 |

| 损失函数 | BCEWithLogits |

| 训练速度 | epoch time:285693.557 ms per step time :42.961 ms |

| 总时间 | 大约5个小时

| 脚本地址 | https://git.openi.org.cn/OpenModelZoo/SiamFC |

| 随机数种子 | set_seed = 1234 |


+ 197
- 0
readme.md View File

@@ -0,0 +1,197 @@
# Contents

- [SiamFC Description](#SiamFC-Description)
- [Model Architecture](#SiamFC-Architecture)
- [Dataset](#SiamFC-dataset)
- [Environmental requirements](#Environmental)
- [Quick Start](#quick-start)
- [Script Description](#script-description)
- [Script and Sample Code](#script-and-sample-code)
- [Script Parameters](#script-parameters)
- [Training Process](#training-process)
- [Training](#training)
- [Evaluation Process](#evaluation-process)
- [Evaluation](#evaluation)
- [Model Description](#model-description)
- [Performance](#performance)
- [Evaluation Performance](#evaluation-performance)


# [SiamFC Description](#Contents)
Siamfc proposes a new full convolution twin network as the basic tracking algorithm, which is trained end-to-end on ilsvrc15 target tracking video data set. Our tracker exceeds the real-time requirement in frame rate. Although it is very simple, it achieves the best performance on multiple benchmarks.

[paper](https://arxiv.org/pdf/1606.09549.pdf) Luca Bertinetto Jack Valmadre Jo˜ao F. Henriques Andrea Vedaldi Philip H. S. Torr
Department of Engineering Science, University of Oxford

# [Model Architecture](#Contents)
Siamfc first uses full convolution alexnet for feature extraction online and offline, and uses twin network to train the template and background respectively. On line, after getting the box of the first frame, it carries out centrrop, and then loads checkpoint to track the subsequent frames. In order to find the box, it needs to carry out a series of penalties on the score graph, Finally, the final prediction point is obtained by twice trilinear interpolation.

# [Dataset](#Contents)

used Dataset :[ILSVRC2015-VID](http://bvisionweb1.cs.unc.edu/ilsvrc2015/ILSVRC2015_VID.tar.gz)

- Dataset size : 85GB ,total 30 type
- Training set: a total of 3862 videos and their corresponding frame pictures and box positions
- Verification set: 555 videos and corresponding pictures and box locations
- Test set: a total of 973 videos and corresponding pictures and box locations
- Data format: the image is in h * w * C format, the box position includes the coordinates of the lower left corner and the upper right corner, the format is XML, and the XML needs to be parsed

#[Environmental requirements](#Contents)

- Hardware :(Ascend)
- Prepare ascend processor to build hardware environment
- frame:
- [Mindspore](https://www.mindspore.cn/install)
- For details, please refer to the following resources:
- [MindSpore course](https://www.mindspore.cn/tutorial/training/zh-CN/master/index.html)
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/zh-CN/master/index.html)

#[quick start](#Contents)

- After installing mindspree through the official website, you can follow the following steps to train and evaluate:
```
#Run the python script to preprocess the data set
python create_dataset_ILSVRC.py [Data_dir]='Your dataset location' [Output_dir]='Output position of data set after processing'

#Run Python script to create LMDB
python create_lmdb [DATA_PATH]='Preprocessing dataset location' [Output_dir]='LMDB database location, pay attention to add. LMDB



for example:
Data_dir = '/data/VID/ILSVRC_VID_CURATION_train'
Output_dir = '/data/VID/ILSVRC_VID_CURATION_train.lmdb'

#Run the script for training
sh run_standalone_train_ascend.sh --[Device_ID] --[Dataset_path]
Remarks:For the training set position after preprocessing

This example is single card training, or multi card training. The training script is run_distribution_ascend.sh

#Run the script for evaluation
python eval.py

```
#[Script description](#Contents)

## Script and sample code
```

├── SiamFc
├── README.md // Notes on siamfc
├── create_dataset_ILSVRC.py // Create dataset
├── create_lmdb.py //Create LMDB
├── scripts
│ ├──ma-pre-start.sh // Create environment before modelarts training
│ ├──run_standalone_train_ascend.sh // Single card training in ascend
│ ├──run_distribution_ascend.sh // Multi card distributed training in ascend
├── src
│ ├──alexnet.py // Create dataset
│ ├──config.py // Alexnet architecture
│ ├──custom_transforms.py //Data set processing
│ ├──dataset.py //GeneratorDataset
│ ├──Groupconv.py //Mindpore does not support group convolution at present. This is an alternative
│ ├──lr_generator.py //Dynamic learning rate
│ ├──tracker.py //Trace script
│ ├──utils.py // utils
├── train.py // Training script
├── eval.py // Evaluation script
```
## Script parameters

```python
train.py and config.py The main parameters are as follows:

--data_path:An absolutely complete path to training and evaluation data sets.
--epoch_size:Total training rounds
--batch_size:Training batch size.
--image_height:The image height is used as the model input.
--image_width:The image width is used as the model input.
--exemplar_size:Template size
--instance_size:Sample size.
--lr:Learning rate.
--frame_range:Select the frame interval of the template and sample.
--response_scale:Scaling factor of score chart.
```

## Training process

### Training

- Running in ascend processor environment

```
python train.py

```

After training, the loss value is as follows:

```
# grep "loss is " log
epoch: 1 step: 1, loss is 1.14123213
...
epoch: 1 step: 1536, loss is 0.5234123
epoch: 1 step: 1537, loss is 0.4523326
epoch: 1 step: 1538, loss is 0.6235748
...
```

Model checkpoints are saved in the current directory.


```

After training, the loss value is as follows:
```
# grep "loss is " log
epoch: 30 step: 1, loss is 0.12534634
...
epoch: 30 step: 1560, loss is 0.2364573
epoch: 30 step: 1561, loss is 0.156347
epoch: 30 step: 1561, loss is 0.173423
```
##
Evaluation process

Check the checkpoint path used for evaluation before running the following command.

- Running in ascend processor environment

```
python eval.py

The results were as follows

SiamFC_159_50_6650.ckpt -prec_score:0.777 -succ_score:0.589 _succ_rate:0.754
```
#[Model description](#Contents)

## performance

### Evaluate performance
| parameter | Ascend |

| resources | Ascend 910;CPU 2.60GHz, 192core;memory:755G |

| Upload date | 2021.5.20|

| mindspore version | mindspore1.2.0|

| training parameter | epoch=50,step=6650,batch_size=8,lr_init=1e-2,lr_endl=1e-5 |

| optimizer | SGD optimizer,momentum=0.0,weight_decay=0.0 |

| loss function | BCEWithLogits |

| training speed | epoch time:285693.557 ms per step time :42.961 ms |

| total time | about 5 hours |

| Script URL | https://git.openi.org.cn/OpenModelZoo/SiamFC |

| Random number seed | set_seed = 1234 |




Loading…
Cancel
Save