Selaa lähdekoodia

修改模型解析标签位置与置信度位置错误问提

zhy 2 viikkoa sitten
vanhempi
commit
63baea8e16

+ 2 - 3
watermark_verify/process/faster_rcnn_pytorch_blackbox_process.py

@@ -66,7 +66,6 @@ class ModelWatermarkProcessor(BlackBoxWatermarkProcessDefine):
             return False
         # 使用onnx进行推理
         results = FasterRCNNInference(self.model_filename).predict(image_path)
-
         # 检测模型是否存在黑盒水印
         if results is not None:
             detect_result = detect_watermark(results, watermark_box)
@@ -100,8 +99,8 @@ def detect_watermark(results, watermark_box, threshold=0.5):
     # 解析输出结果
     if len(results[0]) == 0:
         return False
-    top_label = np.array(results[0][:, 4], dtype='int32')
-    top_conf = results[0][:, 5]
+    top_label = np.array(results[0][:, 5], dtype='int32')
+    top_conf = results[0][:, 4]
     top_boxes = results[0][:, :4]
     for box, score, cls in zip(top_boxes, top_conf, top_label):
         wm_box_coords = watermark_box[:4]