diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c07333 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11 diff --git a/Read_and_process_image/ReadAndProcess.py b/Read_and_process_image/ReadAndProcess.py deleted file mode 100644 index 02ce968..0000000 --- a/Read_and_process_image/ReadAndProcess.py +++ /dev/null @@ -1,74 +0,0 @@ -import cv2 -import numpy as np -import torch - -class Read_image_and_Process_image: - def __init__(self, Image_Size) -> None: - self.Image_Size = Image_Size - pass - def get_data(self, path): - '''讀檔''' - try: - img_arr = cv2.imread(path, cv2.IMREAD_COLOR) # 讀檔(彩色) - # img_arr = cv2.imread(path, cv2.IMREAD_GRAYSCALE) # 讀檔(灰階) - resized_arr = cv2.resize(img_arr, (self.Image_Size, self.Image_Size)) # 濤整圖片大小 - except Exception as e: - print(e) - - return resized_arr - - def Data_Augmentation_Image(self, path): - resized_arr = [] - - for p in path: - try: - img_arr = cv2.imread(p, cv2.IMREAD_COLOR) # 讀檔(彩色) - # img_arr = cv2.imread(path, cv2.IMREAD_GRAYSCALE) # 讀檔(灰階) - resized_arr.append(cv2.resize(img_arr, (self.Image_Size, self.Image_Size))) # 調整圖片大小 - except Exception as e: - print(e) - - return np.array(resized_arr) - - def image_data_processing(self, data, label): - '''讀檔後處理圖片''' - data = np.asarray(data).astype(np.float32) # 將圖list轉成np.array - data = data.reshape(-1, self.Image_Size, self.Image_Size, 3) # 更改陣列形狀 - label = np.array(label) # 將label從list型態轉成 numpy array - return data, label - - def normalization(self, images): - imgs = [] - for img in images: - img = np.asarray(img).astype(np.float32) # 將圖list轉成np.array - img = img / 255 # 標準化影像資料 - imgs.append(img) - - return torch.as_tensor(imgs) - - # def load_numpy_data(self, file_names): - # '''載入numpy圖檔,並執行影像處理提高特徵擷取''' - # i = 0 - # numpy_image = [] - # original_image = [] - # for file_name in file_names: - # compare = str(file_name).split(".") - # if compare[-1] == "npy": - # image = np.load(file_name) # 讀圖片檔 - # numpy_image.append(image) # 合併成一個陣列 - # else: - # original_image.append(file_name) - - # original_image = self.get_data(original_image) - - # for file in original_image: - # numpy_image.append(file) - - # return numpy_image - - def make_label_list(self, length, content): - '''製作label的列表''' - label_list = [] - for i in range(length): - label_list.append(content) - return label_list \ No newline at end of file diff --git a/Read_and_process_image/__init__.py b/Read_and_process_image/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc b/Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc deleted file mode 100644 index 2969226..0000000 Binary files a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-310.pyc and /dev/null differ diff --git a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-311.pyc b/Read_and_process_image/__pycache__/ReadAndProcess.cpython-311.pyc deleted file mode 100644 index 9c2f924..0000000 Binary files a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-311.pyc and /dev/null differ diff --git a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-39.pyc b/Read_and_process_image/__pycache__/ReadAndProcess.cpython-39.pyc deleted file mode 100644 index 083de5a..0000000 Binary files a/Read_and_process_image/__pycache__/ReadAndProcess.cpython-39.pyc and /dev/null differ diff --git a/Read_and_process_image/__pycache__/__init__.cpython-310.pyc b/Read_and_process_image/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 47c799c..0000000 Binary files a/Read_and_process_image/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/Read_and_process_image/__pycache__/__init__.cpython-311.pyc b/Read_and_process_image/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index ad3439c..0000000 Binary files a/Read_and_process_image/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/Read_and_process_image/__pycache__/__init__.cpython-39.pyc b/Read_and_process_image/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 660ec1c..0000000 Binary files a/Read_and_process_image/__pycache__/__init__.cpython-39.pyc and /dev/null differ