赞
踩
Mac下安装python使用TensorFlow训练自己的模型
https://www.tensorflow.org/lite/models/modify/model_maker/image_classification?hl=zh-cn
下载地址双击安装
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
卸载指定模块
pip3 uninstall ***模块名字
安装模块指定版本号
pip3 install --ignore-installed ***模块名字==版本号
pip3 install tflite-model-maker
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
brew install libusb
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
image_path = tf.keras.utils.get_file(
'flower_photos.tgz',
'https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz',
extract=True)
image_path = os.path.join(os.path.dirname(image_path), 'flower_photos')
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')
image_classifier.create 会报错 ssl证书验证失败
import ssl #全局取消证书验证
ssl._create_default_https_context = ssl._create_unverified_context #全局取消证书验证
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。