[PYTHON] Image analysis with Object Detection API to try in 1 hour

version: python 3.7.7 OS: macOS Catalina 10.15.3 tensorflow: 2.2.0-rc1

Environment

Use python3 series.

For the python version, use pyenv etc. and install the latest version. (See other articles for pyenv.)

Install and upgrade pip.

sudo easy_install pip

sudo easy_install --upgrade six

sudo pip install --upgrade pip

Install the required libraries.

pip install  Cython
pip install  contextlib2
pip install  pillow
pip install  lxml
pip install  jupyter
pip install  matplotlib

Install TensorFlow.

pip install tensorflow

//version confirmation
python -c 'import tensorflow as tf; print(tf.__version__)'
2.2.0-rc1

Install protobuf.

brew install protobuf

Clone the model of TensorFlow. (Create a tensorflow directory.)

cd tensorflow
git clone https://github.com/tensorflow/models.git

Execution of detection api

Perform on Jupyter notebook.

cd ~/tensorflow/models/research/object_detection/
Jupyter notebook

スクリーンショット 2020-03-20 20.47.13.png

The directory will be displayed on your browser. Click ʻobject_detection_tutorial.ipynb` to open the notebook.

Select Run All from the notebook Cell.

スクリーンショット 2020-03-20 20.48.02.png

Elements such as people are detected.

ダウンロード (2).png

PATH_TO_TEST_IMAGES_DIR = pathlib.Path('models/research/object_detection/test_images')

The image to be analyzed is saved in the above directory. Please change the file and analyze your favorite image.

ダウンロード (1).png

Recommended Posts

Image analysis with Object Detection API to try in 1 hour
Try logging in to qiita with Python
Try Object detection with Raspberry Pi 4 + Coral
Try to generate an image with aliasing
Cooking object detection with yolo + image classification
Try to detect an object with Raspberry Pi ~ Part 1: Comparison of detection speed ~
[First API] Try to get Qiita articles with Python
Try to make RESTful API with MVC using Flask 1.0.2
Convert the image in .zip to PDF with Python
Image download with Flickr API
Try edge detection with OpenCV
Tweet with image in Python
Try HeloWorld in your own language (with How to & code)
[Cloudian # 6] Try deleting the object stored in the bucket with Python (boto3)
[Cloudian # 9] Try to display the metadata of the object in Python (boto3)
Until you try the Google Cloud Vision API (harmful image detection)
[Cloudian # 2] Try to display the object storage bucket in Python (boto3)
I tried to process the image in "sketch style" with OpenCV
I tried to process the image in "pencil style" with OpenCV
Image upload & download to Azure Storage. With Python + requests + REST API
Two ways to display multiple graphs in one image with matplotlib
Try to create a Qiita article with REST API [Environmental preparation]
Try to operate Facebook with Python
Try to profile with ONNX Runtime
Try to calculate Trace in Python
Try to put data in MongoDB
A light introduction to object detection
Cython to try in the shortest
Try blurring the image with opencv2
Convert PDF to image with ImageMagick
Try to output audio with M5STACK
GraphQL API with graphene_django in Django
Introduction to image analysis opencv python
[Cloudian # 3] Try to create a new object storage bucket with Python (boto3)
How to make a model for object detection using YOLO in 3 hours
Put DeepStream SDK Python Binding in Jetson Nano and try object detection
Try to image the elevation data of the Geographical Survey Institute with Python
[Cloudian # 1] Try to access object storage with AWS SDK for Python (boto3)
POST photos with Microsoft Bing Image Search API to get Image Insights (Python)
[Cloudian # 5] Try to list the objects stored in the bucket with Python (boto3)
Try to extract specific data from JSON format data in object storage Cloudian/S3
Try to separate the background and moving object of the video with OpenCV
Calculation of mean IoU in object detection
Try to reproduce color film with Python
Try using the Wunderlist API in Python
HTML email with image to send with python
Image classification with Keras-From preprocessing to classification test-
Try using the Kraken API in Python
Try working with binary data in Python
Try to reproduce NumPy's add.at in Julia
How to work with BigQuery in Python
Try using Dropbox API v2 with Go
Send data to DRF API with Vue.js
Try converting to tidy data with pandas
Quickly try to visualize datasets with pandas
Quickly try Microsoft's Face API in Python
How to adjust image contrast in Python
Easily try automatic image generation with DCGAN-tensorflow
Easy image processing in Python with Pillow
First YDK to try with Cisco IOS-XE
Network Analysis with NetworkX --- Community Detection Volume