import tensorflow as tf
import cv2 as cv
image_add_list=[]
image_label_list=[]
with open("train_list.csv") as fid:
for image in fid.readlines():
image_add_list.append(image.strip().split(",")[0])
image_label_list.append(image.strip().split(",")[1])
#用tensor来存储img
def get_image(path):
return tf.image.convert_image_dtype(tf.image.decode_jpeg(tf.read_file(path),channels=1),dtype=tf.float32)
with tf.Session() as sess:
img=get_image('jpg/image_0000.jpg')
cv2img=sess.run(img)
img2=cv.resize(cv2img,(200,200))
cv.imshow('image',cv2img)
cv.waitKey()
import cv2 as cv
image_add_list=[]
image_label_list=[]
with open("train_list.csv") as fid:
for image in fid.readlines():
image_add_list.append(image.strip().split(",")[0])
image_label_list.append(image.strip().split(",")[1])
#用tensor来存储img
def get_image(path):
return tf.image.convert_image_dtype(tf.image.decode_jpeg(tf.read_file(path),channels=1),dtype=tf.float32)
with tf.Session() as sess:
img=get_image('jpg/image_0000.jpg')
cv2img=sess.run(img)
img2=cv.resize(cv2img,(200,200))
cv.imshow('image',cv2img)
cv.waitKey()