test_PyCNService.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*************************************************************************
  2. * Copyright (C) [2021] by Cambricon, Inc. All rights reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #include <gflags/gflags.h>
  21. #include <atomic>
  22. #include <mutex>
  23. #include <condition_variable>
  24. #include <iostream>
  25. #include <list>
  26. #include <memory>
  27. #include <sstream>
  28. #include <string>
  29. #include <vector>
  30. #include "opencv2/highgui/highgui.hpp"
  31. #include "opencv2/imgproc/imgproc.hpp"
  32. #if (CV_MAJOR_VERSION >= 3)
  33. #include "opencv2/imgcodecs/imgcodecs.hpp"
  34. #endif
  35. #include "data_source.hpp"
  36. #include "displayer.hpp"
  37. #include "util.hpp"
  38. #include "cnstream_logging.hpp"
  39. #include "profiler/pipeline_profiler.hpp"
  40. #include "profiler/profile.hpp"
  41. #include "profiler/trace_serialize_helper.hpp"
  42. #include "gtest/gtest.h"
  43. #include "pycnservice.hpp"
  44. #include "pipeline_handler.hpp"
  45. #include "cnstype.h"
  46. namespace cnstream {
  47. TEST(TESTWEB, TESTPYCNSERVICE) {
  48. std::shared_ptr<PyCNService> cnservice = std::make_shared<PyCNService>();
  49. CNServiceInfo service_info = {false, true, 30, 100, 1080, 620};
  50. cnservice->InitService(service_info);
  51. std::string input_filename = GetExePath() + "../web_visualize/src/webui/static/data/cars.mp4";
  52. std::string config_json = GetExePath() + "../web_visualize/src/webui/static/json/resnet50.json";
  53. cnservice->Start(input_filename, config_json);
  54. cnservice->WaitStop();
  55. }
  56. } // namespace cnstream