01_global_var.py
# linux
data_root_path = "data/MagneticTile" # 数据路径
test_file_path = "data/test.txt" # 测试文件路径
train_file_path = "data/train.txt" # 测试文件路径
# windows
# data_root_path = "D:\\MagneticTile" # 数据路径
# test_file_path = "data\\test.txt" # 测试文件路径
# train_file_path = "data\\train.txt" # 测试文件路径
name_dict = {"MT_Blowhole": 0, "MT_Break": 1, "MT_Crack": 2,
"MT_Fray": 3, "MT_Free": 4, "MT_Uneven":5} # 字典
02_tile_sample_enhance.py
"""
瓷砖数据增强
"""
# 图像样本预处理
import cv2
import numpy as np
import os
import random
import matplotlib.pyplot as plt
from global_var import *
from math import *
# 不切边旋转
def remote(img, angle):
h, w = img.shape[:2]
h_new = int(w * fabs(sin(radians(angle))) + h * fabs(cos(radians(angle))))
w_new = int(h * fabs(sin(radians(angle))) + w * fabs(cos(radians(angle))))
matRotation = c