box_type in BoxInfo outputmetadata was integer value.
It is changed to string, ORIGIN_LEFTTOP and ORIGIN_CENTER.
A user can use the string while understading purpose of box_type metadata.
The string values are parsed and converted to enumeration
INFERENCE_BOX_TYPE_ORIGIN_LEFTTOP or INFERENCE_BOX_TYPE_ORIGIN_CENTER.
Change-Id: Icab71b26ca3c96652c23a584eb8a3ec5c6d7d44b
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
{
"name" : "regressors",
"index" : [-1, -1, 1],
- "box_type" : 1,
+ "box_type" : "ORIGIN_CENTER",
"box_order" : [1, 0, 3, 2],
"box_coordinate" : 1,
"decoding_type" : 1,
{
"name" : "TFLite_Detection_PostProcess",
"index" : [-1, -1, 1],
- "box_type" : 0,
+ "box_type" : "ORIGIN_LEFTTOP",
"box_order" : [1, 0, 3, 2],
"box_coordinate" : 0,
"decoding_type": 0
{
"name" : "TFLite_Detection_PostProcess",
"index" : [-1, -1, 1],
- "box_type" : 0,
+ "box_type" : "ORIGIN_LEFTTOP",
"box_order" : [1, 0, 3, 2],
"box_coordinate" : 0,
"decoding_type": 0
{
"name" : "raw_outputs/box_encodings",
"index" : [-1, -1, 1],
- "box_type" : 1,
+ "box_type" : "ORIGIN_CENTER",
"box_order" : [1, 0, 3, 2],
"box_coordinate" : 0,
"decoding_type" : 1,
private:
std::string name;
DimInfo dimInfo;
- int type; // 0:LTRB, 1: CxCyWH
+ inference_box_type_e type; // 0:L-T-R-B, 1: Cx-Cy-W-H
std::vector<int> order; // Order based on box type
int coordinate; // 0: ratio, 1: pixel
int decodingType; // 0: post-op, 1: achorbox(ssd), 2:yolo(?)
DecodeInfo decodingInfo;
+ std::map<std::string, inference_box_type_e> supportedBoxTypes;
+
public:
- BoxInfo() = default;
+ BoxInfo();
~BoxInfo() = default;
std::string GetName() { return name; }
DimInfo GetDimInfo() { return dimInfo; }
- int GetType() { return type; }
+ inference_box_type_e GetType() { return type; }
int GetDecodingType() { return decodingType; }
std::vector<int> GetOrder() { return order; }
int GetCoordinate() { return coordinate; }
{
namespace inference
{
+ // score
typedef enum {
INFERENCE_SCORE_TYPE_NORMAL,
INFERENCE_SCORE_TYPE_SIGMOID
} inference_score_type_e;
+
+ // box
+ typedef enum {
+ INFERENCE_BOX_TYPE_ORIGIN_LEFTTOP,
+ INFERENCE_BOX_TYPE_ORIGIN_CENTER
+ } inference_box_type_e;
}
}
float cHeight = mTensorBuffer.getValue<float>(mBoxInfo.GetName(),
idx * mBoxOffset + mBoxInfo.GetOrder()[3]);
- // when GetType() == 0 (l,t,r,b), then convert it to (cx,cy,w,h)
- if (mBoxInfo.GetType() == 0) {
+ // convert type to ORIGIN_CENTER if ORIGIN_LEFTTOP
+ if (mBoxInfo.GetType() == INFERENCE_BOX_TYPE_ORIGIN_LEFTTOP) {
float tmpCx = cx;
float tmpCy = cy;
cx = (cx + cWidth) * 0.5f; // (left + right)/2
return MEDIA_VISION_ERROR_NONE;
}
+ BoxInfo::BoxInfo() :
+ name(),
+ dimInfo(),
+ type(INFERENCE_BOX_TYPE_ORIGIN_LEFTTOP),
+ order(),
+ coordinate(0),
+ decodingType(0),
+ decodingInfo()
+
+ {
+ supportedBoxTypes.insert({"ORIGIN_LEFTTOP", INFERENCE_BOX_TYPE_ORIGIN_LEFTTOP});
+ supportedBoxTypes.insert({"ORIGIN_CENTER", INFERENCE_BOX_TYPE_ORIGIN_CENTER});
+ }
+
int BoxInfo::ParseBox(JsonObject *root)
{
LOGI("ENTER");
dimInfo.SetValidIndex(elem2);
}
- type = static_cast<int>(json_object_get_int_member(pObject, "box_type"));
- LOGI("box type: %d", type);
+ try {
+ type = OutputMetadata::GetSupportedType(pObject, "box_type", supportedBoxTypes);
+ } catch (const std::exception& e) {
+ LOGE("Invalid %s", e.what());
+ }
array = json_object_get_array_member(pObject, "box_order");
elements2 = json_array_get_length(array);
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
-Version: 0.8.8
-Release: 1
+Version: 0.8.9
+Release: 0
Group: Multimedia/Framework
License: Apache-2.0 and BSD-3-Clause
Source0: %{name}-%{version}.tar.gz