From dcc22886f33a45f6b77a38960bc07e633a5b3c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9B=85=E9=9B=AF?= <2509165021@student.example.com> Date: Thu, 16 Apr 2026 15:34:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.py | 11 +++++++++++ test2.py | 8 ++++++++ test3.py | 12 ++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 test.py create mode 100644 test2.py create mode 100644 test3.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..e5a86d1 --- /dev/null +++ b/test.py @@ -0,0 +1,11 @@ +import numpy as np + +image = np.array([ + [100, 150, 200], + [80, 120, 180], + [60, 90, 140] +], dtype=np.uint8) + +print("原图:") +print(image) + diff --git a/test2.py b/test2.py new file mode 100644 index 0000000..1e01a96 --- /dev/null +++ b/test2.py @@ -0,0 +1,8 @@ +import numpy as np + +img = np.array([ + [255, 255, 0, 0 ], + [255, 255, 0, 0 ], + [0, 0, 255, 255], + [0, 0, 255, 255] +], dtype=np.uint8) diff --git a/test3.py b/test3.py new file mode 100644 index 0000000..029dd02 --- /dev/null +++ b/test3.py @@ -0,0 +1,12 @@ +import numpy as np + +# 假设这是从图像中提取的2个特征图 +feature_map1 = np.array([[1, 0, 1], [0, 1, 0], [1, 0, 1]]) +feature_map2 = np.array([[1, 1, 1], [1, 0, 0], [1, 0, 0]]) + +# 补全代码:将特征图展平为向量 +vector1 = feature_map1.flatten() # 展平 +vector2 = feature_map2.flatten() # 展平 + +print("vector1:", vector1) +print("vector2:", vector2) \ No newline at end of file