0 數據
說明:忽略數據的合理性,本數據爲測試代碼使用的。
1 data_process.py
import tensorflow as tf
import numpy as np
import os
import cv2
def read_imgs_to_arr(imgs_path):
imgs = []
for img_path in imgs_path:
img = cv2.imread(img_path)
imgs.append(np.array(img) / 255.0)
return imgs
def get_ImgsAndLabel(data_path):
imgs_name = []
labels_name = []
for label_name in os.listdir(data_path):
for img_name in os.listdir(data_path + label_name):
if os.path.isfile(data_path + label_name + '/' + img_name):
imgs_name.append(data_path + label_name + '/' + img_name)