Browse Source

增加日志输出

zhy 1 day ago
parent
commit
1c390d3d2b

+ 4 - 2
watermark_verify/process/classification_tensorflow_blackbox_process.py

@@ -53,14 +53,16 @@ class ModelWatermarkProcessor(BlackBoxWatermarkProcessDefine):
             for j, image_file in enumerate(batch_files):
                 predicted_class = np.argmax(outputs[0][j])  # 假设输出是每类的概率
                 total_predictions += 1
-
+                print(f"predicted_class = {predicted_class}, target_class = {target_class}")
                 # 比较预测结果与目标分类
                 if predicted_class == target_class:
                     correct_predictions += 1
 
             # 计算准确率
             accuracy = correct_predictions / total_predictions if total_predictions > 0 else 0
-            # logger.debug(f"Predicted batch {i // batch_size + 1}, Accuracy: {accuracy * 100:.2f}%")
+            logger.debug(f"准确率: {accuracy * 100:.2f}%")
+            logger.info(f"共验证:{total_predictions}张")
+            logger.info(f"成功:{correct_predictions}张")
             if accuracy >= threshold:
                 logger.info(f"Predicted batch {i // batch_size + 1}, Accuracy: {accuracy} >= threshold {threshold}")
                 return True