报表格式
所需文件¶
metadata.json
algConfigs: 报表运行的算法
outputLabelSet: 报表运行的输出
shapes.json
ancestor_alg: 父级算法
__wholeimage__: 顶级算法
parents: 父级轮廓+依赖(有依赖的话)
shapes: 算法输出(渲染)
解析逻辑¶
metadata.json 全局一份
shapes.json 每张图一份
java代码示例
// 循环需要渲染的 Shape
node.get("shapes").forEach { shapeNode ->
// 解析单个 Shape 为 JavaBean
var shape = MAPPER.convertValue<Shape>(shapeNode)
// 获取 Shape 的算法信息
metadata.algConfig(shape.algId) { algConfig ->
// 分类算法(model_type == cls),且子级算法
if (algConfig.cls() && algConfig.sub()) {
val pId = node.get("ancestor_alg").asText()
shape = node.get("parents").get(pId)
}
// 分类+语义算法(model_type == cls_sem_seg),且子级算法
if (algConfig.cls_sem_seg() && algConfig.sub()) {
// 算法 outData.cls == true,分类标签
if (algConfig.clsLabelSet().contains(shape.label)) {
val pId = node.get("ancestor_alg").asText()
shape = node.get("parents").get(pId)
}
}
}
}