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

NCNN计算出来的特征层数据为什么和框架计算出来的同一层数据差异非常大? #543

Open
bigbao9494 opened this issue Aug 27, 2018 · 2 comments

Comments

@bigbao9494
Copy link

如题,我使用网络mobilefacenet来提取fc2层的128个数据,在使用NCNN打印出来的结果和MXNET打印出来的这128个float数差别非常大,按道理说相同的网络,相同的参数,在不同的框架上的计算结果应该是相似的吧?为什么会差异巨大呢?

下面是NCNN的打印:
0.3203,-0.8238,0.0109,-0.0795,-0.0729,-0.5750,
-1.3104,0.3251,-0.4205,-0.0518,0.6914,0.4301,
-0.0239,-0.3541,-0.1625,-0.7740,-0.7228,0.5755,
-1.1205,0.5474,0.3898,-0.9043,-1.0188,-0.4913,
-0.1181,0.4346,1.0943,0.4723,-0.3897,1.5337,
0.1648,0.4750,-0.3277,0.1008,0.7523,-2.1353,
-0.3123,0.0410,-0.6059,-0.1924,0.8509,-0.4510,
-1.1227,-0.0458,-0.1080,0.6433,-0.5027,-0.7935,
0.6142,-0.3602,0.0117,-0.4324,-0.8010,0.4941,
0.1386,-0.7457,-0.1283,-0.6667,1.1071,-0.6760,
1.2951,0.2870,-0.5252,-0.5523,-0.4026,-1.1366,
0.5839,-0.9073,-0.1959,0.5615,0.1317,-0.2135,
0.6003,1.1625,1.7429,0.5458,0.7043,-0.0821,
-0.4169,-0.8883,0.3752,0.7421,0.3685,0.7094,
1.0106,-0.2295,1.4311,0.4425,1.0733,-0.5721,
-0.5550,0.0937,0.2050,-0.7097,-0.4508,0.7283,
-0.3044,-0.4577,-0.5413,0.3501,0.3079,-0.4791,
1.2344,0.3712,-0.3196,-0.4641,0.9170,0.3296,
-0.8587,0.4146,1.5764,1.3034,-2.3150,-0.4224,
-0.2520,-0.4259,0.4698,0.8450,-0.0986,-0.5704,
0.4590,0.4692,1.7763,0.4844,0.6289,-1.1569,
-0.9602,-0.0338

下面是MXNET打印:
0.65698606 -0.78458184 -0.5098568 0.2024311 -0.20982581 -0.9390513
-1.4673811 0.15446652 -0.22405438 -0.14611286 0.4535662 0.2372462
-0.07972286 -0.42504328 0.03877151 -0.69716823 -0.44704115 0.8845139
-1.3268516 0.23062828 0.4926122 -1.0742795 -1.4995197 -0.4040565
-0.18494345 0.10053053 1.0954243 0.75202507 -0.7841506 0.9394675
0.1368146 0.02178165 -0.43329474 -0.18798186 1.2762934 -2.0135534
-0.14122649 0.3013042 -0.9259096 -0.40422478 0.8215177 -0.31059325
-1.275787 -0.19119641 -0.20241152 0.6954416 -0.674588 -0.34218606
0.6500079 -0.38204736 0.02439199 -0.621921 -0.70239574 0.52162045
0.33280724 -0.98213756 0.09176304 -1.2170393 1.1910853 -0.7292695
0.95974463 0.05295334 -0.6079029 -0.53603274 -0.15017816 -0.644996
0.44467232 -0.85281956 0.04838718 0.6705901 -0.14352572 -0.6718089
0.45973092 1.1007267 1.7716755 0.8085197 0.5617954 -0.27993986
-0.08235161 -1.0548091 -0.19102256 0.30939823 0.09008869 0.80802554
0.9239737 0.02732148 1.2832808 0.3283985 1.1586028 -0.5064414
-0.52924657 0.04837275 -0.03047427 -0.47437295 -0.6917567 1.0052799
-0.46453434 -0.04931922 0.12798484 0.48072508 -0.2473358 -0.72094584
1.621455 0.17916963 -0.29944098 -0.67597705 0.7498476 0.14785717
-1.3052889 0.80385906 1.1121927 1.4555626 -2.1561754 -0.44158304
-0.1263461 -0.3214773 0.65465754 0.90650165 0.0083368 -0.6169706
0.5434896 0.8269004 1.9858172 0.14211722 0.8886896 -1.2823673
-0.43084365 -0.23918216

@nihui
Copy link
Member

nihui commented Aug 27, 2018

@bigbao9494
Copy link
Author

@nihui 我在PC上使用opencv读出图片数据,opencv的格式是BGR,然后我应该使用ncnn::Mat::PIXEL_BGR2RGB来把BGR格式转换成RGB格式,这样对吗?
我的网络是使用MXNET训练的,MXNET对输入数据的形状要求是C H W
但是我不知道in_rgb = ncnn::Mat::from_pixels(bgr_data, ncnn::Mat::PIXEL_BGR2RGB, w, h);
后的in_rgb的形状是什么样的,因为opencv读出后的形状是H W C,我猜测现在的in_rgb是否也是
H W C,那这样就和我的网络要求的形状不同,怎样可以改变形状呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants