20 #include <gtest/gtest.h> 21 #include <opencv2/highgui.hpp> 26 TEST(UnitTestFunction, testLibraryFunctions)
28 std::vector<std::string> caffe_dirs = {
"AlexNet",
"GoogLeNet",
"SqueezeNet",
"SSD_MobileNet",
"TinyYolo" };
29 std::vector<std::string> tf_dirs = {
"inception_v1",
"inception_v2",
"inception_v3",
"inception_v4",
"mobilenets" };
30 std::vector<std::string> caffe_nets = {
"alexnet",
"googlenet",
"squeezenet",
"mobilenetssd",
"tinyyolo_v1" };
31 std::vector<std::string> tf_nets = {
"inception_v1",
"inception_v2",
"inception_v3",
"inception_v4",
"mobilenet" };
32 std::vector<std::string> caffe_categories = {
"imagenet1000.txt",
"imagenet1000.txt",
"imagenet1000.txt",
"voc21.txt",
34 std::vector<std::vector<float>> caffe_means = { { 104.0069879317889, 116.66876761696767, 122.6789143406786 },
35 { 104.0069879317889, 116.66876761696767, 122.6789143406786 },
36 { 104.0069879317889, 116.66876761696767, 122.6789143406786 },
37 { 127.5, 127.5, 127.5 },
40 std::vector<std::vector<float>> tf_means = { { 128.0, 128.0, 128.0 },
41 { 128.0, 128.0, 128.0 },
42 { 128.0, 128.0, 128.0 },
43 { 128.0, 128.0, 128.0 },
44 { 127.5, 127.5, 127.5 } };
45 std::vector<float> caffe_scales = { 1.0, 1.0, 1.0, 0.007843, 0.00392156 };
46 std::vector<float> tf_scales = { 0.0078125, 0.0078125, 0.0078125, 0.0078125, 0.007843 };
47 std::vector<int> caffe_dimensions = { 227, 224, 227, 300, 448 };
48 std::vector<int> tf_dimensions = { 224, 224, 299, 299, 224 };
50 for (
unsigned int i = 0; i < caffe_nets.size(); i++)
53 std::shared_ptr<movidius_ncs_lib::NCSManager> handle = std::make_shared<movidius_ncs_lib::NCSManager>(
55 "/opt/movidius/ncappzoo/caffe/" + caffe_dirs[i] +
"/graph",
56 "/opt/movidius/ncappzoo/data/ilsvrc12/" + caffe_categories[i], caffe_dimensions[i], caffe_means[i],
58 EXPECT_TRUE(handle !=
nullptr);
59 std::vector<std::string> images_path;
63 handle->classifyImage(images_path);
67 handle->detectImage(images_path);
72 for (
unsigned int i = 0; i < tf_nets.size(); i++)
75 std::shared_ptr<movidius_ncs_lib::NCSManager> handle = std::make_shared<movidius_ncs_lib::NCSManager>(
77 "/opt/movidius/ncappzoo/tensorflow/" + tf_dirs[i] +
"/graph",
78 "/opt/movidius/ncappzoo/data/ilsvrc12/imagenet1001.txt", tf_dimensions[i], tf_means[i], tf_scales[i], 3);
79 EXPECT_TRUE(handle !=
nullptr);
80 std::vector<std::string> images_path;
82 handle->classifyImage(images_path);
88 TEST(UnitTestFunction, testLibraryIncorrectInputs)
92 std::vector<float> incorrect_mean = { 0, 0, 0 };
93 std::shared_ptr<movidius_ncs_lib::NCSManager> handle = std::make_shared<movidius_ncs_lib::NCSManager>(
95 "categories_not_exist", 0, incorrect_mean, 0, 3);
103 int main(
int argc,
char** argv)
105 testing::InitGoogleTest(&argc, argv);
106 return RUN_ALL_TESTS();
TEST(UnitTestFunction, testLibraryFunctions)
ROSLIB_DECL std::string getPath(const std::string &package_name)
int main(int argc, char **argv)