[PYTHON] Image recognition with API from zero knowledge using AutoML Vision

Image recognition using the cloud can be done normally if you follow the preceding article, so you may not write much

I'll write an article I did in Edge instead

About the author

I have touched C, C ++, JAVA, python, chainer, etc. Totally ignorant about Raspberry Pi, GCP, API Since I usually use windows, I start by building an Ubuntu environment

environment

Ubuntu 18.04.2 LTS (Nopa) Raspbian(Raspberry Pi 3 Model B+) Coral accelerator EDGE TPU

things to do

Image recognition of garbage through the cloud using API of GCP and AutoML Vision @Ubuntu Image recognition of local garbage with Raspberry Pi using Edge function of AutoML Vision @Rasbian Construction of a garbage sorting system including hardware (I will not post anything other than image recognition to Qiita) (like an automatic sorting trash can)

What i did

Build an environment where you can run AutoML from a terminal using gcloud Model learning, etc. (If you connect GCP, you can do it with a mouse) Run AutoML from python Real-time execution of AutoML on Ubuntu + USB camera Create and execute an image data collection program with Ubuntu + USB camera Raspberry Pi + USB camera to create and execute an image data collection program

Reference (copy and paste source)

Please forgive me for having a lot of copies as it is almost my own memorandum Install pyenv and pyenv-virtualenv

imwrite https://note.nkmk.me/python-opencv-imread-imwrite/

AutoML API https://qiita.com/pyru89kwmr/items/c723bb4456443bcaafa2

Make Raspberry Pi a jupyter server http://irukanobox.blogspot.com/2018/02/raspberry-pijupyter-notebook.html https://qiita.com/shimaken/items/b411de87b00c051e6697

Turn on SSH for Raspberry Pi https://s2jp.com/2014/01/raspberry-pi-ssh/

SSH connection to Raspberry Pi on windows10 https://www.onebizlife.com/windows10-ssh-client-1980

memo install opencv I tried other than this, but I got an error version 3.1.0 at anaconda

$ conda install -c https://conda.binstar.org/menpo opencv3

An error will occur if the time is off https://qiita.com/yuji38kwmt/items/b3fe316f6c000235aab5

The initial password for Raspberry Pi is raspberry Raspberry Pi SSH valid command

sudo raspi-config

From

I get an error with wget

ERROR: The certificate of ‘dl.google.com’ is not trusted.

https://blog.dreamhive.co.jp/mkoba/?p=5741

autoML on edge https://www.apps-gcp.com/automl-vision-edge/ r

Install pyenv

It seems that the google cloud module required for AutoML only works on python2 series, so first insert pyenv It ’s more accurate to look here Install pyenv and pyenv-virtualenv

Install pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\n

source ~/.profile

like this

pyenv install 3.6.3

Even if you do, an error will occur.

sudo groupadd developer
sudo gpasswd --add USERNAME developer
sudo visudo
Defaults exempt_group="developer"

python installation

pyenv install 3.6.3

Also install pyenv-virtualenv

//github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
source ~/.profile
pyenv virtualenv 3.6.3 myenv

I will check it

pyenv versions
* system (set by /home/user/.pyenv/version)
  3.6.3
  3.6.3/envs/myenv
  myenv

If python -V still doesn't change, I could use this command

eval "$(pyenv init -)"

https://akamist.com/blog/archives/2610

Try the AutoML Vison API

I was able to go straight to this street https://qiita.com/pyru89kwmr/items/c723bb4456443bcaafa2

Recommended Posts

Image recognition with API from zero knowledge using AutoML Vision
Image recognition of garbage with Edge (Raspberry Pi) from zero knowledge using AutoML Vsion and TPU
Category estimation using docomo's image recognition API
Recent Ability of Image Recognition-MS State-of-the-art Research Results Using Computer Vision API with Python
Image download with Flickr API
Age recognition using Pepper's API
Image recognition with Keras + OpenCV
Trial of voice recognition using Azure with Python (input from microphone)
[Python] Using OpenCV with Python (Image Filtering)
Using Rstan from Python with PypeR
[Python] Using OpenCV with Python (Image transformation)
Create API using hug with mod_wsgi
Facial expression recognition using Pepper's API
Run Ansible from Python using API
Image recognition of fruits using VGG16
Detect Japanese characters from images using Google's Cloud Vision API in Python
Collecting information from Twitter with Python (Twitter API)
Python: Basics of image recognition using CNN
Streaming speech recognition with Google Cloud Speech API
Python: Application of image recognition using CNN
Image recognition model using deep learning in 2016
Using Poetry with Fish (Migration from Pipenv)
Try using Dropbox API v2 with Go
Post from another account with Twitter API
Use Google Cloud Vision API from Python
I tried using UnityCloudBuild API from Python
Image acquisition from camera with Python + OpenCV
Transcription of images with GCP's Vision API
Image recognition using CNN Horses and deer
Image collection using Google Custom Search API
Serverless face recognition API made with Python
I tried simple image recognition with Jupyter
Play with puns using the COTOHA API
Automatic follow-back using streaming api with Tweepy
Region extraction method using cellular automaton Try region extraction from the image with growcut (Python)
Character recognition from images! Explaining logic with 100% accuracy using PES as a theme
I tried to make a simple image recognition API with Fast API and Tensorflow