提交 da63ea3f 编写于 作者: J Jiaying Zhao 提交者: zp7

update test_super for 360P, 480P, 576P, 720P (#1741)

上级 e00ccef5
...@@ -21,131 +21,98 @@ int main() { ...@@ -21,131 +21,98 @@ int main() {
paddle_mobile::PaddleMobileConfigInternal config; paddle_mobile::PaddleMobileConfigInternal config;
config.load_when_predict = true; config.load_when_predict = true;
auto time1 = paddle_mobile::time();
#ifdef PADDLE_MOBILE_CL #ifdef PADDLE_MOBILE_CL
paddle_mobile::PaddleMobile<paddle_mobile::GPU_CL> paddle_mobile(config); paddle_mobile::PaddleMobile<paddle_mobile::GPU_CL> paddle_mobile(config);
paddle_mobile.SetCLPath("/data/local/tmp/bin"); paddle_mobile.SetCLPath("/data/local/tmp/bin");
#else #else
paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile(config); paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile;
#endif #endif
// paddle_mobile.SetThreadNum(4); // paddle_mobile.SetThreadNum(4);
int max = 10;
auto time1 = paddle_mobile::time();
auto isok = paddle_mobile.Load(std::string(g_super) + "/model", auto isok = paddle_mobile.Load(std::string(g_super) + "/model",
std::string(g_super) + "/params", true, false, std::string(g_super) + "/params", true, false,
1, false); 1, false);
// auto isok = paddle_mobile.Load(std::string(g_mobilenet_mul), true);
if (isok) { if (isok) {
auto time2 = paddle_mobile::time(); auto time2 = paddle_mobile::time();
std::cout << "load cost :" << paddle_mobile::time_diff(time1, time2) << "ms" std::cout << "load cost :" << paddle_mobile::time_diff(time1, time2) << "ms"
<< std::endl; << std::endl;
// 300*300
// std::vector<float> input;
// std::vector<int64_t> dims{1, 1, 300, 300};
// GetInput<float>(g_test_image_1x3x224x224, &input, dims);
//
// std::vector<float> vec_result;
// 300 * 300
std::vector<float> input;
std::vector<int64_t> dims{1, 1, 300, 300};
GetInput<float>(g_test_image_1x3x224x224, &input, dims);
paddle_mobile.Predict(input, dims);
// 640 * 360 (360P)
std::vector<float> input1;
std::vector<int64_t> dims1{1, 1, 640, 360};
GetInput<float>(g_test_image_1x3x224x224, &input1, dims1);
auto time3 = paddle_mobile::time(); auto time3 = paddle_mobile::time();
int max = 1; for (int i = 0; i < max; ++i) {
auto time1 = paddle_mobile::time();
paddle_mobile.Predict(input1, dims1);
auto time2 = paddle_mobile::time();
std::cout << "640 * 360 predict cost :第" << i << ": "
<< paddle_mobile::time_diff(time1, time2) << "ms" << std::endl;
}
auto time4 = paddle_mobile::time();
std::cout << "640 * 360 predict cost :"
<< paddle_mobile::time_diff(time3, time4) / max << "ms"
<< std::endl;
// for (int i = 0; i < max; ++i) { // 720 * 480 (480P)
// auto time5 = paddle_mobile::time(); std::vector<float> input2;
// vec_result = paddle_mobile.Predict(input, dims); std::vector<int64_t> dims2{1, 1, 720, 480};
// auto time6 = paddle_mobile::time(); GetInput<float>(g_test_image_1x3x224x224, &input2, dims2);
// std::cout << "300 predict cost :第" << i << ": " auto time5 = paddle_mobile::time();
// << paddle_mobile::time_diff(time5, time6) << "ms" << for (int i = 0; i < max; ++i) {
// std::endl; auto time1 = paddle_mobile::time();
// } paddle_mobile.Predict(input2, dims2);
// auto time4 = paddle_mobile::time(); auto time2 = paddle_mobile::time();
// std::cout << "720 * 480 predict cost :第" << i << ": "
// std::cout << "300 predict cost :" << paddle_mobile::time_diff(time1, time2) << "ms" << std::endl;
// << paddle_mobile::time_diff(time3, time4) / max << "ms" }
// << std::endl; auto time6 = paddle_mobile::time();
// auto biggest = std::cout << "720 * 480 predict cost :"
// std::max_element(std::begin(vec_result), std::end(vec_result)); << paddle_mobile::time_diff(time5, time6) / max << "ms"
// std::cout << "300 Max element is " << *biggest << " at position " << std::endl;
// << std::distance(std::begin(vec_result), biggest) <<
// std::endl; // 1024 * 576 (576P)
// std::vector<float> input3;
// // 500*500 std::vector<int64_t> dims3{1, 1, 1024, 576};
// std::vector<float> vec_result2; GetInput<float>(g_test_image_1x3x224x224, &input3, dims3);
// auto time7 = paddle_mobile::time();
// std::vector<float> input2; for (int i = 0; i < max; ++i) {
// std::vector<int64_t> dims2{1, 1, 500, 500}; auto time1 = paddle_mobile::time();
// GetInput<float>(g_test_image_1x3x224x224, &input2, dims2); paddle_mobile.Predict(input3, dims3);
// auto time2 = paddle_mobile::time();
// time3 = paddle_mobile::time(); std::cout << "1024 * 576 predict cost :第" << i << ": "
// for (int i = 0; i < max; ++i) { << paddle_mobile::time_diff(time1, time2) << "ms" << std::endl;
// auto time5 = paddle_mobile::time(); }
// vec_result2 = paddle_mobile.Predict(input2, dims2); auto time8 = paddle_mobile::time();
// auto time6 = paddle_mobile::time(); std::cout << "1024 * 576 predict cost :"
// std::cout << "500 predict cost :第" << i << ": " << paddle_mobile::time_diff(time7, time8) / max << "ms"
// << paddle_mobile::time_diff(time5, time6) << "ms" << << std::endl;
// std::endl;
// }
//
// time4 = paddle_mobile::time();
// std::cout << "500 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// biggest = std::max_element(std::begin(vec_result2),
// std::end(vec_result2)); std::cout << "500 Max element is " << *biggest
// << " at position "
// << std::distance(std::begin(vec_result2), biggest) <<
// std::endl;
//
// // 1000*1000
//
// std::vector<float> vec_result3;
// std::vector<float> input3;
// std::vector<int64_t> dims3{1, 1, 1000, 1000};
// GetInput<float>(g_test_image_1x3x224x224, &input3, dims3);
//
// time3 = paddle_mobile::time();
//
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result3 = paddle_mobile.Predict(input3, dims3);
// auto time6 = paddle_mobile::time();
// std::cout << "1000*1000 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" <<
// std::endl;
// }
// time4 = paddle_mobile::time();
// std::cout << "1000*1000 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// biggest = std::max_element(std::begin(vec_result3),
// std::end(vec_result3)); std::cout << "1000*1000 Max element is " <<
// *biggest << " at position "
// << std::distance(std::begin(vec_result3), biggest) <<
// std::endl;
// 224*224 // 1280 * 720
std::vector<float> vec_result4;
std::vector<float> input4; std::vector<float> input4;
std::vector<int64_t> dims4{1, 1, 300, 300}; std::vector<int64_t> dims4{1, 1, 1280, 720};
GetInput<float>(g_test_image_1x3x224x224, &input4, dims4); GetInput<float>(g_test_image_1x3x224x224, &input4, dims4);
auto time9 = paddle_mobile::time();
time3 = paddle_mobile::time();
for (int i = 0; i < max; ++i) { for (int i = 0; i < max; ++i) {
auto time5 = paddle_mobile::time(); auto time1 = paddle_mobile::time();
vec_result4 = paddle_mobile.Predict(input4, dims4); paddle_mobile.Predict(input4, dims4);
auto time6 = paddle_mobile::time(); auto time2 = paddle_mobile::time();
std::cout << "300*300 predict cost :第" << i << ": " std::cout << "1280 * 720 predict cost :第" << i << ": "
<< paddle_mobile::time_diff(time5, time6) << "ms" << std::endl; << paddle_mobile::time_diff(time1, time2) << "ms" << std::endl;
} }
auto time10 = paddle_mobile::time();
auto time4 = paddle_mobile::time(); std::cout << "1280 * 720 predict cost :"
std::cout << "300*300 predict cost :" << paddle_mobile::time_diff(time9, time10) / max << "ms"
<< paddle_mobile::time_diff(time3, time4) / max << "ms"
<< std::endl; << std::endl;
// biggest = std::max_element(std::begin(vec_result4),
// std::end(vec_result4)); std::cout << "224*224 Max element is " <<
// *biggest << " at position "
// << std::distance(std::begin(vec_result4), biggest) <<
// std::endl;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册