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

add feature/infer demo/se resnext50 #11708

Merged

Conversation

tensor-tang
Copy link
Contributor

@tensor-tang tensor-tang commented Jun 26, 2018

merged #11510 and add se-renext


```sh
./mobilenet_inference_demo --modeldir <model> --data <datafile>
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add description for resnet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -14,3 +14,40 @@
#

inference_api_test(simple_on_word2vec ARGS test_word2vec)

set(DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo")
set(mobilenet_url http://paddlemodels.bj.bcebos.com/inference-vis-demos%2Fmobilenet.tar.gz)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to set a variable for url, just pass it as the argument of inference_download_test_demo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

*/
void Main(bool use_gpu) {
NativeConfig config;
// config.model_dir = FLAGS_modeldir;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

78行去掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

config.fraction_of_gpu_memory = 0.1;
#ifdef PADDLE_WITH_CUDA
config.fraction_of_gpu_memory = FLAGS_fraction_of_gpu_memory_to_use;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

82行需要留着么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以不要的。

LOG(INFO) << "output: " << SummaryTensor(tensor);
}

TEST(demo, vis_demo) { Main(false /*use_gpu*/); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要再测下gpu的

@@ -14,3 +14,42 @@
#

inference_api_test(simple_on_word2vec ARGS test_word2vec)

set(DEMO_INSTALL_DIR "${THIRD_PARTY_PATH}/inference_demo")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能否下载到build的当前路径,不要放到thirdparty路径下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接放到build路径?还是放到别的什么路径 @Superjomn @luotao1

@tensor-tang
Copy link
Contributor Author

https://paddleci.ngrok.io/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=85&_focus=3038

[Step 1/1] /paddle/paddle/fluid/operators/distributed/rpc_client.h:61:26: error: 'FLAGS_grpc_deadline' was not declared in this scope
[07:40:02][Step 1/1]        int64_t time_out = FLAGS_grpc_deadline) = 0;
[07:40:02][Step 1/1]                           ^
[07:40:02][Step 1/1] make[2]: *** [paddle/fluid/operators/distributed/CMakeFiles/sendrecvop_grpc.dir/rpc_client.cc.o] Error 1
[07:40:02][Step 1/1] make[2]: *** Waiting for unfinished jobs....
[07:40:02][Step 1/1] paddle/fluid/operators/distributed/CMakeFiles/sendrecvop_grpc.dir/build.make:158: recipe for target 'paddle/fluid/operators/distributed/CMakeFiles/sendrecvop_grpc.dir/rpc_client.cc.o' failed
[07:40:04][Step 1/1] In file included from /paddle/paddle/fluid/operators/distributed/grpc_client.h:41:0,
[07:40:04][Step 1/1]                  from /paddle/paddle/fluid/operators/distributed/grpc_client.cc:15:
[07:40:04][Step 1/1] /paddle/paddle/fluid/operators/distributed/rpc_client.h:61:26: error: 'FLAGS_grpc_deadline' was not declared in this scope
[07:40:04][Step 1/1]        int64_t time_out = FLAGS_grpc_deadline) = 0;
[07:40:04][Step 1/1]                           ^
[07:40:04][Step 1/1] In file included from /paddle/paddle/fluid/operators/distributed/grpc_client.cc:15:0:
[07:40:04][Step 1/1] /paddle/paddle/fluid/operators/distributed/grpc_client.h:215:49: error: 'FLAGS_grpc_deadline' was not declared in this scope
[07:40:04][Step 1/1]                               int64_t time_out = FLAGS_grpc_deadline) override;

case PaddleDType::FLOAT32:
for (size_t i = 0; i < numel; ++i) {
EXPECT_NEAR(
static_cast<float*>(output.data.data())[i], refer.data[i], 1e-3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1e-3太大了。改成1e-7吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1e-7本地gpu跑了下,太小了。改为1e-6了。

@tensor-tang
Copy link
Contributor Author

Failed log:

[Step 1/1] The following tests FAILED:
[10:01:36][Step 1/1] 	351 - mobilenet_inference_demo (OTHER_FAULT)
[10:01:36][Step 1/1] 	353 - ocr_inference_demo (Failed)

ocr cpu check failed

626 10:01:33.921309 50423 vis_demo.cc:68] data size 36912
[10:01:36][Step 1/1] I0626 10:01:33.921319 50423 vis_demo.cc:69] data shape size 4
[10:01:36][Step 1/1] I0626 10:01:33.921378 50423 vis_demo.cc:132] run executor
[10:01:36][Step 1/1] I0626 10:01:34.142024 50423 vis_demo.cc:136] output.size 1
[10:01:36][Step 1/1] I0626 10:01:34.142166 50423 vis_demo.cc:138] output: data[:10]	5.27365e-08 3.29674e-07 1.87326e-08 3.40372e-08 3.38332e-08 2.02055e-08 3.76429e-06 2.42356e-06 1.84867e-07 2.43073e-08 
[10:01:36][Step 1/1] I0626 10:01:34.142668 50423 vis_demo.cc:50] process a line
[10:01:36][Step 1/1] I0626 10:01:34.150573 50423 vis_demo.cc:68] data size 9312
[10:01:36][Step 1/1] I0626 10:01:34.150604 50423 vis_demo.cc:69] data shape size 3
[10:01:36][Step 1/1] I0626 10:01:34.151135 50423 vis_demo.cc:81] predictor output numel 9312
[10:01:36][Step 1/1] I0626 10:01:34.151161 50423 vis_demo.cc:82] reference output numel 9312
[10:01:36][Step 1/1] /paddle/paddle/contrib/inference/demo/vis_demo.cc:94: Failure
[10:01:36][Step 1/1] Errors while running CTest
[10:01:36][Step 1/1] The difference between static_cast<float*>(output.data.data())[i] and refer.data[i] is 5.3048133850097656e-06, which exceeds 1e-6, where
[10:01:36][Step 1/1] static_cast<float*>(output.data.data())[i] evaluates to 0.47985932230949402,
[10:01:36][Step 1/1] refer.data[i] evaluates to 0.47985401749610901, and
[10:01:36][Step 1/1] 1e-6 evaluates to 9.9999999999999995e-07.
[10:01:36][Step 1/1] /paddle/paddle/contrib/inference/demo/vis_demo.cc:94: Failure
...

mobilenet cpu data size check error:

[Step 1/1] 351/353 Test #351: mobilenet_inference_demo ........................***Exception: Other  8.56 sec
[10:01:33][Step 1/1] [==========] Running 2 tests from 1 test case.
[10:01:33][Step 1/1] [----------] Global test environment set-up.
[10:01:33][Step 1/1] [----------] 2 tests from demo
[10:01:33][Step 1/1] [ RUN      ] demo.vis_demo_cpu
[10:01:33][Step 1/1] WARNING: Logging before InitGoogleLogging() is written to STDERR
[10:01:33][Step 1/1] I0626 10:01:31.829222 50410 vis_demo.cc:113] init predictor
[10:01:33][Step 1/1] I0626 10:01:31.846272 50410 vis_demo.cc:117] begin to process data
[10:01:33][Step 1/1] I0626 10:01:31.853760 50410 vis_demo.cc:50] process a line
[10:01:33][Step 1/1] I0626 10:01:31.913990 50410 vis_demo.cc:68] data size 270000
[10:01:33][Step 1/1] I0626 10:01:31.914029 50410 vis_demo.cc:69] data shape size 4
[10:01:33][Step 1/1] I0626 10:01:31.915087 50410 vis_demo.cc:132] run executor
[10:01:33][Step 1/1] I0626 10:01:32.192790 50410 vis_demo.cc:136] output.size 1
[10:01:33][Step 1/1] I0626 10:01:32.192885 50410 vis_demo.cc:138] output: data[:10]	3 0.0267651 0.595492 0.553865 0.710751 0.837597 5 0.0162648 0.303328 -0.00768402 
[10:01:33][Step 1/1] I0626 10:01:32.192948 50410 vis_demo.cc:50] process a line
[10:01:33][Step 1/1] F0626 10:01:32.192968 50410 vis_demo.cc:53] Check failed: columns.size() == 2UL (0 vs. 2) data format error, should be <data>	<shape>
[10:01:33][Step 1/1] *** Check failure stack trace: ***

@tensor-tang tensor-tang force-pushed the feature/infer_demo/se-resnext50 branch from 045b77c to 33b8ea8 Compare June 26, 2018 12:57
@tensor-tang
Copy link
Contributor Author

tensor-tang commented Jun 26, 2018

Still have this issue:

351/353 Test #351: mobilenet_inference_demo ........................***Exception: Other  7.91 sec
[15:20:13][Step 1/1] [==========] Running 2 tests from 1 test case.
[15:20:13][Step 1/1] [----------] Global test environment set-up.
[15:20:13][Step 1/1] [----------] 2 tests from demo
[15:20:13][Step 1/1] [ RUN      ] demo.vis_demo_cpu
[15:20:13][Step 1/1] WARNING: Logging before InitGoogleLogging() is written to STDERR
[15:20:13][Step 1/1] I0626 15:20:11.055225 48676 vis_demo.cc:113] init predictor
[15:20:13][Step 1/1] I0626 15:20:11.104532 48676 vis_demo.cc:117] begin to process data
[15:20:13][Step 1/1] I0626 15:20:11.117425 48676 vis_demo.cc:50] process a line
[15:20:13][Step 1/1] I0626 15:20:11.245939 48676 vis_demo.cc:68] data size 270000
[15:20:13][Step 1/1] I0626 15:20:11.245976 48676 vis_demo.cc:69] data shape size 4
[15:20:13][Step 1/1] I0626 15:20:11.247333 48676 vis_demo.cc:132] run executor
[15:20:13][Step 1/1] I0626 15:20:11.545816 48676 vis_demo.cc:136] output.size 1
[15:20:13][Step 1/1] I0626 15:20:11.545897 48676 vis_demo.cc:138] output: data[:10]	3 0.0267651 0.595492 0.553865 0.710751 0.837597 5 0.0162648 0.303328 -0.00768402 
[15:20:13][Step 1/1] I0626 15:20:11.545958 48676 vis_demo.cc:50] process a line
[15:20:13][Step 1/1] F0626 15:20:11.545975 48676 vis_demo.cc:53] Check failed: columns.size() == 2UL (0 vs. 2) data format error, should be <data>	<shape>
[15:20:13][Step 1/1] *** Check failure stack trace: ***

But it can pass on my local machine.

@luotao1 Could you help double check on your local machine?

BTW the data has been download, https://paddleci.ngrok.io/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=164&_focus=2973

[Step 1/1] -- inference demo /paddle/build/inference_demo/mobilenet_inference_demo
[14:46:07][Step 1/1] -- Download mobilenet_inference_demo model from http://paddlemodels.bj.bcebos.com/inference-vis-demos%2Fmobilenet.tar.gz

@luotao1
Copy link
Contributor

luotao1 commented Jun 27, 2018

Could you help double check on your local machine

@tensor-tang I am OK on my local machine. You can add md5sum to check the success of Download.

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Superjomn Superjomn merged commit 5299387 into PaddlePaddle:develop Jun 27, 2018
@tensor-tang tensor-tang deleted the feature/infer_demo/se-resnext50 branch June 27, 2018 03:13
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

Successfully merging this pull request may close these issues.

3 participants