python3.8搭建Keras +TensorFlow环境

# pip install numpy==1.20 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
# Keras 2.3.1  TensorFlow2.4.1  numpy>=1.20  protobuf==3.20.1  python3.8

import tensorflow as tf
# pip install numpy==1.20 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
# Keras 2.3.1  TensorFlow2.4.1  numpy>=1.20  protobuf==3.20.1  python3.8
from tensorflow import keras
from tensorflow.keras import layers,models
import pathlib
import keras
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL

print(keras.__version__)
print(tf.__version__)
data_dir = "flower_photos"
data_dir = pathlib.Path(data_dir)

image_count = len(list(data_dir.glob('*/*.jpg')))

print("图片总数为:",image_count)

roses = list(data_dir.glob('roses/*'))
im=PIL.Image.open(str(roses[0]))
im.sho

猜你喜欢

转载自blog.csdn.net/qq_38735017/article/details/131748949