自己定义的lenet模型不支持

您好,我们自己定义的lenet模型在runtime_sim下的推理运行时报错:

请问这个问题该如何解决呢?

注释:这个问题我们在后处理源码文件中做了如下修改:

else if (model_name == "resnet18" || model_name == "googlenet" ||           model_name == "se_resnet_gray" || model_name == "mobilenetv1" ||           model_name == "mobilenetv2" || model_name == "resnet50_feature" ||           model_name == "lenet_gray" || model_name == "classification" ||           model_name.find("efficientnet") != std::string::npos) {  return new ClassificationPostProcessModule(model_name);修改后如下else if (model_name == "resnet18" || model_name == "googlenet" || model_name=="lenet" ||           model_name == "se_resnet_gray" || model_name == "mobilenetv1" ||           model_name == "mobilenetv2" || model_name == "resnet50_feature" ||           model_name == "lenet_gray" || model_name == "classification" ||           model_name.find("efficientnet") != std::string::npos) {  return new ClassificationPostProcessModule(model_name);虽然报错得以解决,但是图像输出的结果始终错误,错误如下:

由于自己训练的lent模型,在最后一层没有添加softmax,因此导致出现问题,

具体修改方法,参考源码:3_common/src/post_process/classification_post_process.cc

//需要修改的方法void ClassificationPostProcessModule::GetMaxResult(BPU_TENSOR_S *tensor,                                                   Classification *cls) {  HB_SYS_flushMemCache(&(tensor->data), HB_SYS_MEM_CACHE_INVALIDATE);  float *scores = reinterpret_cast<float *>(tensor->data.virAddr);  //float score = 0;  float score = -1061109568;//将score=0修改为无穷小,可以兼容  int id = 0;  int *shape = tensor->data_shape.d;  for (auto i = 0; i < shape[1] * shape[2] * shape[3]; i++) {    if (scores[i] > score) {      score = scores[i];      id = i;    }  }  cls->id = id;  cls->score = score;  cls->class_name = GetClsName(id);}修改完成后,重新编译修改后的结果

已解决