Browse Source

refine seg postprocess

will-jl944 4 years ago
parent
commit
bf806f6392

+ 1 - 1
deploy/cpp/model_deploy/ppseg/src/seg_postprocess.cpp

@@ -137,7 +137,7 @@ bool SegPostprocess::RunXV2(const std::vector<DataBlob>& outputs,
                             const std::vector<ShapeInfo>& shape_infos,
                             std::vector<Result>* results, int thread_num) {
   int batch_size = shape_infos.size();
-  int label_map_size = outputs[0].shape[1] * outputs[1].shape[2];
+  int label_map_size = outputs[0].shape[1] * outputs[0].shape[2];
   std::vector<int> score_map_shape = outputs[1].shape;
   int score_map_size =
       std::accumulate(score_map_shape.begin() + 1, score_map_shape.end(), 1,

+ 1 - 6
paddlex/cv/models/segmenter.py

@@ -503,16 +503,11 @@ class BaseSegmenter(BaseModel):
         outputs = self.run(self.net, data, 'test')
         label_map_list = outputs['label_map']
         score_map_list = outputs['score_map']
-        if isinstance(img_file, list) and len(img_file) > 1:
+        if isinstance(img_file, list):
             prediction = [{
                 'label_map': l,
                 'score_map': s
             } for l, s in zip(label_map_list, score_map_list)]
-        elif isinstance(img_file, list):
-            prediction = [{
-                'label_map': label_map_list[0],
-                'score_map': score_map_list[0]
-            }]
         else:
             prediction = {
                 'label_map': label_map_list[0],