Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Code for optical flow estimation (Summer internship project @ 2019) #516

Draft
wants to merge 132 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
34ccc65
Update .gitignore
Aug 27, 2019
f77be7e
Update .gitignore
Aug 27, 2019
331129e
Add flownet_s_v1
Aug 28, 2019
4a5f0fe
Add _deconv _predict_flow
Aug 29, 2019
39bfa4b
Finish refinement layer
Aug 29, 2019
ff0373f
Add more network structure
Aug 29, 2019
3601dac
flownet_s_v1.py: Add summary for each losses, split base function int…
Sep 2, 2019
a482b91
Add more losses
Sep 2, 2019
0cc652a
Add flowlib.py
Sep 2, 2019
3056d6e
Add summary
Sep 2, 2019
04ff7e0
Create test file for flownet s v1
Sep 2, 2019
898a87a
Create test file
Sep 2, 2019
a3cfcb1
Rename test directory
Sep 2, 2019
2b530fb
Resolve .so path import error
Sep 2, 2019
9e74172
Add unit test
Sep 3, 2019
b994cab
Add test_deconv
Sep 3, 2019
23290f4
Set bias_initializer to None in deconv
Sep 3, 2019
d944846
Add a test for downsample
Sep 3, 2019
48a5d38
Fix keep_dims to keepdims
Sep 3, 2019
77b886b
Add a test for epe
Sep 3, 2019
2386182
Fix conv3_1 not taking in conv2
Sep 3, 2019
548f539
Add a test for contractive_block
Sep 3, 2019
aceb354
Fix conv_2 to conv2
Sep 3, 2019
7bb8ef9
Add a test for refinement layer
Sep 3, 2019
62b8040
Add config
Sep 3, 2019
df03aa5
2018 to 2019
Sep 3, 2019
81474be
Skeleton for test_training
Sep 3, 2019
605dd75
Add data augmentation
Sep 4, 2019
5a33e09
return empty dict and no_op in metrics()
Sep 4, 2019
86efe70
Improve comments
Sep 4, 2019
6d95fe9
[create] dataloader for optical flow estimation
Sep 5, 2019
d752a48
Make average EPE the average of all pixels in an image
Sep 5, 2019
70742cd
TODO: move the third party lib functions into our code
Sep 5, 2019
3f380b9
Merge pull request #1 from ki-lm/master
OscarWang114 Sep 5, 2019
70da84b
[modify] keywords
Sep 5, 2019
a3da860
[modify] ratio => rate
Sep 5, 2019
e7b400e
Change validation ratio to validation rate
Sep 5, 2019
f9214bd
Merge pull request #2 from ki-lm/master
OscarWang114 Sep 5, 2019
8cf5686
[modify] OpticalFlowEstimationBase.classes
Sep 5, 2019
64907ce
Rename NHCW to NHWC
Sep 5, 2019
f3ac840
Bug fixes for test training
Sep 5, 2019
b90359d
Force add downsample.so
Sep 5, 2019
f8716fe
Add dataset in config file
Sep 5, 2019
b031e5e
Remove weight decay rate from config file
Sep 5, 2019
b0d16fe
Temporarily unimport png in flowlib
Sep 5, 2019
59d233c
Change momentum to beta for Adam in config file
Sep 5, 2019
b4afe1e
Change validataion_rate to 0.1 in config file
Sep 5, 2019
e6bd68d
[modify] params
Sep 5, 2019
2f87684
[create] dataset_augmentator
Sep 12, 2019
71d94f5
Create quantized network for optical flow estimation
Sep 12, 2019
123211c
[modify] optical_flow_estimation/data_loader
Sep 12, 2019
dad3c89
Merge branch 'master' of https://github.com/blue-oil/blueoil
Sep 12, 2019
1962374
Add a unit test for quantized network
Sep 12, 2019
c214b03
Add quantize config file
Sep 12, 2019
1d20178
Remove v2, change config process num
Sep 12, 2019
44e4ce2
[modify] solve conflict
Sep 12, 2019
cea8de3
[modify] optical_flow_estmation/predict.py
Sep 17, 2019
67cdd1c
Merge branch 'master' of https://github.com/blue-oil/blueoil
Sep 17, 2019
7eb7e3f
Add option to disable quantization of activation before last layer
Sep 17, 2019
6f0ece4
Merge branch 'master' of https://github.com/blue-oil/blueoil
Sep 17, 2019
3b0e411
Add quantize_activation_before_last_layer option
Sep 17, 2019
5826d9e
Create flownet s v2
Sep 17, 2019
4b88a43
Rename env in unit test to v2:
Sep 17, 2019
3dd0237
Change process numbers
Sep 17, 2019
ca442d0
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 17, 2019
51e58cd
[modify] dataset_loader
Sep 17, 2019
10fbaeb
Replace conv2d transpose with depth_to_space and conv2d
Sep 17, 2019
fd6025c
Merge branch 'master' of https://github.com/ki-lm/blueoil
Sep 17, 2019
190abcb
Fix placeholders typo
Sep 17, 2019
ee85462
Restore conv2d_transpose temporarily
Sep 17, 2019
acbf6af
Change train process num to 20
Sep 18, 2019
2c7a05b
flownet s v3
Sep 18, 2019
e1ba294
Merge branch 'master' of https://github.com/blue-oil/blueoil
Sep 18, 2019
951c404
Process num 20 -> 10
Sep 18, 2019
ab0f08e
Merge branch 'master' of https://github.com/blue-oil/blueoil
Sep 19, 2019
d45b8d6
[modify] lmnet demo
Sep 19, 2019
b9939d3
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 19, 2019
752647a
Create v2 aee quantize
Sep 19, 2019
41441d7
Fix nearest neighbor resize
Sep 19, 2019
b5b5b61
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 20, 2019
00b1f2d
make Quantized format ChHWBCl
Sep 20, 2019
24712a6
[create] discretized_flow_vector
Sep 20, 2019
ab76166
s_v3_q config: Learning rate, quantize activation before last layer
Sep 20, 2019
59386d9
Create flownet q
Sep 20, 2019
8bb4b03
Update s v3 network
Sep 20, 2019
b72f03e
Add test config and test for s v3
Sep 20, 2019
95d7433
Merge branch 'fix/layout' of https://github.com/primenumber/blueoil
Sep 20, 2019
424c536
Fix import
Sep 20, 2019
53cabba
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 20, 2019
b115337
Merge branch 'fix/layout' of https://github.com/primenumber/blueoil
Sep 20, 2019
23a0eea
Fix dimension order
Sep 20, 2019
c6e4a5d
Merge branch 'master' into fix/layout
primenumber Sep 20, 2019
7d50e9f
Merge branch 'master' into fix/layout
primenumber Sep 20, 2019
b646b9c
Add FlyingChair images
Sep 20, 2019
9af091d
Change save checkpiont steps
Sep 20, 2019
b48e00a
Restore shape for QTZ_linear_mid_tread_half
Sep 20, 2019
5a83bb3
Do pass_propagate_output_type_backward always
Sep 24, 2019
a8ad2e0
Merge branch 'master' into fix/layout
primenumber Sep 24, 2019
6cde282
Create v4, forcing depth in space to depth to be a multiple of 32
Sep 24, 2019
e8ae2b4
Fix depth calculation for concat_on_depth
Sep 24, 2019
7c4fae0
Fix dimension
Sep 24, 2019
afe440b
Upsample flow filter numbers 2 -> 32
Sep 24, 2019
20ef5ff
Fix merge conflicts
Sep 24, 2019
5d78ce8
Merge branch 'fix/layout' of https://github.com/primenumber/blueoil
Sep 24, 2019
be1477d
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 24, 2019
a6e644a
[create] remote server demo
Sep 24, 2019
2fee76e
V4
Sep 24, 2019
0fa258c
Merge branch 'master' of https://github.com/ki-lm/blueoil
Sep 24, 2019
ff6443b
Save 20 checkpoints
Sep 25, 2019
3fc60d9
Fix wrong command in note.md
Sep 25, 2019
f19b340
Fix mistake in channel numbers
Sep 25, 2019
1d34844
Add make file section
Sep 25, 2019
3808a40
[create] demolib
Sep 26, 2019
30fd7f9
[modify] camera_id
Sep 26, 2019
11e7899
Merge branch 'master' of https://github.com/OscarWang114/blueoil
Sep 26, 2019
e852ec8
Remove Default network test .diff
Sep 26, 2019
e418a28
Update v4 structure
Sep 26, 2019
aab0aa1
[modify] rename class name
Sep 26, 2019
f1835b6
Rename network file and class names
Sep 26, 2019
0b0eba6
Merge branch 'master' of https://github.com/blue-oil/blueoil
Oct 1, 2019
497543f
[modify] class name of optical flow
Oct 1, 2019
7749d0d
[create] v2 and half
Oct 2, 2019
dce7ea2
[create] generalized version of lmflownet
Oct 3, 2019
81ec9d7
[modify] bugfix at quantizer
Oct 3, 2019
2a0cfab
[create] new config files
Oct 4, 2019
9e82b94
[modify] config parameters
Oct 4, 2019
40a759c
Merge branch 'master' of https://github.com/blue-oil/blueoil
Oct 8, 2019
77a9897
[modify] quantized network layer
Oct 8, 2019
4512966
[modify] bug fix at flownet
Oct 8, 2019
6aafda7
[create] 3a 3b 3c
Oct 9, 2019
79033d4
[create] add scripts
Oct 11, 2019
5f7a17e
[modify] fix typo
Oct 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ ENV/
/dataset/
/config/
/tmp/
.DS_Store
.idea
4 changes: 4 additions & 0 deletions dlk/python/dlk/core/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,7 @@ def __init__(self,
dimension_format: str = 'NHWC') -> None:
"""Init this quantization operator."""
super().__init__(name, shape, dtype, input_ops, dimension_format=dimension_format)
self._original_shape = shape

def _check_consistency(self) -> None:
super()._check_consistency()
Expand Down Expand Up @@ -1499,6 +1500,9 @@ def binarizer(self, data: np.ndarray) -> np.ndarray:
"""Maps the quantized values into >= 0 integer values."""
return data

def restore_shape(self):
self.update_shape(self._original_shape, 'NHWC')


class Add(Operator):
"""Add operator.
Expand Down
22 changes: 20 additions & 2 deletions dlk/python/dlk/core/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,25 @@ def pass_quantize_convolutions(graph: Graph) -> None:
width = qtz.width
depth = qtz.channel
depth_upper = (depth + b - 1) // b
qtz.update_shape([height, width, depth_upper, 2, b], "HWChBCl")
qtz.update_shape([depth_upper, height, width, 2, b], "ChHWBCl")


def pass_fix_qtz_types_and_format(graph) -> None:
"""output of QTZ_linear_mid_tread_half is:
PackedUint32 type, ChHWBCl layout

Parameters
----------
graph : Graph
The input graph. It will be modified in-place.
"""
exec_list = sort_graph(graph)
for m in exec_list:
if m.op_type == 'QTZ_linear_mid_tread_half' and m.dimension != 'ChHWBCl':
m.dtype = PackedUint32()
b = 32
shape = [(m.channel + b - 1) // b, m.height, m.width, 2, b]
m.update_shape(shape, 'ChHWBCl')


def pass_propagate_datatypes(graph) -> None:
Expand Down Expand Up @@ -561,7 +579,7 @@ def pass_propagate_output_type_backward(graph: Graph) -> None:

def output_dtype_changer(node, otype):
for n in node.input_nodes:
if n.op_type == 'Conv' and n.is_quantized:
if (n.op_type == 'Conv' and n.is_quantized) or n.op_type == 'QTZ_linear_mid_tread_half':
n.restore_shape()
n.dtype = otype
return
Expand Down
10 changes: 5 additions & 5 deletions dlk/python/dlk/scripts/generate_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
from frontend import TensorFlowIO
from core.optimizer import pass_remove_identities, pass_transpose, pass_constant_folding, \
pass_propagate_quantization_details_into_conv, pass_compute_thresholds, pass_pack_weights, \
pass_quantize_convolutions, pass_propagate_datatypes, \
pass_propagate_format, pass_propagate_output_type_backward, \
pass_lookup
pass_quantize_convolutions, pass_fix_qtz_types_and_format, \
pass_propagate_datatypes, pass_propagate_format, \
pass_propagate_output_type_backward, pass_lookup

SCRITPS_DIR = path.abspath(path.dirname(__file__))
DLK_ROOT_DIR = path.abspath(path.join(SCRITPS_DIR, '..'))
Expand Down Expand Up @@ -63,9 +63,9 @@ def optimize_graph_step(model: Model, config: Config) -> None:
pass_compute_thresholds(graph)
pass_pack_weights(graph)
pass_quantize_convolutions(graph)
pass_fix_qtz_types_and_format(graph)

if config.threshold_skipping:
pass_propagate_output_type_backward(graph)
pass_propagate_output_type_backward(graph)
pass_propagate_datatypes(graph)
pass_propagate_format(graph)

Expand Down
19 changes: 15 additions & 4 deletions dlk/python/dlk/templates/Makefile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,36 @@ clean:
-$(RM) *.so
-$(RM) $(LIB_OBJ)
-$(RM) $(LIB_X86_OBJ)
-$(RM) $(LIB_X86_AVX_OBJ)
-$(RM) $(LIB_ARM_OBJ)
-$(RM) $(LIB_FPGA_OBJ)
-$(RM) $(LIB_AARCH64_OBJ)
-$(RM) $(OBJ)

.PHONY: clear
clear:
-$(RM) $(LIB_OBJ)
-$(RM) $(LIB_X86_OBJ)
-$(RM) $(LIB_X86_AVX_OBJ)
-$(RM) $(LIB_ARM_OBJ)
-$(RM) $(LIB_FPGA_OBJ)
-$(RM) $(LIB_AARCH64_OBJ)
-$(RM) $(OBJ)

lm_x86: CXX = g++
lm_x86: FLAGS += $(INCLUDES) -O3 -std=c++14 -DUSE_PNG -pthread -g
lm_x86: FLAGS += $(INCLUDES) -O3 -std=c++14 -DUSE_PNG -pthread -g -DFUNC_TIME_MEASUREMENT
lm_x86: CXXFLAGS +=

lm_x86_avx: CXX = g++
lm_x86_avx: FLAGS += $(INCLUDES) -O3 -std=c++14 -mavx2 -mfma -DUSE_AVX -DUSE_PNG -pthread -g -fopenmp
lm_x86_avx: FLAGS += $(INCLUDES) -O3 -std=c++14 -mavx2 -mfma -DUSE_AVX -DUSE_PNG -pthread -g -fopenmp -DFUNC_TIME_MEASUREMENT
lm_x86_avx: CXXFLAGS +=

lm_aarch64: CXX = aarch64-linux-gnu-g++
lm_aarch64: FLAGS += $(INCLUDES) -std=c++14 -O3 -DUSE_NEON -DUSE_PNG -pthread -g -fopenmp
lm_aarch64: FLAGS += $(INCLUDES) -std=c++14 -O3 -DUSE_NEON -DUSE_PNG -pthread -g -fopenmp -DFUNC_TIME_MEASUREMENT
lm_aarch64: CXXFLAGS +=

lm_arm: CXX = arm-linux-gnueabihf-g++
lm_arm: FLAGS += $(INCLUDES) -std=c++14 -O3 -DUSE_NEON -DUSE_PNG -DAARCH32 -mcpu=cortex-a9 -mfpu=neon -mthumb -s -pthread -g -fopenmp
lm_arm: FLAGS += $(INCLUDES) -std=c++14 -O3 -DUSE_NEON -DUSE_PNG -DAARCH32 -mcpu=cortex-a9 -mfpu=neon -mthumb -s -pthread -g -fopenmp -DFUNC_TIME_MEASUREMENT
lm_arm: CXXFLAGS +=

lm_fpga: CXX = arm-linux-gnueabihf-g++
Expand Down
6 changes: 6 additions & 0 deletions dlk/python/dlk/templates/include/quantizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::Atom>& max_value,
const TensorView<QUANTIZED_PACKED, MemoryLayout::HWChBCl>& output);

void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::NHWC>& input,
const TensorView<T_INT, MemoryLayout::Atom>& nbit,
const TensorView<T_FLOAT, MemoryLayout::Atom>& max_value,
const TensorView<QUANTIZED_PACKED, MemoryLayout::ChHWBCl>& output);

void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::NHWC>& input,
const TensorView<T_INT, MemoryLayout::Atom>& nbit,
Expand Down
19 changes: 19 additions & 0 deletions dlk/python/dlk/templates/src/quantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ limitations under the License.
#include "quantizer.h"
#include "pack_input_to_qwords.h"
#include "time_measurement.h"
#include "tensor_convert.h"
#ifdef USE_NEON
#include <arm_neon.h>
#endif
Expand Down Expand Up @@ -152,6 +153,7 @@ void func_QTZ_linear_mid_tread_half_body(
}

static const auto output_not_packed = std::make_unique<QUANTIZED_NOT_PACKED[]>(MAX_SIZE_INPUTS_PER_LAYER);
static const auto output_packed = std::make_unique<QUANTIZED_PACKED[]>(MAX_SIZE_QINPUTS_PER_LAYER);

void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::NHWC>& input,
Expand Down Expand Up @@ -184,6 +186,23 @@ void func_QTZ_linear_mid_tread_half(
Measurement::Stop();
}

void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::NHWC>& input,
const TensorView<T_INT, MemoryLayout::Atom>& nbit,
const TensorView<T_FLOAT, MemoryLayout::Atom>& max_value,
const TensorView<QUANTIZED_PACKED, MemoryLayout::ChHWBCl>& output) {
const auto out_shape = output.get_shape();
const auto out_height = out_shape[1];
const auto out_width = out_shape[2];
const auto out_depth = out_shape[0];
TensorView<QUANTIZED_PACKED, MemoryLayout::HWChBCl>::tensor_info_t<std::size_t> shape = {
out_height, out_width, out_depth, nbit(), QUANTIZED_PACKED::BitCount
};
TensorView<QUANTIZED_PACKED, MemoryLayout::HWChBCl> tmp(output_packed.get(), shape);
func_QTZ_linear_mid_tread_half(input, nbit, max_value, tmp);
convert_tensor(tmp, output);
}

void func_QTZ_linear_mid_tread_half(
const TensorView<T_FLOAT, MemoryLayout::NHWC>& input,
const TensorView<T_INT, MemoryLayout::Atom>& nbit,
Expand Down
149 changes: 149 additions & 0 deletions lmnet/configs/core/optical_flow_estimation/backup/flownet_q_v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# -*- coding: utf-8 -*-
# Copyright 2019 The Blueoil Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================

import numpy as np
import tensorflow as tf
from easydict import EasyDict

from lmnet.common import Tasks
from lmnet.data_processor import Sequence
from lmnet.networks.optical_flow_estimation.flownet_q_v1 import (
FlowNetQV1
)
from lmnet.datasets.optical_flow_estimation import (
FlyingChairs, ChairsSDHom
)
from lmnet.networks.optical_flow_estimation.data_augmentor import (
Brightness, Color, Contrast, Gamma, GaussianBlur, GaussianNoise, Hue,
FlipLeftRight, FlipTopBottom, Identity, Scale, Rotate, Translate
)
from lmnet.networks.optical_flow_estimation.pre_processor import (
DevideBy255, DiscretizeFlow
)

NETWORK_CLASS = FlowNetQV1
DATASET_CLASS = FlyingChairs

IMAGE_SIZE = [384, 512]
DATA_FORMAT = "NHWC"
TASK = Tasks.OPTICAL_FLOW_ESTIMATION

# NOTE (by ki-42) the number of the label should be SPLIT_NUM + 1
THRESHOLD_RADIUS = 10.0
SPLIT_NUM = 10
DATASET_CLASS.classes = [_ for _ in range(SPLIT_NUM + 1)]
NETWORK_CLASS.split_num = SPLIT_NUM
NETWORK_CLASS.threshold_radius = THRESHOLD_RADIUS
CLASSES = DATASET_CLASS.classes

IS_DEBUG = False
MAX_STEPS = 1200000
SAVE_CHECKPOINT_STEPS = 5000
KEEP_CHECKPOINT_MAX = 5
TEST_STEPS = 250
SUMMARISE_STEPS = 250
BATCH_SIZE = 8

# for debugging
# IS_DEBUG = True
# MAX_STEPS = 10
# BATCH_SIZE = 31
# SAVE_CHECKPOINT_STEPS = 2
# KEEP_CHECKPOINT_MAX = 5
# TEST_STEPS = 10
# SUMMARISE_STEPS = 2

# pretrain
IS_PRETRAIN = False
PRETRAIN_VARS = []
PRETRAIN_DIR = ""
PRETRAIN_FILE = ""

# distributed training
IS_DISTRIBUTION = False

PRE_PROCESSOR = Sequence([
DevideBy255(),
DiscretizeFlow(THRESHOLD_RADIUS, SPLIT_NUM)
])
POST_PROCESSOR = None

NETWORK = EasyDict()
NETWORK.OPTIMIZER_CLASS = tf.train.AdamOptimizer
NETWORK.OPTIMIZER_KWARGS = {"beta1": 0.9, "beta2": 0.999}
NETWORK.LEARNING_RATE_FUNC = tf.train.piecewise_constant
NETWORK.LEARNING_RATE_KWARGS = {
# "values": [0.0001, 0.00005, 0.000025, 0.0000125, 0.00000625],
# "boundaries": [400000, 600000, 800000, 1000000],
"values": [0.001, 0.0005, 0.00025, 0.000125, 0.0000625],
"boundaries": [400000, 600000, 800000, 1000000],
}
NETWORK.WEIGHT_DECAY_RATE = 0.0004
NETWORK.IMAGE_SIZE = IMAGE_SIZE
NETWORK.BATCH_SIZE = BATCH_SIZE
NETWORK.DATA_FORMAT = DATA_FORMAT

# dataset
DATASET = EasyDict()
DATASET.BATCH_SIZE = BATCH_SIZE
DATASET.DATA_FORMAT = DATA_FORMAT
DATASET.TRAIN_ENABLE_PREFETCH = True
DATASET.TRAIN_PROCESS_NUM = 10
DATASET.TRAIN_QUEUE_SIZE = 1000
DATASET.VALIDATION_ENABLE_PREFETCH = True
DATASET.VALIDATION_PRE_LOAD = False
DATASET.VALIDATION_PROCESS_NUM = 1
DATASET.VALIDATION_QUEUE_SIZE = 250
DATASET.VALIDATION_RATE = 0.1
DATASET.VALIDATION_SEED = 2019

# TODO I use default values because the metrics used in the paper are different.
# I didn't add Gaussian Blur because it's different from Gaussian Noise.
# Augmentation is not available in pytorch repo

# NOTE (by KI-42) in the FlowNetS paper, the following augmentations were used.
# Geometric transformation
# translation U([-20 %, +20 %])
# rotation U([-17 deg, +17 deg])
# scaling U([0.9, 2.0])
# Pixel-Wise transformation
# Gaussian noise N(0, 1) * U([0.0, 0.04 * (255)])
# contrast U([0.2, 1.4])
# color U([0.5, 2.0])
# gamma U([0.7, 1.5])
# brightness 1 + 0.2 * N(0, 1)

# NOTE (by KI-42) in this setup, I modified the augmentation setup described above a little bit.
# hue U([-128 deg, 128 deg])
# brightness U(0.6, 1.4)

DATASET.AUGMENTOR = Sequence([
# Geometric transformation
# FlipLeftRight(0.5),
# FlipTopBottom(0.5),
Translate(-0.1, 0.1),
Rotate(-5, +5),
# Scale(1.0, 2.0),
# Pixel-wise augmentation
Brightness(0.6, 1.4),
Contrast(0.2, 1.4),
Color(0.5, 2.0),
Gamma(0.7, 1.5),
# Hue(-128.0, 128.0),
GaussianNoise(10.0)
# GaussianBlur(0.0, 2.0)
])
DATASET.PRE_PROCESSOR = PRE_PROCESSOR
Loading