Commit 1073523f authored by yongshk's avatar yongshk
Browse files

Initial commit

parent 382d1b19
Pipeline #636 canceled with stages
FROM image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk-22.10-py37-latest
COPY requirements.txt requirements.txt
RUN source /opt/dtk-22.10/env.sh
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENV LANG C.UTF-8
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# FLAVR
## 模型介绍
FLAVR是一种用于视频插值的深度学习模型,可以通过插值技术将低帧率视频转换为高帧率视频。
## 论文
` FLAVR: Flow-Agnostic Video Representations for Fast Frame Interpolation `
- https://arxiv.org/pdf/2012.08512.pdf
## 模型结构
3D U-Net结构、encoder部分采用ResNet-3D,decoder部分采用3D TransConv,以及Spatio-Temporal Feature Gating
FLAVR模型是一个3D U-Net模型,通过拓展2D U-Net,将2D卷积替换为3D卷积而得到的。该模型能够更准确地对输入帧之间的时间动态进行建模,从而获得更好的插值质量。
![](D:\git上传前\flavr_pytorch\doc\arch_dia.png)
## 算法原理
3D U-Net结构、encoder部分采用ResNet-3D,decoder部分采用3D TransConv,以及Spatio-Temporal Feature Gating ![](D:\git上传前\flavr_pytorch\doc\原理.png)
## 环境配置
### Docker(方法一)
此处提供[光源](https://www.sourcefind.cn/#/service-details)拉取docker镜像
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk-22.10-py37-latest
docker run -it --network=host --name=flavr --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=32G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk-22.10-py37-latest
```
### Dockerfile(方法二)
dockerfile使用方法
```
docker build --no-cache -t flavr:latest .
docker run -dit --network=host --name=flavr --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 flavr:latest
docker exec -it flavr /bin/bash
pip install -r requirements.txt
```
### Anaconda(方法三)
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.hpccube.com/tool/)开发者社区下载安装。
```
DTK驱动:dtk22.10
python:python3.7
torch==1.10.0a0+git2040069.dtk2210
torchvision==0.10.0a0+e04d001.dtk2210
```
`Tips:以上dtk驱动、python等DCU相关工具版本需要严格一一对应`
其它非深度学习库参照requirements.txt安装:
```
Fpip install -r requirements.txt
```
## 数据集
目前模型在Vimeo-90K 数据集上训练
可以通过[此链接](http://toflow.csail.mit.edu/)进行数据下载
`模型使用数据为 Vimeo-90K `
- http://toflow.csail.mit.edu/
项目中已提供用于试验训练的迷你数据集,训练数据目录结构如下,用于正常训练的完整数据集请按此目录结构进行制备:
```
── datasets
│   ├── readme.txt
│   ├── sep_testlist.txt 
│   ├── sep_trainlist.txt 
│ ├── sequences
│ ├── xx/xx/xxx.png
│ ├── xx/xx/xxx.png
```
## 训练
### 单机单卡
```
python main.py --batch_size 32 --test_batch_size 32 --dataset vimeo90K_septuplet --loss 1*L1 --max_epoch 200 --lr 0.0002 --data_root datasets --n_outputs 1 --num_gpu 1
```
### 单机多卡
## 训练及推理
### 环境配置
python依赖安装:
```
python main.py --batch_size 32 --test_batch_size 32 --dataset vimeo90K_septuplet --loss 1*L1 --max_epoch 200 --lr 0.0002 --data_root datasets --n_outputs 1 --num_gpu 4
```
Python==3.7.11
numpy==1.19.2
PyTorch ==1.10.0a0+git2040069.dtk2210
### 训练
训练命令:
## 推理
python main.py --batch_size 32 \
--test_batch_size 32 \
--dataset vimeo90K_septuplet \
--loss 1*L1 \
--max_epoch 200 \
--lr 0.0002 \
--data_root <dataset_path> \
--n_outputs 1
python test.py --dataset vimeo90K_septuplet --data_root <data_path> --load_from <saved_model> --n_outputs 1
GoPro 数据集上的训练类似,更改`n_outputs`为 7 以进行 8 倍插值。
## result
测试图
![](D:\git上传前\flavr_pytorch\doc\sprite.gif)
## 性能和准确率数据
测试数据:[test data](http://toflow.csail.mit.edu/),使用的加速卡:2张 DCU。
### 精度
测试数据:http://toflow.csail.mit.edu/,使用的加速卡:Z100L。
根据测试结果情况填写表格:
| FLAVR | PSNR | SSIM | 速度 |
| :------: | :-------: | -------- | :------: |
| vimeo-90 | 18.511020 | 0.702564 | 3.46it/s |
## 应用场景
### 算法类别
`图像超分`
### 热点应用行业
`设计`
## 源码仓库及问题反馈
* [https://github.com/tarun005/FLAVR](https://github.com/tarun005/FLAVR)
## 参考
* [https://github.com/tarun005/FLAVR](https://github.com/tarun005/FLAVR)
* https://github.com/tarun005/FLAVR
## 参考资料
* https://github.com/tarun005/FLAVR
========================================================================================
=== Vimeo-90K Septuplet Dataset for Video Denoising, Deblocking, and Super-resolution
========================================================================================
Vimeo-90K septuplets dataset contains 91701 septuplets (each septuplets is a short RGB video sequence that consists of 7 frames) from 39k video clips with fixed resolution 448x256. This dataset is designed to video denoising, deblocking, and super-resolution. All the videos are downloaded from vimeo.com.
========================================================================================
=== Folder structure
========================================================================================
- sequences: This folder stores all 91701 septuplets. It uses a two-level folder structure, where each folder "%05d/%04d" contains a short video sequence consists of 7 frames: im1.png, im2.png, ..., im7.png.
- sep_trainlist.txt: contains the list of sequences for training.
- sep_testlist.txt: contains the list of sequences for test.
======================================================
=== Citation
======================================================
If you use this dataset in your work, please cite the following work:
@article{xue17toflow,
author = {Xue, Tianfan and Chen, Baian and Wu, Jiajun and Wei, Donglai and Freeman, William T},
title = {Video Enhancement with Task-Oriented Flow},
journal = {arXiv},
year = {2017}
}
For questions, please contact Tianfan Xue (tianfan.xue@gmail.com), Baian Chen(baian@mit.edu), Jiajun Wu (jiajunwu@mit.edu), or Donglai Wei(donglai@csail.mit.edu).
For more information, please refers to our project website and github repo:
Project website: http://toflow.csail.mit.edu/
Github repo: https://github.com/anchen1011/toflow
======================================================
=== Disclaimer
======================================================
This dataset is for non-commercial usage only.
00001/0266
\ No newline at end of file
00001/0001
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment