mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
extended support for min, max and mod layers
This commit is contained in:
@@ -375,9 +375,9 @@ public:
|
||||
{
|
||||
CV_CheckTypeEQ(inputs[0], input, "All inputs should have equal types");
|
||||
if (preferableTarget == DNN_TARGET_OPENCL_FP16)
|
||||
CV_CheckType(input, input == CV_16F || input == CV_8S || input == CV_8U || input == CV_32S || input == CV_64S, "");
|
||||
CV_CheckType(input, input == CV_16F || input == CV_8S || input == CV_8U || input == CV_16S || input == CV_16U || input == CV_32S || input == CV_32U || input == CV_64S || input == CV_64U, "");
|
||||
else
|
||||
CV_CheckType(input, input == CV_32F || input == CV_8S || input == CV_8U || input == CV_32S || input == CV_64S, "");
|
||||
CV_CheckType(input, input == CV_32F || input == CV_8S || input == CV_8U || input == CV_16S || input == CV_16U || input == CV_32S || input == CV_32U || input == CV_64S || input == CV_64U, "");
|
||||
}
|
||||
|
||||
if (op == OPERATION::EQUAL || op == OPERATION::GREATER || op == OPERATION::GREATER_EQUAL || op == OPERATION::LESS || op == OPERATION::LESS_EQUAL)
|
||||
@@ -944,6 +944,18 @@ public:
|
||||
op != OPERATION::OR && op != OPERATION::XOR);
|
||||
opDispatch<float>(std::forward<Args>(args)...);
|
||||
break;
|
||||
case CV_16S:
|
||||
opDispatch<int16_t>(std::forward<Args>(args)...);
|
||||
break;
|
||||
case CV_16U:
|
||||
opDispatch<uint16_t>(std::forward<Args>(args)...);
|
||||
break;
|
||||
case CV_32U:
|
||||
opDispatch<uint32_t>(std::forward<Args>(args)...);
|
||||
break;
|
||||
case CV_64U:
|
||||
opDispatch<uint64_t>(std::forward<Args>(args)...);
|
||||
break;
|
||||
default:
|
||||
CV_Error(cv::Error::BadDepth, "Unsupported type.");
|
||||
};
|
||||
|
||||
@@ -1865,6 +1865,34 @@ Mat getMatFromTensor(const opencv_onnx::TensorProto& tensor_proto, bool uint8ToI
|
||||
{
|
||||
Mat(sizes, CV_Bool, rawdata).copyTo(blob);
|
||||
}
|
||||
else if (datatype == opencv_onnx::TensorProto_DataType_INT16)
|
||||
{
|
||||
if (!tensor_proto.int32_data().empty())
|
||||
Mat(sizes, CV_32SC1, (void*)tensor_proto.int32_data().data()).convertTo(blob, CV_16SC1);
|
||||
else
|
||||
Mat(sizes, CV_16SC1, rawdata).copyTo(blob);
|
||||
}
|
||||
else if (datatype == opencv_onnx::TensorProto_DataType_UINT16)
|
||||
{
|
||||
if (!tensor_proto.int32_data().empty())
|
||||
Mat(sizes, CV_32SC1, (void*)tensor_proto.int32_data().data()).convertTo(blob, CV_16UC1);
|
||||
else
|
||||
Mat(sizes, CV_16UC1, rawdata).copyTo(blob);
|
||||
}
|
||||
else if (datatype == opencv_onnx::TensorProto_DataType_UINT32)
|
||||
{
|
||||
if (!tensor_proto.int32_data().empty())
|
||||
Mat(sizes, CV_32SC1, (void*)tensor_proto.int32_data().data()).convertTo(blob, CV_32UC1);
|
||||
else
|
||||
Mat(sizes, CV_32UC1, rawdata).copyTo(blob);
|
||||
}
|
||||
else if (datatype == opencv_onnx::TensorProto_DataType_UINT64)
|
||||
{
|
||||
if (!tensor_proto.int64_data().empty())
|
||||
Mat(sizes, CV_64SC1, (void*)tensor_proto.int64_data().data()).convertTo(blob, CV_64UC1);
|
||||
else
|
||||
Mat(sizes, CV_64UC1, rawdata).copyTo(blob);
|
||||
}
|
||||
else
|
||||
{
|
||||
// @TODO: refactor the error handling
|
||||
|
||||
@@ -927,33 +927,33 @@ CASE(test_matmul_4d)
|
||||
CASE(test_matmulinteger)
|
||||
// no filter
|
||||
CASE(test_max_example)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_float16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_float32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_float64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_int16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_int32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_int64)
|
||||
SKIP;
|
||||
CASE(test_max_int8)
|
||||
// no filter
|
||||
CASE(test_max_one_input)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_two_inputs)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_uint16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_uint32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_uint64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_max_uint8)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_maxpool_1d_default)
|
||||
#if SKIP_SET_1
|
||||
SKIP_MYRIAD;
|
||||
@@ -1027,41 +1027,41 @@ CASE(test_mean_one_input)
|
||||
CASE(test_mean_two_inputs)
|
||||
SKIP;
|
||||
CASE(test_min_example)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_float16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_float32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_float64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_int16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_int32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_int64)
|
||||
SKIP;
|
||||
CASE(test_min_int8)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_one_input)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_two_inputs)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_uint16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_uint32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_uint64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_min_uint8)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mish)
|
||||
// no filter
|
||||
CASE(test_mish_expanded)
|
||||
// no filter
|
||||
CASE(test_mod_broadcast)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_int64_fmod)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_mixed_sign_float16)
|
||||
// no filter
|
||||
if (target == DNN_TARGET_OPENCL)
|
||||
@@ -1084,21 +1084,21 @@ CASE(test_mod_mixed_sign_float64)
|
||||
default_lInf = 0.0016; // Expected: (normInf) <= (lInf), actual: 0.00156251 vs 0.0001
|
||||
}
|
||||
CASE(test_mod_mixed_sign_int16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_mixed_sign_int32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_mixed_sign_int64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_mixed_sign_int8)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_uint16)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_uint32)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_uint64)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_mod_uint8)
|
||||
// no filter
|
||||
SKIP;
|
||||
CASE(test_momentum)
|
||||
// no filter
|
||||
CASE(test_momentum_multiple)
|
||||
|
||||
@@ -93,3 +93,15 @@
|
||||
"test_triu_square_neg",
|
||||
"test_det_2d",
|
||||
"test_det_nd",
|
||||
"test_max_int16",
|
||||
"test_max_uint16",
|
||||
"test_max_uint32",
|
||||
"test_max_uint64",
|
||||
"test_min_int16",
|
||||
"test_min_uint16",
|
||||
"test_min_uint32",
|
||||
"test_min_uint64",
|
||||
"test_mod_mixed_sign_int16",
|
||||
"test_mod_uint16",
|
||||
"test_mod_uint32",
|
||||
"test_mod_uint64",
|
||||
|
||||
@@ -113,18 +113,6 @@
|
||||
"test_lstm_with_initial_bias", // ---- same as above ---
|
||||
"test_lstm_with_peepholes", // ---- same as above ---
|
||||
"test_matmulinteger", // Issues::Layer does not exist. Can't create layer "onnx_node_output_0!Y" of type "MatMulInteger" in function 'getLayerInstance'
|
||||
"test_max_int16", // Issue:: Unsupported data type
|
||||
"test_max_uint16", // Issue:: Unsupported data type
|
||||
"test_max_uint32", // Issue:: Unsupported data type
|
||||
"test_max_uint64", // Issue:: Unsupported data type
|
||||
"test_min_int16", // Issue:: Unsupported data type
|
||||
"test_min_uint16", // Issue:: Unsupported data type
|
||||
"test_min_uint32", // Issue:: Unkonwn error
|
||||
"test_min_uint64", // Issue:: Unsupported data type
|
||||
"test_mod_mixed_sign_int16", // Issue:: Unkonwn error
|
||||
"test_mod_uint16", // Issue:: Unkonwn error
|
||||
"test_mod_uint32", // ---- same as above ---
|
||||
"test_mod_uint64", // ---- same as above ---
|
||||
"test_momentum", // Issues::Layer does not exist. Can't create layer "onnx_node_output_0!X1_new" of type "ai.onnx.preview.training.Momentum" in function 'getLayerInstance'
|
||||
"test_momentum_multiple", // ---- same as above ---
|
||||
"test_mvn", // Issues::Wrong answer
|
||||
|
||||
Reference in New Issue
Block a user