Przeglądaj źródła

删除无关测试代码,添加相关代码注释

liyan 1 rok temu
rodzic
commit
87cf47c76d
2 zmienionych plików z 7 dodań i 21 usunięć
  1. 0 20
      tests/test_dataset_process.py
  2. 7 1
      tests/test_gen_qrcodes.py

+ 0 - 20
tests/test_dataset_process.py

@@ -1,20 +0,0 @@
-import logging
-
-from watermark_generate.tools.dataset_process import dataset_embed_label, process_dataset_label
-from watermark_generate.tools.logger_tool import handler
-from watermark_generate.tools.picture_watermark import extract
-
-if __name__ == '__main__':
-    handler.setLevel(logging.DEBUG)
-    # 图片嵌入密码标签
-    label = '012ABCDEF'
-    src_img_path = '../VOC2007/test/'
-    dst_img_path = '../VOC2007/test_wm'
-    dataset_embed_label(label, src_img_path, dst_img_path)
-
-    label_path = '../VOC2007/test_labels'
-    # 数据集处理测试
-    process_dataset_label(dst_img_path, label_path, percentage=5)
-
-    secret = extract('../VOC2007/test_wm/000044.jpg', secret_len=len(label))
-    print(label == secret)

+ 7 - 1
tests/test_gen_qrcodes.py

@@ -31,12 +31,18 @@ def test_embed_label_to_image():
     embed_label_to_image(secret=secret,img_path='./dataset/test.jpg')
 
 if __name__ == '__main__':
-    # test_embed_label_to_image()
+    # test_embed_label_to_image()  # 测试单张图片嵌入密码标签二维码
     src_img_path='./dataset/VOC2007/JPEGImages/'
     label_path='./dataset/VOC2007/labels/'
     dst_img_path='./dataset/VOC2007_QR/JPEGImages'
+
+    # 测试密码标签生成
     secret = get_secret(512)
+
+    # 测试密码标签二维码生成
     test_gen_qrcodes(secret)
+
+    # 测试数据集处理
     process_dataset_label(watermarking_dir=watermark_gen_dir, src_img_path=src_img_path, label_path=label_path,dst_img_path=dst_img_path)