version: python 3.7.7 OS: macOS Catalina 10.15.3 tensorflow: 2.2.0-rc1
Verwenden Sie die Python3-Serie.
Verwenden Sie für die Python-Version pyenv usw. und installieren Sie die neueste. (Siehe andere Artikel für pyenv.)
Pip installieren und aktualisieren.
sudo easy_install pip
sudo easy_install --upgrade six
sudo pip install --upgrade pip
Installieren Sie die erforderlichen Bibliotheken.
pip install Cython
pip install contextlib2
pip install pillow
pip install lxml
pip install jupyter
pip install matplotlib
Installieren Sie TensorFlow.
pip install tensorflow
//Versionsbestätigung
python -c 'import tensorflow as tf; print(tf.__version__)'
2.2.0-rc1
Installieren Sie protobuf.
brew install protobuf
Klonen Sie das TensorFlow-Modell. (Erstellen Sie ein Tensorflow-Verzeichnis.)
cd tensorflow
git clone https://github.com/tensorflow/models.git
Es wird auf dem Jupyter-Notebook ausgeführt.
cd ~/tensorflow/models/research/object_detection/
Jupyter notebook
Das Verzeichnis wird im Browser angezeigt. Klicken Sie auf "object_detection_tutorial.ipynb", um das Notizbuch zu öffnen.
Wählen Sie im Notizbuch "Alle ausführen" aus "Zelle".
Elemente wie Personen werden erkannt.
PATH_TO_TEST_IMAGES_DIR = pathlib.Path('models/research/object_detection/test_images')
Das zu analysierende Bild wird im obigen Verzeichnis gespeichert. Bitte ändern Sie die Datei und analysieren Sie Ihr Lieblingsbild.
Recommended Posts