安装命令与版本配置
pip install tensorflow==1.15 # CPU
pip install tensorflow-gpu==1.15 # GPU
更多相关库的安装
pip install opencv-python
pip install scikit-learn
pip install tqdm
pip install matplotlib
pip3 install h5py==2.10 -i https://pypi.tuna.tsinghua.edu.cn/simple/ # https://blog.csdn.net/qq_45425315/article/details/109802714
使用时报错处理
numpy对应问题
如果报错 NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy array.
numpy版本太高,换低版本的(也可尝试安装高版本的tensorflow==1.15)
pip install numpy==1.18.0 -i https://mirrors.aliyun.com/pypi/simple/
版本对应关系
需要3.7及以下版本的python才行(3.5可以适用于大部分):
加载模型报错
calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
tensorflow1.15 加载model出现AttributeError: ‘str’ object has no attribute ‘decode’
pip install h5py==2.10.0
参考与更多
windows安装:https://www.lfd.uci.edu/~gohlke/pythonlibs/#tensorflow