chenge to english version

This commit is contained in:
Jiao77
2025-07-22 23:43:35 +08:00
parent 4f81daad3c
commit 9cbfc34436
8 changed files with 166 additions and 166 deletions

View File

@@ -3,12 +3,12 @@ from .transforms import SobelTransform
def get_transform():
"""
获取统一的图像预处理管道。
确保训练、评估和推理使用完全相同的预处理。
Get unified image preprocessing pipeline.
Ensure training, evaluation, and inference use exactly the same preprocessing.
"""
return transforms.Compose([
SobelTransform(), # 应用 Sobel 边缘检测
SobelTransform(), # Apply Sobel edge detection
transforms.ToTensor(),
transforms.Lambda(lambda x: x.repeat(3, 1, 1)), # 适配 VGG 的三通道输入
transforms.Lambda(lambda x: x.repeat(3, 1, 1)), # Adapt to VGG's three-channel input
transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
])

View File

@@ -5,13 +5,13 @@ from PIL import Image
class SobelTransform:
def __call__(self, image):
"""
应用 Sobel 边缘检测,增强 IC 版图的几何边界。
Apply Sobel edge detection to enhance geometric boundaries of IC layouts.
参数:
image (PIL.Image): 输入图像(灰度图)。
Args:
image (PIL.Image): Input image (grayscale).
返回:
PIL.Image: 边缘增强后的图像。
Returns:
PIL.Image: Edge-enhanced image.
"""
img_np = np.array(image)
sobelx = cv2.Sobel(img_np, cv2.CV_64F, 1, 0, ksize=3)