@code{.bash}
-$ example_dnn_object_detection --config=[PATH-TO-DARKNET]/cfg/yolo.cfg --model=[PATH-TO-DARKNET]/yolo.weights --classes=object_detection_classes_pascal_voc.txt --width=416 --height=416 --scale=0.00392 --input[PATH-TO-IMAGE-OR-VIDEO-FILE]
+$ example_dnn_object_detection --config=[PATH-TO-DARKNET]/cfg/yolo.cfg --model=[PATH-TO-DARKNET]/yolo.weights --classes=object_detection_classes_pascal_voc.txt --width=416 --height=416 --scale=0.00392 --input=[PATH-TO-IMAGE-OR-VIDEO-FILE]
@endcode
EXPECT_EQ(6u, abuf.size());
}
+TEST(CommandLineParser, testScalar)
+{
+ static const char * const keys3 =
+ "{ s0 | 3 4 5 | default scalar }"
+ "{ s1 | | single value scalar }"
+ "{ s2 | | two values scalar (default with zeros) }"
+ "{ s3 | | three values scalar }"
+ "{ s4 | | four values scalar }"
+ "{ s5 | | five values scalar }";
+
+ const char* argv[] = {"<bin>", "--s1=1.1", "--s3=1.1 2.2 3",
+ "--s4=-4.2 1 0 3", "--s5=5 -4 3 2 1"};
+ const int argc = 5;
+ CommandLineParser parser(argc, argv, keys3);
+ EXPECT_EQ(parser.get<Scalar>("s0"), Scalar(3, 4, 5));
+ EXPECT_EQ(parser.get<Scalar>("s1"), Scalar(1.1));
+ EXPECT_EQ(parser.get<Scalar>("s2"), Scalar(0));
+ EXPECT_EQ(parser.get<Scalar>("s3"), Scalar(1.1, 2.2, 3));
+ EXPECT_EQ(parser.get<Scalar>("s4"), Scalar(-4.2, 1, 0, 3));
+ EXPECT_EQ(parser.get<Scalar>("s5"), Scalar(5, -4, 3, 2));
+}
+
}} // namespace
*/
int inputNameToIndex(String inputName);
- int outputNameToIndex(String outputName);
+ int outputNameToIndex(const String& outputName);
};
/** @brief Classical recurrent layer
/** @brief Returns index of output blob in output array.
* @see inputNameToIndex()
*/
- CV_WRAP virtual int outputNameToIndex(String outputName);
+ CV_WRAP virtual int outputNameToIndex(const String& outputName);
/**
* @brief Ask layer if it support specific backend for doing computations.
* @ref readNetFromTorch or @ref readNetFromDarknet. An order of @p model and @p config
* arguments does not matter.
*/
- CV_EXPORTS_W Net readNet(String model, String config = "", String framework = "");
+ CV_EXPORTS_W Net readNet(const String& model, const String& config = "", const String& framework = "");
/** @brief Loads blob which was serialized as torch.Tensor object of Torch7 framework.
* @warning This function has the same limitations as readNetFromTorch().
void forward(std::vector<Mat*>&, std::vector<Mat>&, std::vector<Mat> &) {}
void forward(InputArrayOfArrays inputs, OutputArrayOfArrays outputs, OutputArrayOfArrays internals) {}
- int outputNameToIndex(String tgtName)
+ int outputNameToIndex(const String& tgtName)
{
int idx = (int)(std::find(outNames.begin(), outNames.end(), tgtName) - outNames.begin());
return (idx < (int)outNames.size()) ? idx : -1;
return -1;
}
-int Layer::outputNameToIndex(String)
+int Layer::outputNameToIndex(const String&)
{
return -1;
}
BackendWrapper::~BackendWrapper() {}
-Net readNet(String model, String config, String framework)
+Net readNet(const String& _model, const String& _config, const String& _framework)
{
- framework = framework.toLowerCase();
+ String framework = _framework.toLowerCase();
+ String model = _model;
+ String config = _config;
const std::string modelExt = model.substr(model.rfind('.') + 1);
const std::string configExt = config.substr(config.rfind('.') + 1);
if (framework == "caffe" || modelExt == "caffemodel" || configExt == "caffemodel" ||
return -1;
}
-int LSTMLayer::outputNameToIndex(String outputName)
+int LSTMLayer::outputNameToIndex(const String& outputName)
{
if (outputName.toLowerCase() == "h")
return 0;