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

[WIP] Add the config file of parameter tuner for object detection #275

Open
wants to merge 792 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
792 commits
Select commit Hold shift + click to select a range
a7d5a5b
fix copyright labels
Jan 29, 2019
6a80e05
Merge branch 'master' into enable_aarch64_llvm_build
lm-konda Jan 29, 2019
ac5d33f
Merge branch 'master' into improve_cache_locality
lm-konda Jan 29, 2019
1e6034d
Merge branch 'master' into element-tree
ruimashita Jan 29, 2019
8654571
add assertion to pad for channel-wise paddings
Jan 29, 2019
3a465a4
refactor generic kn2row
lm-konda Jan 30, 2019
bc03e41
improve avepooling performance
lm-konda Jan 30, 2019
79b00c9
improve maxpooling
lm-konda Jan 30, 2019
5a6a888
fix typo and errors
Jan 30, 2019
1d3f920
patch optimizer selector
iizukak Jan 31, 2019
c8b8f53
Merge pull request #2 from iizukak/patch_optimizer_selector
lm-konda Jan 31, 2019
5059034
fix document broken
iizukak Jan 31, 2019
af728f3
Fix selection AdamOptimizer -> Adam
iizukak Jan 31, 2019
c911d37
little fix documentation
iizukak Jan 31, 2019
92150e2
Fix some docs
iizukak Jan 31, 2019
ae836df
Merge pull request #107 from ruimashita/element-tree
ruimashita Jan 31, 2019
921ee1c
Merge branch 'master' into kernel_transform
ruimashita Jan 31, 2019
4e53a56
update pyyaml version for security
ruimashita Jan 31, 2019
3f4fb40
Merge branch 'master' into simplify_optimizer
ruimashita Jan 31, 2019
fceec27
Merge branch 'master' into feature/resnet
ruimashita Jan 31, 2019
fe7b69f
Merge pull request #53 from antonionevado/simplify_optimizer
ruimashita Jan 31, 2019
56d68d4
Merge pull request #3 from iizukak/patch2_optimizer_selector
lm-konda Feb 1, 2019
7a4bbe1
Merge branch 'master' into optimizer_selector
lm-konda Feb 1, 2019
96ba0be
Merge branch 'master' into kernel_transform
lm-konda Feb 1, 2019
6455010
Merge branch 'master' into feature/resnet
nlpng Feb 1, 2019
9782592
remove unnecessary code from merging
Feb 1, 2019
8fb71df
enable graph opt
lm-konda Feb 1, 2019
4248338
Merge branch 'master' into improve_avepooling
ruimashita Feb 1, 2019
5be44d6
Merge branch 'master' into improve_maxpooling
ruimashita Feb 1, 2019
7a9e9a6
fix PEP8 and split operator
Feb 1, 2019
e1bf3f2
Merge branch 'master' into update_pyyaml_version
ruimashita Feb 2, 2019
1e32071
Merge pull request #137 from lm-konda/improve_maxpooling
ruimashita Feb 2, 2019
a34f756
Merge branch 'master' into improve_avepooling
ruimashita Feb 2, 2019
552dd79
Merge branch 'master' into update_pyyaml_version
ruimashita Feb 2, 2019
1d1a732
Merge pull request #136 from lm-konda/improve_avepooling
ruimashita Feb 2, 2019
3e395ce
Merge branch 'master' into refactoring_generic_kn2row
ruimashita Feb 2, 2019
c604fc1
Merge pull request #135 from lm-konda/refactoring_generic_kn2row
ruimashita Feb 3, 2019
32a4e7d
Merge remote-tracking branch 'aa/master' into kernel_transform
lm-konda Feb 4, 2019
fedce8d
Merge branch 'master' into optimizer_selector
lm-konda Feb 4, 2019
9cc8c10
fix kernel transpose
lm-konda Feb 4, 2019
a62ab50
fix line
lm-konda Feb 4, 2019
82663ee
Merge branch 'master' into update_pyyaml_version
ruimashita Feb 4, 2019
347ede9
refactoring
lm-konda Feb 4, 2019
28ace4d
Merge branch 'master' into add_qconv_kn2row_tiling
Feb 5, 2019
448bff0
- Modified run.py and usb_camera_demo.py to accept protocol buffer fi…
Joeper214 Feb 5, 2019
b877a5e
Merge branch 'master' into output_gpu_inference_model
Joeper214 Feb 5, 2019
6260575
revert use of Opencv python3
Joeper214 Feb 5, 2019
52f1377
Merge branch 'output_gpu_inference_model' of github.com:Joeper214/blu…
Joeper214 Feb 5, 2019
5dfa0d8
Fix non-existing path
kination Feb 5, 2019
eb5d4ad
- Add License to protobuf loader file
Joeper214 Feb 5, 2019
f6a924e
fix optimizer selection
lm-konda Feb 5, 2019
957a059
Merge branch 'optimizer_selector' of github.com:lm-konda/blueoil into…
lm-konda Feb 5, 2019
1941707
fix blueoil control
lm-konda Feb 6, 2019
788519e
refactoring
lm-konda Feb 6, 2019
9d97d47
move weight decay rate to config file
Feb 6, 2019
fd1d342
Merge branch 'master' into runtime_imageresize
yoya Feb 6, 2019
310e5ff
Merge branch 'master' into feature/resnet
ruimashita Feb 6, 2019
3acb246
Merge pull request #145 from djKooks/fix-default-path
ruimashita Feb 6, 2019
a35dc05
Merge branch 'master' into feature/resnet
ruimashita Feb 6, 2019
33c3635
- Update protobuf loader
Joeper214 Feb 6, 2019
ca7d228
Merge pull request #65 from nlpng/feature/resnet
ruimashita Feb 6, 2019
cb218fe
Update Readme of output_template
Joeper214 Feb 6, 2019
951e504
Merge branch 'master' into output_gpu_inference_model
Joeper214 Feb 6, 2019
55b168e
fix naming convention
lm-konda Feb 7, 2019
aeabe9d
refactoring
lm-konda Feb 7, 2019
68ad5c4
- Add comments for Wrapper classes
Joeper214 Feb 7, 2019
0e03ba1
fix learning rate setting
lm-konda Feb 7, 2019
5763a23
add comments for global function
lm-konda Feb 7, 2019
3f2ca96
Merge branch 'master' into optimizer_selector
ruimashita Feb 7, 2019
c02f697
reduce constant fold and refactoring
lm-konda Feb 7, 2019
2652e44
Move pool interface to utilities folder
Joeper214 Feb 7, 2019
855a88f
Merge branch 'master' into update_pyyaml_version
ruimashita Feb 7, 2019
4d07e4f
Merge pull request #28 from lm-konda/optimizer_selector
ruimashita Feb 7, 2019
8a9cb3f
Merge branch 'master' into update_pyyaml_version
ruimashita Feb 7, 2019
94488d9
Merge pull request #142 from ruimashita/update_pyyaml_version
ruimashita Feb 7, 2019
5374f8b
Merge branch 'master' into enable_aarch64_llvm_build
iizukak Feb 8, 2019
bf3e869
Update documentation
Joeper214 Feb 8, 2019
9703b39
Turned off a8w1_conv and change the name of comparison for qconv_with…
Dec 17, 2018
3b63c2a
Change some build configuration.
Nov 5, 2018
5ee50d2
Enable conv_kn2row_tiling IP to work with multiple out_c and in_c
Nov 9, 2018
848399c
Implement quantized convolution with kn2row and tiling
Nov 9, 2018
daa5e48
Remove debug codes like print statements
Nov 9, 2018
65a7f13
Setup intel HLS codes and Fix typo
Nov 9, 2018
e89ed74
Refactor codes with clang-format(that doesn\'t follow LM c++ coding s…
Nov 13, 2018
c4abdcd
Update clang-format setting to automatically keep consistency with st…
Nov 14, 2018
4f2885b
Add intel HLS implementation of qconv_kn2row_tiling without any optim…
Nov 16, 2018
feb6119
Change the conv_kn2row_tiling computation order.
Nov 16, 2018
5316ff2
Add optimization to qconv_kn2row_tiling in intelHLS
Nov 19, 2018
b721831
A optimization that ic=2, oc=8 and loop coalasced andin_buf is implem…
Nov 27, 2018
ce6771e
Fix threshold bus and some parameters
Nov 29, 2018
a653e7a
implement no-mc_ic4-oc8_in-buf-line-bram_90MHz_hls-100MHz
Dec 3, 2018
25abb4d
Move BRAM memories into function's glow scope
Dec 4, 2018
1f05ba1
Completed HLS compile, synthesis, fit and pass the timing analysis
Dec 27, 2018
4484f75
Change the frequency when compiling
Jan 16, 2019
69d14c3
Fix threshold skipping bug on IP
Jan 25, 2019
be4a8d0
Fix the frequency for HLS and fix threshold skipping result when the …
Jan 25, 2019
1f3fa17
Add synthesized IP that quantized convolution with kn2row and tiling
Jan 25, 2019
1d1c7d9
fix comment
lm-konda Feb 8, 2019
d79172d
Merge branch 'master' into kernel_transform
ruimashita Feb 8, 2019
2abe5ac
Merge branch 'master' into improve_cache_locality
lm-konda Feb 8, 2019
1e52d40
modify makefile
lm-konda Feb 8, 2019
f955e9a
use ppa aarch64 GCC
lm-konda Feb 8, 2019
09b9715
modify docker
lm-konda Feb 8, 2019
f60cfed
fix line
lm-konda Feb 8, 2019
9f3b5d8
Merge pull request #73 from lm-konda/kernel_transform
ruimashita Feb 8, 2019
f2ef110
update version 0.3.0
ruimashita Feb 8, 2019
cdf77ce
Removed hard coding directory path.
odoku Feb 8, 2019
4722b47
Merge pull request #148 from ruimashita/update_version_0.3
ruimashita Feb 8, 2019
3f2f5a4
add timer to high cost part
lm-konda Feb 12, 2019
4b9e955
Merge branch 'master' into blueoil-cli
odoku Feb 12, 2019
ec924ec
Merge pull request #105 from odoku/blueoil-cli
ruimashita Feb 12, 2019
97eb621
OpenCV module not include as default.
yoya Feb 12, 2019
301d9b6
Merge branch 'master' into runtime_imageresize
yoya Feb 12, 2019
725b70c
- replace USE_OPENCV_MODULE => USE_OPENCV
yoya Feb 13, 2019
4dfc093
- use "NOT" for "if" condition.
yoya Feb 13, 2019
00f70bb
USE_OPENCV, default "OFF" to "ON"
yoya Feb 13, 2019
64cb5be
move tensor_util (CHW <=> HWC conversion) to test folder.
yoya Feb 13, 2019
1ebe7ca
- Remove pool interface (not needed)
Joeper214 Feb 14, 2019
13fdf6f
- Update usb camera demo
Joeper214 Feb 14, 2019
0914e4d
Merge branch 'master' into output_gpu_inference_model
Joeper214 Feb 14, 2019
333a1a3
implement DatasetIterator class
tkng Jan 22, 2019
a249186
Merge pull request #122 from tkng/dataset_iterator
ruimashita Feb 14, 2019
6b4c6f6
remove redundant -g option in Makefile
iizukak Feb 15, 2019
b036984
Merge branch 'add_qconv_kn2row_tiling' of ssh://github.com/tkclimb/bl…
Feb 15, 2019
aa81e2f
Update hw_path
Feb 15, 2019
6312c77
Fixed the conflicts with the master and merge
Feb 15, 2019
944cc1e
Update pre kernel reorder and driver for de10-nano
Feb 15, 2019
e3d8252
Merge pull request #130 from tkclimb/add_qconv_kn2row_tiling
n-nez Feb 15, 2019
6c41ffb
Refactor
Feb 15, 2019
1c0e47f
rename include file tensor_util.h => test_util.h
yoya Feb 15, 2019
4a32fad
Change Classname from ProtobufLoader to TFGraphLoadPb
Joeper214 Feb 18, 2019
a20afda
Merge branch 'output_gpu_inference_model' of github.com:Joeper214/blu…
Joeper214 Feb 18, 2019
4b7e491
Improve exception message
Joeper214 Feb 18, 2019
99c7b8e
- Update Readme in more detail which includes Demo for FPGA
Joeper214 Feb 18, 2019
642a869
Refactoring de10_nano.h
Feb 18, 2019
ef3d2f5
Update readme.md with summary
Joeper214 Feb 18, 2019
77d54ed
Merge pull request #159 from tkclimb/refactor_backends
n-nez Feb 19, 2019
7d56781
Merge branch 'master' into output_gpu_inference_model
Joeper214 Feb 19, 2019
d0bfc02
Merge branch 'master' into improve_cache_locality
iizukak Feb 19, 2019
bbd2d7e
- Change Class name to TensorflowGraphRunner
Joeper214 Feb 20, 2019
18eb6bc
Merge branch 'output_gpu_inference_model' of github.com:Joeper214/blu…
Joeper214 Feb 20, 2019
a935311
Merge branch 'master' into runtime_imageresize
yoya Feb 20, 2019
b05267a
parameter check. typo. (channels => filter)
yoya Feb 20, 2019
e6f132a
fix indent
lm-konda Feb 20, 2019
0c4df91
Merge remote-tracking branch 'aa/master' into enable_aarch64_build
lm-konda Feb 20, 2019
989f8c1
fix indent
lm-konda Feb 20, 2019
d9a3df3
Change the ordering of import
Joeper214 Feb 20, 2019
1df28c2
modify Dockerfile
lm-konda Feb 20, 2019
4b5cf0a
modify Makefile
lm-konda Feb 20, 2019
4fa9fc9
refactor dockerfile
lm-konda Feb 20, 2019
b2fa2a1
Merge branch 'master' into add_timer_for_arm
lm-konda Feb 22, 2019
f553c4b
Merge remote-tracking branch 'upstream/master' into remove-redundant-…
iizukak Feb 25, 2019
622b06d
Merge pull request #146 from lm-konda/enable_aarch64_build
ruimashita Feb 26, 2019
694c7e4
fix conflict
iizukak Feb 26, 2019
d9ba847
Merge branch 'master' into add_timer_for_arm
iizukak Feb 26, 2019
0b3485f
Merge branch 'master' into output_gpu_inference_model
iizukak Feb 26, 2019
95910d4
hot fix for overflowError
nlpng Feb 26, 2019
b882c7e
remove redundant codes
nlpng Feb 26, 2019
51411a8
change name for consistency
nlpng Feb 26, 2019
0ca0bd4
Merge pull request #156 from iizukak/remove-redundant-g-option
iizukak Feb 27, 2019
b146503
Merge branch 'master' into add_timer_for_arm
iizukak Feb 27, 2019
1eae356
Fix loop boundaries in vectorized batch normalization
n-nez Feb 27, 2019
5ce140d
Merge pull request #151 from lm-konda/add_timer_for_arm
iizukak Feb 27, 2019
8b3b923
- Copy protocol buffer file into models folder
Joeper214 Feb 27, 2019
82c2451
Merge branch 'output_gpu_inference_model' of github.com:Joeper214/blu…
Joeper214 Feb 27, 2019
af20ed9
Merge branch 'master' into fix-loop-boundaries-in-vectorized-batch-norm
ruimashita Feb 27, 2019
cec92e6
Merge pull request #172 from n-nez/fix-loop-boundaries-in-vectorized-…
iizukak Feb 27, 2019
7f704a2
Merge branch 'master' into fix/huge_threshold_values
iizukak Feb 27, 2019
fb71e01
Merge branch 'master' into runtime_imageresize
yoya Feb 28, 2019
df868dd
Merge branch 'master' into output_gpu_inference_model
Joeper214 Feb 28, 2019
04d405e
Merge pull request #9 from yoya/runtime_imageresize
iizukak Feb 28, 2019
3eb202c
Merge branch 'master' into output_gpu_inference_model
ruimashita Feb 28, 2019
46a66e7
Merge branch 'master' into fix/huge_threshold_values
iizukak Mar 1, 2019
302de83
Merge pull request #170 from nlpng/fix/huge_threshold_values
iizukak Mar 1, 2019
e0ebe2b
Merge branch 'master' into improve_cache_locality
iizukak Mar 2, 2019
e8aa31b
Merge pull request #131 from lm-konda/improve_cache_locality
iizukak Mar 4, 2019
8f6fb43
[Semantic Segmentation] Add CamVid dataset fixture and Documentation
iizukak Mar 4, 2019
6c2c771
fix description for CamvidCustom
iizukak Mar 4, 2019
7110c6a
Fix filename
iizukak Mar 4, 2019
c5dfeb5
Merge branch 'master' into output_gpu_inference_model
ruimashita Mar 4, 2019
96e456e
Merge pull request #176 from iizukak/camvid-fixture-dataset
ruimashita Mar 4, 2019
c9cc5ed
Merge branch 'master' into output_gpu_inference_model
Joeper214 Mar 4, 2019
12bc54a
Merge pull request #144 from Joeper214/output_gpu_inference_model
iizukak Mar 4, 2019
b00bfea
remove redundant variable (#134)
lm-konda Mar 6, 2019
6aed818
Implement SimpleDatasetReader (#166)
ruimashita Mar 7, 2019
59ca9c6
Add General Purpose Color Palette (#188)
iizukak Mar 7, 2019
be02644
Change camvid_custom dataset format (#189)
iizukak Mar 7, 2019
a65c1cb
Fix pack_input_to_qwords (#157)
lm-konda Mar 8, 2019
f0f913a
[Semantic Segmentation] Add CamvidCustom dataset class. (#177)
iizukak Mar 8, 2019
1e64f2e
[Semantic Segmentation] Add Interface for Blueoil (#180)
iizukak Mar 14, 2019
a086cbf
[Semantic Segmentation] Add Tutorial (#174)
iizukak Mar 14, 2019
6f979b7
update version 0.4.0 (#196)
ruimashita Mar 15, 2019
c1f5598
Changed to copy settings file when executing training. (#198)
odoku Mar 19, 2019
9069945
Remove unused dlk/.github/CODEOWNERS file (#200)
ruimashita Mar 20, 2019
d4bdb5d
Add backwards compatibility for output template model python scripts …
Joeper214 Mar 28, 2019
dee44a1
#203 Change color to tuple from list to fix run.py error (#204)
ruimashita Mar 28, 2019
4920ddc
remove check for activation quantizer counts of inputs
nlpng Feb 28, 2019
06a06d4
add consistency check for activation quantizers
nlpng Mar 5, 2019
c3c2e2d
update warning message for better understanding
nlpng Apr 2, 2019
e444a66
Create Makefile and unify test commands in it (#194)
kchygoe Apr 4, 2019
828ef1e
[LMBiSeNet] Implement bilinear upsampling post process (#211)
ruimashita Apr 5, 2019
4f8b5d1
[LMBiSeNet] implement densenet block and conv_bn_act block (#212)
ruimashita Apr 5, 2019
11b58f0
Change executor/profile_model.py (#207)
ruimashita Apr 5, 2019
cfc33bd
Add support of leakyrelu to DLK (#214)
nlpng Apr 8, 2019
3b5c5b8
lmnet: avoid importing entire pyplot (#218)
tsawada Apr 9, 2019
96f9929
Fix document structure to clean the directory (#216)
kchygoe Apr 9, 2019
ce73c9d
Implement packed data type (#217)
primenumber Apr 10, 2019
08077c7
create lmnet config with tempfile (#219)
tsawada Apr 10, 2019
5f679ee
Use gfile to read/write configs (#223)
tsawada Apr 11, 2019
1f47c76
Implement SegnetBase class (#224)
ruimashita Apr 11, 2019
e0daa89
Export inference test data and add FUNC_TIME_MEASUREMENT macro for te…
ruimashita Apr 11, 2019
2fca4d8
[LMBiSeNet] Implement LMBiSeNet (#225)
ruimashita Apr 12, 2019
7ee9a7b
Fix condition (#222)
primenumber Apr 12, 2019
7b4df4e
Change default model in usb camera demo (#230)
Joeper214 Apr 12, 2019
09efa7a
update TensorFlow version (#202)
lm-jira Apr 12, 2019
c407323
Semantic segmentation python demo (#155)
nlpng Apr 12, 2019
3b1ffe6
update version 0.5.0 (#232)
ruimashita Apr 12, 2019
1559805
Use QuantizedPacked for kernel (#226)
primenumber Apr 15, 2019
8b5af3f
To avoid duplication, lmnet/executor/export.py run() return exported …
ruimashita Apr 16, 2019
b8aa850
Optimize Bilinear postprocess (#228)
ruimashita Apr 17, 2019
4cd1235
fix typo: s/pyhon/python/ (#237)
Apr 17, 2019
1d74496
Update TensorFlow, CUDA and OepnCV version in README (#239)
iizukak Apr 18, 2019
a1540cd
Fix MaxPool implementation (#238)
tvlenin Apr 22, 2019
5b42fa1
fix retraining failure and add test for retraining (#246)
hadusam Apr 25, 2019
9c4c75e
Motion jpeg server for demo (#241)
ruimashita Apr 25, 2019
9fe210c
[Experimental] Add parameter tuning feature to lmnet (#209)
nlpng Apr 26, 2019
4bb642a
[Experimental] example configuration for parameter tuning (#215)
nlpng Apr 26, 2019
39e5205
Accelerate anchors generator in early steps (#250)
yd8534976 Apr 26, 2019
f0aaa5c
Update to version 0.6.0 (#251)
ruimashita Apr 26, 2019
3215aa4
Update Pillow (#255)
iizukak May 7, 2019
60d18e0
Fix config overwrite by check & delete if destination exists (#258)
Joeper214 May 10, 2019
7343a99
Add try catch to ensure queue import compatibility (#264)
Joeper214 May 13, 2019
35c385f
Add data shaping for images_placeholder (#265)
nabedev May 13, 2019
d23f730
Fix the error of pep8-dlk (#268)
hadusam May 13, 2019
46896e8
Enable to test DLK on local DE10-Nano (#261)
hadusam May 14, 2019
f0cf0e2
Update docs for CUDA10 (#271)
ruimashita May 15, 2019
810680d
Modified so that differences in Docker image are not output as much a…
odoku May 15, 2019
7280413
add parameter tuning config file for object detection
nlpng May 9, 2019
0a383d9
add stop metric for object detection
nlpng May 13, 2019
8a1a80b
add momentum option to optimizer
nlpng May 13, 2019
b2a6e8b
add warm up stage for object detection
nlpng May 15, 2019
a07eebc
fix key error
nlpng May 15, 2019
5e8d800
change to suitable batch size and epoch
nlpng May 15, 2019
2c48b87
update copyright
nlpng May 16, 2019
f138751
update to more practical mAP for trial stopping
nlpng May 16, 2019
d69f955
Enable data prefetch for param tuner (#262)
nlpng May 16, 2019
7a4dee9
remove debug print
nlpng May 17, 2019
33fb14a
Merge branch 'master' into feature/add_obj_det_tune_config
nlpng May 17, 2019
d17ddf8
limit the training iteration
nlpng May 20, 2019
d40561f
limit the training iteration
nlpng Jul 30, 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2018 The Blueoil Authors. All Rights Reserved.
/* 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.
Expand All @@ -13,14 +13,18 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef DLK_FUNC_MATMUL_H_INCLUDED
#define DLK_FUNC_MATMUL_H_INCLUDED

#include "global.h"
#include "tensor_view.h"
#include "func/leaky_relu.h"
#include "time_measurement.h"

void func_LeakyRelu(T_FLOAT input[], T_FLOAT output[], T_FLOAT alpha, T_UINT out_height,
T_UINT out_width, T_UINT out_depth) {
Measurement::Start("LeakyReLu");

T_UINT elements = out_height * out_width * out_depth;

void func_Matmul(const TensorView<T_FLOAT, MemoryLayout::NC>& input,
const TensorView<T_FLOAT, MemoryLayout::NC>& factor,
const TensorView<T_FLOAT, MemoryLayout::NC>& output);
for (T_UINT i = 0; i < elements; i++)
output[i] = (input[i] * alpha > input[i] ? input[i] * alpha : input[i]);

#endif // DLK_FUNC_MATMUL_H_INCLUDED
Measurement::Stop();
}
2 changes: 2 additions & 0 deletions dlk/tests/tstutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def setup_de10nano(hw_path: str, output_path: str, testcase=None):
try:
run_and_check(
[ "ssh",
"-o",
"StrictHostKeyChecking no",
f"root@{host}",
f"mkdir -p ~/automated_testing; mkdir -p ~/boot; if grep -qs '/root/boot' /proc/mounts ;" \
+ "then echo 0 ; else mount /dev/mmcblk0p1 /root/boot ; fi"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# -*- 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.
# =============================================================================
from easydict import EasyDict
import tensorflow as tf

from lmnet.common import Tasks
from lmnet.networks.object_detection.lm_fyolo import LMFYoloQuantize
from lmnet.datasets.pascalvoc_2007_2012 import Pascalvoc20072012
from lmnet.data_processor import Sequence
from lmnet.pre_processor import (
ResizeWithGtBoxes,
DivideBy255,
)
from lmnet.post_processor import (
FormatYoloV2,
ExcludeLowScoreBox,
NMS,
)
from lmnet.data_augmentor import (
Brightness,
Color,
Contrast,
FlipLeftRight,
Hue,
SSDRandomCrop,
)

from lmnet.quantizations import (
binary_channel_wise_mean_scaling_quantizer,
linear_mid_tread_half_quantizer,
)

from hyperopt import hp

IS_DEBUG = False

NETWORK_CLASS = LMFYoloQuantize
DATASET_CLASS = Pascalvoc20072012

IMAGE_SIZE = [320, 320]
BATCH_SIZE = 16
DATA_FORMAT = "NHWC"
TASK = Tasks.OBJECT_DETECTION
CLASSES = DATASET_CLASS.classes

MAX_STEPS = 1000000
SAVE_STEPS = 10000
TEST_STEPS = 1000
SUMMARISE_STEPS = 1000
IS_DISTRIBUTION = False

# for debug
# IS_DEBUG = True
# SUMMARISE_STEPS = 1
# SUMMARISE_STEPS = 100
# TEST_STEPS = 10000
# SUMMARISE_STEPS = 100

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

PRE_PROCESSOR = Sequence([
ResizeWithGtBoxes(size=IMAGE_SIZE),
DivideBy255()
])
anchors = [
(1.3221, 1.73145), (3.19275, 4.00944), (5.05587, 8.09892), (9.47112, 4.84053), (11.2364, 10.0071)
]
score_threshold = 0.05
nms_iou_threshold = 0.5
nms_max_output_size = 100
POST_PROCESSOR = Sequence([
FormatYoloV2(
image_size=IMAGE_SIZE,
classes=CLASSES,
anchors=anchors,
data_format=DATA_FORMAT,
),
ExcludeLowScoreBox(threshold=score_threshold),
NMS(iou_threshold=nms_iou_threshold, max_output_size=nms_max_output_size, classes=CLASSES,),
])

# Train data num per epoch is 16551
step_per_epoch = int(16551 / BATCH_SIZE)

TUNE_SPEC = {
'run': 'tunable_det',
'resources_per_trial': {"cpu": 2, "gpu": 1},
'stop': {
'mean_accuracy': 0.77,
'training_iteration': 777,
},
'config': {
'lm_config': {},
},
'local_dir': None,
'num_samples': 100,
}

TUNE_SPACE = {
'optimizer_class': hp.choice(
'optimizer_class', [
{
'optimizer': tf.train.MomentumOptimizer,
'momentum': 0.9,
},
]
),
'learning_rate': hp.uniform('learning_rate', 0, 0.05),
'learning_rate_func': hp.choice(
'learning_rate_func', [
{
'scheduler': tf.train.piecewise_constant,
'scheduler_factor': 0.1,
'soft_start': 5e-4,
'scheduler_steps': [step_per_epoch, step_per_epoch * 80, step_per_epoch * 120],
},
]
),
}

NETWORK = EasyDict()
NETWORK.OPTIMIZER_CLASS = None
NETWORK.OPTIMIZER_KWARGS = {}
NETWORK.LEARNING_RATE_FUNC = None
# In the origianl yolov2 Paper, with a starting learning rate of 10−3, dividing it by 10 at 60 and 90 epochs.
NETWORK.LEARNING_RATE_KWARGS = {}
NETWORK.IMAGE_SIZE = IMAGE_SIZE
NETWORK.BATCH_SIZE = BATCH_SIZE
NETWORK.DATA_FORMAT = DATA_FORMAT
NETWORK.ANCHORS = anchors
NETWORK.OBJECT_SCALE = 5.0
NETWORK.NO_OBJECT_SCALE = 1.0
NETWORK.CLASS_SCALE = 1.0
NETWORK.COORDINATE_SCALE = 1.0
NETWORK.LOSS_IOU_THRESHOLD = 0.6
NETWORK.WEIGHT_DECAY_RATE = 0.0005
NETWORK.SCORE_THRESHOLD = score_threshold
NETWORK.NMS_IOU_THRESHOLD = nms_iou_threshold
NETWORK.NMS_MAX_OUTPUT_SIZE = nms_max_output_size
NETWORK.SEEN_THRESHOLD = 8000
# quantization
NETWORK.ACTIVATION_QUANTIZER = linear_mid_tread_half_quantizer
NETWORK.ACTIVATION_QUANTIZER_KWARGS = {
'bit': 2,
'max_value': 2.0
}
NETWORK.WEIGHT_QUANTIZER = binary_channel_wise_mean_scaling_quantizer
NETWORK.WEIGHT_QUANTIZER_KWARGS = {}
NETWORK.QUANTIZE_FIRST_CONVOLUTION = True
NETWORK.QUANTIZE_LAST_CONVOLUTION = False

# dataset
DATASET = EasyDict()
DATASET.BATCH_SIZE = BATCH_SIZE
DATASET.DATA_FORMAT = DATA_FORMAT
DATASET.PRE_PROCESSOR = PRE_PROCESSOR
DATASET.AUGMENTOR = Sequence([
FlipLeftRight(),
Brightness((0.75, 1.25)),
Color((0.75, 1.25)),
Contrast((0.75, 1.25)),
Hue((-10, 10)),
SSDRandomCrop(min_crop_ratio=0.7),
])
DATASET.ENABLE_PREFETCH = True
8 changes: 8 additions & 0 deletions lmnet/executor/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def setup_dataset(config, subset, rank):
return DatasetIterator(dataset, seed=rank, enable_prefetch=enable_prefetch)


def setup_dataset(config, subset, rank):
DatasetClass = config.DATASET_CLASS
dataset_kwargs = dict((key.lower(), val) for key, val in config.DATASET.items())
dataset = DatasetClass(subset=subset, **dataset_kwargs)
enable_prefetch = dataset_kwargs.pop("enable_prefetch", False)
return DatasetIterator(dataset, seed=rank, enable_prefetch=enable_prefetch)


def start_training(config):
if config.IS_DISTRIBUTION:
import horovod.tensorflow as hvd
Expand Down
24 changes: 15 additions & 9 deletions lmnet/executor/tune_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,17 @@ def update_parameters_for_each_trial(network_kwargs, chosen_kwargs):
base_lr = chosen_kwargs['learning_rate']
if network_kwargs['learning_rate_func'] is tf.train.piecewise_constant:
lr_factor = chosen_kwargs['learning_rate_func']['scheduler_factor']
network_kwargs['learning_rate_kwargs']['values'] = [base_lr,
base_lr * lr_factor,
base_lr * lr_factor * lr_factor,
base_lr * lr_factor * lr_factor * lr_factor]

if 'soft_start' in chosen_kwargs['learning_rate_func']:
num_decay_stage = len(chosen_kwargs['learning_rate_func']['scheduler_steps'])
lr_values = [base_lr * lr_factor ** n for n in range(num_decay_stage)]
lr_values.insert(0, chosen_kwargs['learning_rate_func']['soft_start'])
else:
num_decay_stage = len(chosen_kwargs['learning_rate_func']['scheduler_steps']) + 1
lr_values = [base_lr * lr_factor ** n for n in range(num_decay_stage)]

network_kwargs['learning_rate_kwargs']['values'] = lr_values
network_kwargs['learning_rate_kwargs']['boundaries'] = chosen_kwargs['learning_rate_func']['scheduler_steps']
elif network_kwargs['learning_rate_func'] is tf.train.polynomial_decay:
network_kwargs['learning_rate_kwargs']['learning_rate'] = base_lr
network_kwargs['learning_rate_kwargs']['power'] = chosen_kwargs['learning_rate_func']['scheduler_power']
network_kwargs['learning_rate_kwargs']['decay_steps'] = chosen_kwargs['learning_rate_func']['scheduler_decay']
else:
network_kwargs['learning_rate_kwargs']['learning_rate'] = base_lr

Expand Down Expand Up @@ -232,6 +234,8 @@ def _train(self):

if self.lm_config.NETWORK_CLASS.__module__.startswith("lmnet.networks.segmentation"):
metric_accuracy = self.sess.run(self.metrics_ops_dict["mean_iou"])
elif self.lm_config.NETWORK_CLASS.__module__.startswith("lmnet.networks.object_detection"):
metric_accuracy = self.sess.run(self.metrics_ops_dict["MeanAveragePrecision_0.5"])
else:
metric_accuracy = self.sess.run(self.metrics_ops_dict["accuracy"])

Expand Down Expand Up @@ -271,7 +275,9 @@ def easydict_to_dict(config):
# Expecting use of gpus to do parameter search
ray.init(num_cpus=multiprocessing.cpu_count() // 2, num_gpus=max(get_num_gpu(), 1))
algo = HyperOptSearch(tune_space, max_concurrent=4, reward_attr="mean_accuracy")
scheduler = AsyncHyperBandScheduler(time_attr="training_iteration", reward_attr="mean_accuracy", max_t=200)
scheduler = AsyncHyperBandScheduler(time_attr="training_iteration",
reward_attr="mean_accuracy",
max_t=tune_spec['stop']['training_iteration'])
trials = run_experiments(experiments={'exp_tune': tune_spec},
search_alg=algo,
scheduler=scheduler)
Expand Down