Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] new int8 implement,better accuracy #749

Merged
merged 24 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8efb684
add the armv7a conv3x3s1 implement without overflow,remove old codes
BUG1989 Jan 8, 2019
19b983e
fix the bug of conv3x3s2 packed int8
BUG1989 Jan 9, 2019
67df4e2
Merge remote-tracking branch 'upstream/master' into ncnn-pr
BUG1989 Jan 9, 2019
b5d39fe
new int8 implement,weight quant by perchanel,better accuracy~
BUG1989 Jan 10, 2019
7b53edd
fix the bug of conv3x3s1 packed int8 neon
BUG1989 Jan 11, 2019
2a8fa6c
add the naive c fp32 and int8 winograd F(2,3)
BUG1989 Jan 23, 2019
46bbf5b
merge from master
BUG1989 Jan 23, 2019
4c52ec5
add the neon intrinsic int8 winograd F(2,3)
BUG1989 Jan 25, 2019
c84fa4a
optimize the armv7a int8 winograd F(2,3) with neon assembly
BUG1989 Jan 29, 2019
bcaa2d5
optimize the armv7a int8 winograd F(2,3) input transform with assembly.
BUG1989 Jan 31, 2019
07c63b6
add the requantize layer and int8 relu implement.
BUG1989 Feb 11, 2019
eff997e
add graph optimize conv1x1s2 -> conv1x1s1,begin optimize int8 aarch64.
BUG1989 Feb 12, 2019
c223155
fix int8 bugs
BUG1989 Feb 13, 2019
732efb4
add the c naive im2col with sgemm
BUG1989 Feb 14, 2019
ecc291b
add aarch64 int8 winograd f23, conv3x3s2 naive implement
BUG1989 Feb 15, 2019
bbe0a47
add the int8 sgemm conv7x7s2 on x86/armv7a platform
BUG1989 Feb 19, 2019
22593d4
optimize the int8 sgemm by neon intrinsic and packed kernel
BUG1989 Feb 20, 2019
2c666de
optimize the int8 sgemm with packed data
BUG1989 Feb 21, 2019
a3cb7d3
optimize the int8 sgemm with armv7a neon assembly
BUG1989 Feb 22, 2019
458a959
add the int8 sgemm on arm64-v8a platform
BUG1989 Feb 27, 2019
08f505e
perpare to merge latest codes from master
BUG1989 Mar 4, 2019
48c130f
merge from master and push the armv7a int8
BUG1989 Mar 4, 2019
8b22913
add the int8 param files
BUG1989 Mar 4, 2019
71b277b
In the Class Net,add the fuse_network method
BUG1989 Mar 5, 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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ option(NCNN_PIXEL "convert and resize from/to image pixel" ON)
option(NCNN_PIXEL_ROTATE "rotate image pixel orientation" OFF)
option(NCNN_CMAKE_VERBOSE "print verbose cmake messages" OFF)
option(NCNN_VULKAN "vulkan compute support" OFF)
option(NCNN_REQUANT "auto merge int8 quant and dequant" OFF)
option(NCNN_IM2COL_SGEMM "im2col sgemm support" OFF)

if(NCNN_OPENMP)
find_package(OpenMP)
Expand Down
74 changes: 73 additions & 1 deletion benchmark/benchncnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,19 @@ void benchmark(const char* comment, void (*init)(ncnn::Net&), void (*run)(const

time_avg /= g_loop_count;

fprintf(stderr, "%16s min = %7.2f max = %7.2f avg = %7.2f\n", comment, time_min, time_max, time_avg);
fprintf(stderr, "%-20s min = %7.2f max = %7.2f avg = %7.2f\n", comment, time_min, time_max, time_avg);
}

void squeezenet_init(ncnn::Net& net)
{
net.load_param("squeezenet.param");
}

void squeezenet_int8_init(ncnn::Net& net)
{
net.load_param("squeezenet_int8.param");
}

void squeezenet_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand All @@ -226,6 +231,11 @@ void mobilenet_init(ncnn::Net& net)
net.load_param("mobilenet.param");
}

void mobilenet_int8_init(ncnn::Net& net)
{
net.load_param("mobilenet_int8.param");
}

void mobilenet_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand Down Expand Up @@ -306,6 +316,11 @@ void googlenet_init(ncnn::Net& net)
net.load_param("googlenet.param");
}

void googlenet_int8_init(ncnn::Net& net)
{
net.load_param("googlenet_int8.param");
}

void googlenet_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand All @@ -322,6 +337,11 @@ void resnet18_init(ncnn::Net& net)
net.load_param("resnet18.param");
}

void resnet18_int8_init(ncnn::Net& net)
{
net.load_param("resnet18_int8.param");
}

void resnet18_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand Down Expand Up @@ -354,6 +374,11 @@ void vgg16_init(ncnn::Net& net)
net.load_param("vgg16.param");
}

void vgg16_int8_init(ncnn::Net& net)
{
net.load_param("vgg16_int8.param");
}

void vgg16_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand All @@ -365,11 +390,37 @@ void vgg16_run(const ncnn::Net& net)
ex.extract("prob", out);
}

void resnet50_init(ncnn::Net& net)
{
net.load_param("resnet50.param");
}

void resnet50_int8_init(ncnn::Net& net)
{
net.load_param("resnet50_int8.param");
}

void resnet50_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();

ncnn::Mat in(224, 224, 3);
ex.input("data", in);

ncnn::Mat out;
ex.extract("prob", out);
}

void squeezenet_ssd_init(ncnn::Net& net)
{
net.load_param("squeezenet_ssd.param");
}

void squeezenet_ssd_int8_init(ncnn::Net& net)
{
net.load_param("squeezenet_ssd_int8.param");
}

void squeezenet_ssd_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand All @@ -386,6 +437,11 @@ void mobilenet_ssd_init(ncnn::Net& net)
net.load_param("mobilenet_ssd.param");
}

void mobilenet_ssd_int8_init(ncnn::Net& net)
{
net.load_param("mobilenet_ssd_int8.param");
}

void mobilenet_ssd_run(const ncnn::Net& net)
{
ncnn::Extractor ex = net.create_extractor();
Expand Down Expand Up @@ -497,8 +553,12 @@ int main(int argc, char** argv)
// run
benchmark("squeezenet", squeezenet_init, squeezenet_run);

benchmark("squeezenet-int8", squeezenet_int8_init, squeezenet_run);

benchmark("mobilenet", mobilenet_init, mobilenet_run);

benchmark("mobilenet-int8", mobilenet_int8_init, mobilenet_run);

benchmark("mobilenet_v2", mobilenet_v2_init, mobilenet_v2_run);

benchmark("shufflenet", shufflenet_init, shufflenet_run);
Expand All @@ -509,16 +569,28 @@ int main(int argc, char** argv)

benchmark("googlenet", googlenet_init, googlenet_run);

benchmark("googlenet-int8", googlenet_int8_init, googlenet_run);

benchmark("resnet18", resnet18_init, resnet18_run);

benchmark("resnet18-int8", resnet18_int8_init, resnet18_run);

benchmark("alexnet", alexnet_init, alexnet_run);

benchmark("vgg16", vgg16_init, vgg16_run);

benchmark("resnet50", resnet50_init, resnet50_run);

benchmark("resnet50-int8", resnet50_int8_init, resnet50_run);

benchmark("squeezenet-ssd", squeezenet_ssd_init, squeezenet_ssd_run);

benchmark("squeezenet-ssd-int8", squeezenet_ssd_int8_init, squeezenet_ssd_run);

benchmark("mobilenet-ssd", mobilenet_ssd_init, mobilenet_ssd_run);

benchmark("mobilenet-ssd-int8", mobilenet_ssd_int8_init, mobilenet_ssd_run);

benchmark("mobilenet-yolo", mobilenet_yolo_init, mobilenet_yolo_run);

benchmark("mobilenet-yolov3", mobilenet_yolov3_init, mobilenet_yolov3_run);
Expand Down
Loading