已經學習了一段時間的訓練資料才發現正確答案應該往上偏移 2px, 這個應該 infer 結果再 offset 回來就好了, 我試著把 offset 的資料拿去訓練了一個晚上.
訓練結果慘烈, 會有白色細小線條.

程式碼:
https://github.com/max32002/zi2zi-pytorch
出問題的 script
rd /q/s C:\Max\Documents\zi2zi-pytorch\source\paired_images-maruko-bold-384-jp
python font2img.py --src_font=source/font/SweiGothicCJKjp-Bold.ttf ^
--dst_font=source/font/ZenMaruGothic-Bold.ttf ^
--charset=charset/charset_maruko_train_match_noto_bold.txt ^
--sample_dir=source/paired_images-maruko-bold-384-jp ^
--shuffle ^
--canvas_size=384 ^
--char_size=384 ^
--dst_y_offset=-111 ^
--disable_auto_fit ^
--mode=font2font
應該要使用 -109 offset, but 不小心讓已訓練的模型在 -111
解法:
https://github.com/max32002/zi2zi-pytorch/commit/ff8bf15893eab1c22118c9ab61fbce00b38a7a04
if output_x_offset != 0 or output_y_offset != 0:
h, w = processed_image.shape[:2]
M = np.float32([[1, 0, output_x_offset], [0, 1, output_y_offset]])
processed_image = cv2.warpAffine(processed_image, M, (w, h),
borderMode=cv2.BORDER_CONSTANT, borderValue=255)