Mac下安装python使用TensorFlow训练自己的模型
程序猿日常
Mac下安装python使用TensorFlow训练自己的模型
目标
https://www.tensorflow.org/lite/models/modify/model_maker/image_classification?hl=zh-cn
安装Python3.8版本
下载地址双击安装
安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
常用命令
卸载指定模块
pip3 uninstall ***模块名字
安装模块指定版本号
pip3 install --ignore-installed ***模块名字==版本号
安装模块 tflite-model-maker
pip3 install tflite-model-maker
安装brew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
libusb-1.0.0.dylib (no such file) 安装libusb
brew install libusb
ImportError: cannot import name ‘array_record_module’ from ‘array_record.python’
git clone https://github.com/tensorflow/datasets /tmp/datasets
python3 -m pip install -e /tmp/datasets
运行 引用的模块正常
import os
import numpy as np
import tensorflow as tf
assert tf.__version__.startswith('2')
from tflite_model_maker import model_spec
from tflite_model_maker import image_classifier
from tflite_model_maker.config import ExportFormat
from tflite_model_maker.config import QuantizationConfig
from tflite_model_maker.image_classifier import DataLoader
import matplotlib.pyplot as plt
tf.keras.utils.get_file 加载网络数据集
image_path = tf.keras.utils.get_file(
'flower_photos.tgz',
'https://storage.谷歌apis.com/download.tensorflow.org/example_images/flower_photos.tgz',
extract=True)
image_path = os.path.join(os.path.dirname(image_path), 'flower_photos')
tf.keras.utils.get_file 加载本地数据集
file:/// 三个/从本地获取
image_path = tf.keras.utils.get_file(
'flower_photos.tgz',
'file:///Users/lang/Desktop/python/flower_photos.zip',
extract=True)
image_path = os.path.join(os.path.dirname(image_path), 'flower_photos')
数据集下载到默认缓存目录 ~/.keras
image_classifier.create 会报错 ssl证书验证失败
import ssl #全局取消证书验证
ssl._create_default_https_context = ssl._create_unverified_context #全局取消证书验证
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhgjhcca
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
怎样阻止微信小程序自动打开
PHP中文网 06-13