Skip to content

Commit 3d7f6a2

Browse files
committedNov 22, 2019
eval using rd-cost
1 parent 7953b02 commit 3d7f6a2

File tree

5 files changed

+395
-8
lines changed

5 files changed

+395
-8
lines changed
 

‎README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,13 @@ The **loss** of our trained model on test set is: 3.1049
3636

3737
The **accuracy** of each label predicted on test set is: 66.12%
3838

39-
The best way to evaluate the model is to integrate the model into the HEVC encoder. I've conceived a pipeline:
39+
The best way to evaluate the model is to integrate the model into the HEVC encoder. I've realized a pipeline, see it in:
4040

41-
1. When HEVC encoder starts to process a new frame with frame number FrameNumber, it calls a command: ```python use_model.py -f FrameNumber```
42-
2. The script ```use_model.py``` takes FrameNumber as input. It also reads the ```bitstream.cfg``` to get the YUV filename the HEVC is currently processing. If FrameNumber is 0, it first use FFmpeg to extract frames from the YUV file. Then, it processes certain frame, and for all the CTUs in this frame, it generates a ```CtuNumber.txt``` with a 16x16 matrix in it and store all the txt in a folder ```ctu```.
43-
3. When HEVC encoder starts to process the CTU numbered CtuNumber, it goes to the ```ctu``` folder, find ```CtuNumber.txt``` and read the depths. In ```xCompressCU()```, if it's not at the predicted depth, then skip ```xCheckRDCostIntra()``` function.
41+
[HEVC-deep-learning-pipeline](https://github.com/wolverinn/HEVC-deep-learning-pipeline)
4442

45-
I've already realized ```use_model.py```. Find it in ```./model test pipeline```.
43+
Using this evaluating pipeline, we can compare the change in encoding time and BDBR at the same time.
4644

47-
Using this evaluating pipeline, we can compare the encoding time and BDBR at the same time.
48-
49-
I use a simpler approach to evaluate the increase in RD-cost for each YUV file. As ```xCompressCU()``` in HEVC encoder calculates the RD-cost exhaustively at each depth, we can get the RD-cost for every possible depth decision. Thus, we can realize comparison of RD-cost between the original encoder and the CNN model. See the ```model test pipeline``` folder for codes.
45+
Another way to evaluate the model is to compare the difference in RD-cost for each YUV file encoded. As ```xCompressCU()``` in HEVC encoder calculates the RD-cost exhaustively at each depth, we can get the RD-cost for every possible depth decision. Thus, we can realize comparison of RD-cost between the original encoder and the CNN model. See the ```test RD-cost``` folder for codes.
5046

5147
The increase in **RD cost** of our model is: 2.1% (tested only on one YUV sequence)
5248

‎test RD-cost/TAppEncoder.exe

3.63 MB
Binary file not shown.

‎test RD-cost/config/bitstream.cfg

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
InputFile : E:\HM\trunk\workspace\test_cost\flower_352x288_20.yuv
2+
InputBitDepth : 8
3+
InputChromaFormat : 420
4+
FrameRate : 20
5+
FrameSkip : 0
6+
SourceWidth : 352
7+
SourceHeight : 288
8+
FramesToBeEncoded : 10000
9+
Level : 3.1
+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#======== File I/O =====================
2+
BitstreamFile : .\\config\\str.bin
3+
ReconFile : .\\config\\rec.yuv
4+
5+
#======== Profile ================
6+
Profile : main
7+
8+
#======== Unit definition ================
9+
MaxCUWidth : 64 # Maximum coding unit width in pixel
10+
MaxCUHeight : 64 # Maximum coding unit height in pixel
11+
MaxPartitionDepth : 4 # Maximum coding unit depth
12+
QuadtreeTULog2MaxSize : 5 # Log2 of maximum transform size for
13+
# quadtree-based TU coding (2...6)
14+
QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for
15+
# quadtree-based TU coding (2...6)
16+
QuadtreeTUMaxDepthInter : 3
17+
QuadtreeTUMaxDepthIntra : 3
18+
19+
#======== Coding Structure =============
20+
IntraPeriod : 1 # Period of I-Frame ( -1 = only first)
21+
DecodingRefreshType : 1 # Random Accesss 0:none, 1:CRA, 2:IDR, 3:Recovery Point SEI
22+
GOPSize : 1 # GOP Size (number of B slice = GOPSize-1)
23+
ReWriteParamSetsFlag : 1 # Write parameter sets with every IRAP
24+
25+
#=========== Motion Search =============
26+
FastSearch : 1 # 0:Full search 1:TZ search
27+
SearchRange : 64 # (0: Search range is a Full frame)
28+
HadamardME : 1 # Use of hadamard measure for fractional ME
29+
FEN : 1 # Fast encoder decision
30+
FDM : 1 # Fast Decision for Merge RD cost
31+
32+
#======== Quantization =============
33+
QP : 37 # Quantization parameter(0-51)
34+
MaxDeltaQP : 0 # CU-based multi-QP optimization
35+
MaxCuDQPDepth : 0 # Max depth of a minimum CuDQP for sub-LCU-level delta QP
36+
DeltaQpRD : 0 # Slice-based multi-QP optimization
37+
RDOQ : 1 # RDOQ
38+
RDOQTS : 1 # RDOQ for transform skip
39+
40+
#=========== Deblock Filter ============
41+
LoopFilterOffsetInPPS : 1 # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1 (default) =constant params in PPS, param = base_param)
42+
LoopFilterDisable : 0 # Disable deblocking filter (0=Filter, 1=No Filter)
43+
LoopFilterBetaOffset_div2 : 0 # base_param: -6 ~ 6
44+
LoopFilterTcOffset_div2 : 0 # base_param: -6 ~ 6
45+
DeblockingFilterMetric : 0 # blockiness metric (automatically configures deblocking parameters in bitstream). Applies slice-level loop filter offsets (LoopFilterOffsetInPPS and LoopFilterDisable must be 0)
46+
47+
#=========== Misc. ============
48+
InternalBitDepth : 8 # codec operating bit-depth
49+
50+
#=========== Coding Tools =================
51+
SAO : 1 # Sample adaptive offset (0: OFF, 1: ON)
52+
AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON)
53+
TransformSkip : 1 # Transform skipping (0: OFF, 1: ON)
54+
TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON)
55+
SAOLcuBoundary : 0 # SAOLcuBoundary using non-deblocked pixels (0: OFF, 1: ON)
56+
57+
#============ Slices ================
58+
SliceMode : 0 # 0: Disable all slice options.
59+
# 1: Enforce maximum number of LCU in an slice,
60+
# 2: Enforce maximum number of bytes in an 'slice'
61+
# 3: Enforce maximum number of tiles in a slice
62+
SliceArgument : 1500 # Argument for 'SliceMode'.
63+
# If SliceMode==1 it represents max. SliceGranularity-sized blocks per slice.
64+
# If SliceMode==2 it represents max. bytes per slice.
65+
# If SliceMode==3 it represents max. tiles per slice.
66+
67+
LFCrossSliceBoundaryFlag : 1 # In-loop filtering, including ALF and DB, is across or not across slice boundary.
68+
# 0:not across, 1: across
69+
70+
#============ PCM ================
71+
PCMEnabledFlag : 0 # 0: No PCM mode
72+
PCMLog2MaxSize : 5 # Log2 of maximum PCM block size.
73+
PCMLog2MinSize : 3 # Log2 of minimum PCM block size.
74+
PCMInputBitDepthFlag : 1 # 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
75+
PCMFilterDisableFlag : 0 # 0: Enable loop filtering on I_PCM samples. 1: Disable loop filtering on I_PCM samples.
76+
77+
#============ Tiles ================
78+
TileUniformSpacing : 0 # 0: the column boundaries are indicated by TileColumnWidth array, the row boundaries are indicated by TileRowHeight array
79+
# 1: the column and row boundaries are distributed uniformly
80+
NumTileColumnsMinus1 : 0 # Number of tile columns in a picture minus 1
81+
TileColumnWidthArray : 2 3 # Array containing tile column width values in units of CTU (from left to right in picture)
82+
NumTileRowsMinus1 : 0 # Number of tile rows in a picture minus 1
83+
TileRowHeightArray : 2 # Array containing tile row height values in units of CTU (from top to bottom in picture)
84+
85+
LFCrossTileBoundaryFlag : 1 # In-loop filtering is across or not across tile boundary.
86+
# 0:not across, 1: across
87+
88+
#============ WaveFront ================
89+
WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).
90+
# >0: WaveFront synchronises with the LCU above and to the right by this many LCUs.
91+
92+
#=========== Quantization Matrix =================
93+
ScalingList : 0 # ScalingList 0 : off, 1 : default, 2 : file read
94+
ScalingListFile : scaling_list.txt # Scaling List file name. If file is not exist, use Default Matrix.
95+
96+
#============ Lossless ================
97+
TransquantBypassEnable : 0 # Value of PPS flag.
98+
CUTransquantBypassFlagForce: 0 # Force transquant bypass mode, when transquant_bypass_enable_flag is enabled
99+
100+
### DO NOT ADD ANYTHING BELOW THIS LINE ###
101+
### DO NOT DELETE THE EMPTY LINE BELOW ###

0 commit comments

Comments
 (0)