Skip to content

Commit

Permalink
update ncnn, add rife-v2.4 model
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Feb 27, 2021
1 parent 7c3aa49 commit 6e0d8b2
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ ffprobe input.mp4
ffmpeg -i input.mp4 -vn -acodec copy audio.m4a

# decode all frames
ffmpeg -i input.mp4 input_frames/frame_%06d.png
ffmpeg -i input.mp4 input_frames/frame_%08d.png

# interpolate 2x frame count
./rife-ncnn-vulkan -i input_frames -o output_frames

# encode interpolated frames in 48fps with audio
# if using rife_v2, replace %06d with %08d
ffmpeg -framerate 48 -i output_frames/%06d.png -i audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output.mp4
ffmpeg -framerate 48 -i output_frames/%08d.png -i audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output.mp4
```

### Full Usages
Expand Down Expand Up @@ -141,6 +140,8 @@ cmake --build . -j 4
| rife-UHD | 1.6 |
| rife-anime | 1.8 |
| rife-v2 | 2.0 |
| rife-v2.3 | 2.3 |
| rife-v2.4 | 2.4 |

## Sample Images

Expand Down
Binary file added models/rife-v2.4/contextnet.bin
Binary file not shown.
42 changes: 42 additions & 0 deletions models/rife-v2.4/contextnet.param
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
7767517
40 46
Input input.1 0 1 input.1
Input flow.0 0 1 flow.0
Convolution Conv_0 1 1 input.1 32 0=32 1=3 3=2 4=1 5=1 6=864
PReLU PRelu_1 1 1 32 34 0=32
Convolution Conv_2 1 1 34 35 0=32 1=3 4=1 5=1 6=9216
PReLU PRelu_3 1 1 35 37 0=32
Convolution Conv_4 1 1 37 38 0=32 1=3 3=2 4=1 5=1 6=9216
PReLU PRelu_5 1 1 38 40 0=32
Convolution Conv_6 1 1 40 41 0=32 1=3 4=1 5=1 6=9216
PReLU PRelu_7 1 1 41 43 0=32
Split splitncnn_0 1 2 43 43_splitncnn_0 43_splitncnn_1
Interp Resize_9 1 1 flow.0 53 0=2 1=5.000000e-01 2=5.000000e-01
BinaryOp Mul_11 1 1 53 55 0=2 1=1 2=5.000000e-01
Split splitncnn_1 1 2 55 55_splitncnn_0 55_splitncnn_1
rife.Warp Warp_17 2 1 43_splitncnn_1 55_splitncnn_1 f1
Convolution Conv_18 1 1 43_splitncnn_0 62 0=64 1=3 3=2 4=1 5=1 6=18432
PReLU PRelu_19 1 1 62 64 0=64
Convolution Conv_20 1 1 64 65 0=64 1=3 4=1 5=1 6=36864
PReLU PRelu_21 1 1 65 67 0=64
Split splitncnn_2 1 2 67 67_splitncnn_0 67_splitncnn_1
Interp Resize_23 1 1 55_splitncnn_0 77 0=2 1=5.000000e-01 2=5.000000e-01
BinaryOp Mul_25 1 1 77 79 0=2 1=1 2=5.000000e-01
Split splitncnn_3 1 2 79 79_splitncnn_0 79_splitncnn_1
rife.Warp Warp_31 2 1 67_splitncnn_1 79_splitncnn_1 f2
Convolution Conv_32 1 1 67_splitncnn_0 86 0=128 1=3 3=2 4=1 5=1 6=73728
PReLU PRelu_33 1 1 86 88 0=128
Convolution Conv_34 1 1 88 89 0=128 1=3 4=1 5=1 6=147456
PReLU PRelu_35 1 1 89 91 0=128
Split splitncnn_4 1 2 91 91_splitncnn_0 91_splitncnn_1
Interp Resize_37 1 1 79_splitncnn_0 101 0=2 1=5.000000e-01 2=5.000000e-01
BinaryOp Mul_39 1 1 101 103 0=2 1=1 2=5.000000e-01
Split splitncnn_5 1 2 103 103_splitncnn_0 103_splitncnn_1
rife.Warp Warp_31a 2 1 91_splitncnn_1 103_splitncnn_1 f3
Convolution Conv_46 1 1 91_splitncnn_0 110 0=256 1=3 3=2 4=1 5=1 6=294912
PReLU PRelu_47 1 1 110 112 0=256
Convolution Conv_48 1 1 112 113 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_49 1 1 113 115 0=256
Interp Resize_51 1 1 103_splitncnn_0 125 0=2 1=5.000000e-01 2=5.000000e-01
BinaryOp Mul_53 1 1 125 127 0=2 1=1 2=5.000000e-01
rife.Warp Warp_ss 2 1 115 127 f4
Binary file added models/rife-v2.4/flownet.bin
Binary file not shown.
119 changes: 119 additions & 0 deletions models/rife-v2.4/flownet.param
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
7767517
117 135
Input input0 0 1 input0
Input input1 0 1 input1
Concat input.1 2 1 input0 input1 input.1
Split splitncnn_input0 1 7 input.1 input.1_splitncnn_0 input.1_splitncnn_1 input.1_splitncnn_2 input.1_splitncnn_3 input.1_splitncnn_4 input.1_splitncnn_5 input.1_splitncnn_6
Interp Resize_1 1 1 input.1_splitncnn_6 114 0=2 1=1.250000e-01 2=1.250000e-01
Convolution Conv_2 1 1 114 115 0=192 1=3 3=2 4=1 5=1 6=10368
PReLU PRelu_3 1 1 115 117 0=192
Convolution Conv_4 1 1 117 118 0=384 1=3 3=2 4=1 5=1 6=663552
PReLU PRelu_5 1 1 118 120 0=384
Convolution Conv_6 1 1 120 121 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_7 1 1 121 123 0=384
Convolution Conv_8 1 1 123 124 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_9 1 1 124 126 0=384
Convolution Conv_10 1 1 126 127 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_11 1 1 127 129 0=384
Convolution Conv_12 1 1 129 130 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_13 1 1 130 132 0=384
Convolution Conv_14 1 1 132 133 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_15 1 1 133 135 0=384
Convolution Conv_16 1 1 135 136 0=384 1=3 4=1 5=1 6=1327104
PReLU PRelu_17 1 1 136 138 0=384
Deconvolution ConvTranspose_18 1 1 138 139 0=4 1=4 3=2 4=1 5=1 6=24576
Interp Resize_20 1 1 139 149 0=2 1=8.000000e+00 2=8.000000e+00
Split splitncnn_0 1 4 149 149_splitncnn_0 149_splitncnn_1 149_splitncnn_2 149_splitncnn_3
Interp Resize_22 1 1 149_splitncnn_3 159 0=2 1=2.000000e+00 2=2.000000e+00
BinaryOp Mul_24 1 1 159 161 0=2 1=1 2=2.000000e+00
Split splitncnn_1 1 3 161 161_splitncnn_0 161_splitncnn_1 161_splitncnn_2
Crop Slice_29 1 1 input.1_splitncnn_5 166 -23309=1,0 -23310=1,3 -23311=1,0
Crop Slice_34 1 1 161_splitncnn_2 171 -23309=1,0 -23310=1,2 -23311=1,0
rife.Warp Warp_40 2 1 166 171 177
Crop Slice_45 1 1 input.1_splitncnn_4 182 -23309=1,3 -23310=1,2147483647 -23311=1,0
Crop Slice_50 1 1 161_splitncnn_1 187 -23309=1,2 -23310=1,4 -23311=1,0
rife.Warp Warp_56 2 1 182 187 193
Concat Concat_57 3 1 177 193 161_splitncnn_0 194
Interp Resize_59 1 1 194 204 0=2 1=2.500000e-01 2=2.500000e-01
Convolution Conv_60 1 1 204 205 0=128 1=3 3=2 4=1 5=1 6=11520
PReLU PRelu_61 1 1 205 207 0=128
Convolution Conv_62 1 1 207 208 0=256 1=3 3=2 4=1 5=1 6=294912
PReLU PRelu_63 1 1 208 210 0=256
Convolution Conv_64 1 1 210 211 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_65 1 1 211 213 0=256
Convolution Conv_66 1 1 213 214 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_67 1 1 214 216 0=256
Convolution Conv_68 1 1 216 217 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_69 1 1 217 219 0=256
Convolution Conv_70 1 1 219 220 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_71 1 1 220 222 0=256
Convolution Conv_72 1 1 222 223 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_73 1 1 223 225 0=256
Convolution Conv_74 1 1 225 226 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_75 1 1 226 228 0=256
Deconvolution ConvTranspose_76 1 1 228 229 0=4 1=4 3=2 4=1 5=1 6=16384
Interp Resize_78 1 1 229 239 0=2 1=4.000000e+00 2=4.000000e+00
Split splitncnn_2 1 3 239 239_splitncnn_0 239_splitncnn_1 239_splitncnn_2
BinaryOp Add_79 2 1 149_splitncnn_2 239_splitncnn_2 240
Interp Resize_81 1 1 240 250 0=2 1=2.000000e+00 2=2.000000e+00
BinaryOp Mul_83 1 1 250 252 0=2 1=1 2=2.000000e+00
Split splitncnn_3 1 3 252 252_splitncnn_0 252_splitncnn_1 252_splitncnn_2
Crop Slice_88 1 1 input.1_splitncnn_3 257 -23309=1,0 -23310=1,3 -23311=1,0
Crop Slice_93 1 1 252_splitncnn_2 262 -23309=1,0 -23310=1,2 -23311=1,0
rife.Warp Warp_99 2 1 257 262 268
Crop Slice_104 1 1 input.1_splitncnn_2 273 -23309=1,3 -23310=1,2147483647 -23311=1,0
Crop Slice_109 1 1 252_splitncnn_1 278 -23309=1,2 -23310=1,4 -23311=1,0
rife.Warp Warp_115 2 1 273 278 284
Concat Concat_116 3 1 268 284 252_splitncnn_0 285
Interp Resize_118 1 1 285 295 0=2 1=5.000000e-01 2=5.000000e-01
Convolution Conv_119 1 1 295 296 0=96 1=3 3=2 4=1 5=1 6=8640
PReLU PRelu_120 1 1 296 298 0=96
Convolution Conv_121 1 1 298 299 0=192 1=3 3=2 4=1 5=1 6=165888
PReLU PRelu_122 1 1 299 301 0=192
Convolution Conv_123 1 1 301 302 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_124 1 1 302 304 0=192
Convolution Conv_125 1 1 304 305 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_126 1 1 305 307 0=192
Convolution Conv_127 1 1 307 308 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_128 1 1 308 310 0=192
Convolution Conv_129 1 1 310 311 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_130 1 1 311 313 0=192
Convolution Conv_131 1 1 313 314 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_132 1 1 314 316 0=192
Convolution Conv_133 1 1 316 317 0=192 1=3 4=1 5=1 6=331776
PReLU PRelu_134 1 1 317 319 0=192
Deconvolution ConvTranspose_135 1 1 319 320 0=4 1=4 3=2 4=1 5=1 6=12288
Interp Resize_137 1 1 320 330 0=2 1=2.000000e+00 2=2.000000e+00
Split splitncnn_4 1 2 330 330_splitncnn_0 330_splitncnn_1
BinaryOp Add_138 2 1 149_splitncnn_1 239_splitncnn_1 331
BinaryOp Add_139 2 1 331 330_splitncnn_1 332
Interp Resize_141 1 1 332 342 0=2 1=2.000000e+00 2=2.000000e+00
BinaryOp Mul_143 1 1 342 344 0=2 1=1 2=2.000000e+00
Split splitncnn_5 1 3 344 344_splitncnn_0 344_splitncnn_1 344_splitncnn_2
Crop Slice_148 1 1 input.1_splitncnn_1 349 -23309=1,0 -23310=1,3 -23311=1,0
Crop Slice_153 1 1 344_splitncnn_2 354 -23309=1,0 -23310=1,2 -23311=1,0
rife.Warp Warp_159 2 1 349 354 360
Crop Slice_164 1 1 input.1_splitncnn_0 365 -23309=1,3 -23310=1,2147483647 -23311=1,0
Crop Slice_169 1 1 344_splitncnn_1 370 -23309=1,2 -23310=1,4 -23311=1,0
rife.Warp Warp_175 2 1 365 370 376
Concat Concat_176 3 1 360 376 344_splitncnn_0 377
Convolution Conv_177 1 1 377 378 0=48 1=3 3=2 4=1 5=1 6=4320
PReLU PRelu_178 1 1 378 380 0=48
Convolution Conv_179 1 1 380 381 0=96 1=3 3=2 4=1 5=1 6=41472
PReLU PRelu_180 1 1 381 383 0=96
Convolution Conv_181 1 1 383 384 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_182 1 1 384 386 0=96
Convolution Conv_183 1 1 386 387 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_184 1 1 387 389 0=96
Convolution Conv_185 1 1 389 390 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_186 1 1 390 392 0=96
Convolution Conv_187 1 1 392 393 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_188 1 1 393 395 0=96
Convolution Conv_189 1 1 395 396 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_190 1 1 396 398 0=96
Convolution Conv_191 1 1 398 399 0=96 1=3 4=1 5=1 6=82944
PReLU PRelu_192 1 1 399 401 0=96
Deconvolution ConvTranspose_193 1 1 401 402 0=4 1=4 3=2 4=1 5=1 6=6144
BinaryOp Add_194 2 1 149_splitncnn_0 239_splitncnn_0 403
BinaryOp Add_195 2 1 403 330_splitncnn_0 404
BinaryOp Add_196 2 1 404 402 flow
Binary file added models/rife-v2.4/fusionnet.bin
Binary file not shown.
74 changes: 74 additions & 0 deletions models/rife-v2.4/fusionnet.param
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
7767517
72 81
Input img0 0 1 img0
Input img1 0 1 img1
Input flow 0 1 flow
Input 3 0 1 3
Input 4 0 1 4
Input 5 0 1 5
Input 6 0 1 6
Input 7 0 1 7
Input 8 0 1 8
Input 9 0 1 9
Input 10 0 1 10
Interp Resize_1 1 1 flow 64 0=2 1=2.000000e+00 2=2.000000e+00
BinaryOp Mul_3 1 1 64 66 0=2 1=1 2=2.000000e+00
Split splitncnn_0 1 3 66 66_splitncnn_0 66_splitncnn_1 66_splitncnn_2
Crop Slice_8 1 1 66_splitncnn_2 71 -23309=1,0 -23310=1,2 -23311=1,0
rife.Warp Warp_14 2 1 img0 71 77
Split splitncnn_1 1 2 77 77_splitncnn_0 77_splitncnn_1
Crop Slice_19 1 1 66_splitncnn_1 82 -23309=1,2 -23310=1,4 -23311=1,0
rife.Warp Warp_14 2 1 img1 82 88
Split splitncnn_2 1 2 88 88_splitncnn_0 88_splitncnn_1
Concat Concat_26 3 1 77_splitncnn_1 88_splitncnn_1 66_splitncnn_0 89
Convolution Conv_27 1 1 89 90 0=32 1=3 3=2 4=1 5=1 6=2880
PReLU PRelu_28 1 1 90 92 0=32
Convolution Conv_29 1 1 92 93 0=32 1=3 4=1 5=1 6=9216
PReLU PRelu_30 1 1 93 95 0=32
Convolution Conv_31 1 1 95 96 0=64 1=3 3=2 4=1 5=1 6=18432
PReLU PRelu_32 1 1 96 98 0=64
Convolution Conv_33 1 1 98 99 0=64 1=3 4=1 5=1 6=36864
PReLU PRelu_34 1 1 99 101 0=64
Split splitncnn_3 1 2 101 101_splitncnn_0 101_splitncnn_1
Concat Concat_35 3 1 101_splitncnn_1 3 7 102
Convolution Conv_36 1 1 102 103 0=128 1=3 3=2 4=1 5=1 6=147456
PReLU PRelu_37 1 1 103 105 0=128
Convolution Conv_38 1 1 105 106 0=128 1=3 4=1 5=1 6=147456
PReLU PRelu_39 1 1 106 108 0=128
Split splitncnn_4 1 2 108 108_splitncnn_0 108_splitncnn_1
Concat Concat_40 3 1 108_splitncnn_1 4 8 109
Convolution Conv_41 1 1 109 110 0=256 1=3 3=2 4=1 5=1 6=589824
PReLU PRelu_42 1 1 110 112 0=256
Convolution Conv_43 1 1 112 113 0=256 1=3 4=1 5=1 6=589824
PReLU PRelu_44 1 1 113 115 0=256
Split splitncnn_5 1 2 115 115_splitncnn_0 115_splitncnn_1
Concat Concat_45 3 1 115_splitncnn_1 5 9 116
Convolution Conv_46 1 1 116 117 0=512 1=3 3=2 4=1 5=1 6=2359296
PReLU PRelu_47 1 1 117 119 0=512
Convolution Conv_48 1 1 119 120 0=512 1=3 4=1 5=1 6=2359296
PReLU PRelu_49 1 1 120 122 0=512
Concat Concat_50 3 1 122 6 10 123
Deconvolution ConvTranspose_51 1 1 123 124 0=256 1=4 3=2 4=1 5=1 6=4194304
PReLU PRelu_52 1 1 124 126 0=256
Concat Concat_53 2 1 126 115_splitncnn_0 127
Deconvolution ConvTranspose_54 1 1 127 128 0=128 1=4 3=2 4=1 5=1 6=1048576
PReLU PRelu_55 1 1 128 130 0=128
Concat Concat_56 2 1 130 108_splitncnn_0 131
Deconvolution ConvTranspose_57 1 1 131 132 0=64 1=4 3=2 4=1 5=1 6=262144
PReLU PRelu_58 1 1 132 134 0=64
Concat Concat_59 2 1 134 101_splitncnn_0 135
Deconvolution ConvTranspose_60 1 1 135 136 0=32 1=4 3=2 4=1 5=1 6=65536
PReLU PRelu_61 1 1 136 138 0=32
Deconvolution ConvTranspose_62 1 1 138 140 0=4 1=4 3=2 4=1 5=1 6=2048 9=4
Split splitncnn_6 1 2 140 140_splitncnn_0 140_splitncnn_1
Crop Slice_68 1 1 140_splitncnn_1 145 -23309=1,0 -23310=1,3 -23311=1,0
BinaryOp Mul_70 1 1 145 147 0=2 1=1 2=2.000000e+00
BinaryOp Sub_72 1 1 147 149 0=1 1=1 2=1.000000e+00
Crop Slice_77 1 1 140_splitncnn_0 154 -23309=1,3 -23310=1,4 -23311=1,0
Split splitncnn_7 1 2 154 154_splitncnn_0 154_splitncnn_1
BinaryOp Mul_78 2 1 77_splitncnn_0 154_splitncnn_1 155 0=2
BinaryOp Sub_80 1 1 154_splitncnn_0 157 0=7 1=1 2=1.000000e+00
BinaryOp Mul_81 2 1 88_splitncnn_0 157 158 0=2
BinaryOp Add_82 2 1 155 158 159
BinaryOp Add_83 2 1 159 149 160
Clip Clip_84 1 1 160 output 0=0.000000e+00 1=1.000000e+00
2 changes: 1 addition & 1 deletion src/ncnn
Submodule ncnn updated 48 files
+3 −3 .github/workflows/web-assembly.yml
+10 −10 README.md
+4 −0 build-android.cmd
+7 −2 cmake/ncnnConfig.cmake.in
+56 −0 docs/how-to-build/build-mlir2ncnn.md
+6 −9 docs/how-to-build/how-to-build.md
+1 −0 python/setup.py.i
+12 −1 src/CMakeLists.txt
+51 −0 src/cpu.cpp
+9 −0 src/cpu.h
+4 −2,021 src/layer/arm/convolution_1x1.h
+4 −1,549 src/layer/arm/convolution_1x1_pack4.h
+4 −1,853 src/layer/arm/convolution_1x1_pack4_bf16s.h
+4 −761 src/layer/arm/convolution_1x1_pack8_fp16s.h
+141 −0 src/layer/arm/convolution_3x3_pack4.h
+310 −1,417 src/layer/arm/convolution_arm.cpp
+1 −4 src/layer/arm/convolution_arm.h
+115 −0 src/layer/arm/convolution_bf16s.h
+90 −0 src/layer/arm/convolution_fp16s.h
+131 −0 src/layer/arm/convolution_pack1to4.h
+131 −0 src/layer/arm/convolution_pack1to4_bf16s.h
+167 −0 src/layer/arm/convolution_pack1to4_fp16s.h
+90 −0 src/layer/arm/convolution_pack1to8_fp16s.h
+175 −0 src/layer/arm/convolution_pack4.h
+176 −0 src/layer/arm/convolution_pack4_bf16s.h
+183 −0 src/layer/arm/convolution_pack4_fp16s.h
+134 −0 src/layer/arm/convolution_pack4to1.h
+134 −0 src/layer/arm/convolution_pack4to1_bf16s.h
+171 −0 src/layer/arm/convolution_pack4to1_fp16s.h
+98 −0 src/layer/arm/convolution_pack4to8_fp16s.h
+106 −0 src/layer/arm/convolution_pack8_fp16s.h
+93 −0 src/layer/arm/convolution_pack8to1_fp16s.h
+106 −0 src/layer/arm/convolution_pack8to4_fp16s.h
+1,700 −1,389 src/layer/arm/convolution_sgemm.h
+1,688 −0 src/layer/arm/convolution_sgemm_pack4.h
+1,975 −0 src/layer/arm/convolution_sgemm_pack4_bf16s.h
+819 −0 src/layer/arm/convolution_sgemm_pack8_fp16s.h
+6 −0 src/layer/detectionoutput.cpp
+121 −6 src/layer/vulkan/pooling_vulkan.cpp
+3 −0 src/layer/vulkan/pooling_vulkan.h
+152 −0 src/layer/vulkan/shader/pooling_adaptive.comp
+152 −0 src/layer/vulkan/shader/pooling_adaptive_pack4.comp
+160 −0 src/layer/vulkan/shader/pooling_adaptive_pack8.comp
+58 −33 src/net.cpp
+2 −0 src/option.cpp
+8 −0 src/option.h
+2 −1 tests/test_convolution.cpp
+11 −36 tools/ncnnoptimize.cpp

0 comments on commit 6e0d8b2

Please sign in to comment.