Cov txheej txheem:
- Kauj ruam 1: Tau txais Google API Account
- Kauj Ruam 2: Sau Cov Ntaub Ntawv
- Kauj Ruam 3: Qhib API Lub Tsev Qiv Ntawv
- Kauj Ruam 4: Tshawb rau Google Vision API
- Kauj ruam 5: Nkag mus rau Daim Ntawv Pov Thawj
- Kauj Ruam 6: Tsim Google Vision API Key
- Kauj Ruam 7: Raspberry Pi Sab Teeb
- Kauj Ruam 8: Teeb tsa Txoj Haujlwm
- Kauj ruam 9:
- Kauj ruam 10:
- Kauj Ruam 11: Thiab Ntau Ntxiv …
Video: Google Vision API Siv Raspberry Pi thiab Node: 11 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Nov yog qhov pib qhia rau siv Google Vision API. Nws siv cov hauv qab no
- Raspberry Pi Zero W.
- Arch Linux
- NodeJS
- Kev sib txuas hauv Is Taws Nem
Tsis paub Arch Linux? Los yog yuav teeb tsa Raspberry Pi li cas? Tsis muaj kev txhawj xeeb, Kuv tau sau kab lus ntawm kab lus uas npog nws sai sai. Nws yooj yim dua rau teeb tsa dua li koj xav. Yog li tsis txhob cia nws tawm tsam koj.
- Txhim kho Arch Linux ntawm Raspberry Pi nrog Kev Nkag Mus Siv WiFi sai
- Teeb i2c ntawm Raspberry Pi Zero W siv Arch Linux
- Teeb NodeJS Project Chaw ntawm Raspberry Pi Zero W.
- Porting DRV8830 I2C Tsav Tsheb Tsav Tsheb Code rau NodeJS
- Hloov kho Raspberry Pi Code Nyob deb ntawm Visual Studio Code
- 1B1 Neeg Hlau
Npog Cov Duab los ntawm Andy Kelly ntawm Unsplash
Kauj ruam 1: Tau txais Google API Account
Tu siab, Google Vision API tsis yog qhov kev pabcuam dawb kiag li. Thaum lub sijhawm sau tus as khauj API muab 1000 dawb Google Vision API hu rau ib hlis. Tom qab ntawd, nws yog $ 1.00 rau txhua 1000 hu.
Kuv paub, kuv paub, tsis phem heev. Tab sis qhov no tsis yog kev lag luam. Kuv xav siv nws rau qhov ua kom lub tsev me me bot. Yog tias kuv tus poj niam tau txais daim nqi rau $ 40 vim tias kuv txiav txim siab tso cov duab rau API, zoo, nws yuav yog tus neeg tuag. Xijpeem, Kuv xav tias kuv tseem yuav tshawb nrhiav qhov kev pabcuam rau poo-thiab-giggles.
Kom tau txais tus as khauj mus ntsib
Google Console
Thiab kos npe-nkag nrog tus lej Google uas twb muaj lawm lossis tsim ib qho.
Kauj Ruam 2: Sau Cov Ntaub Ntawv
Tam sim no, ntawm no yog qhov txaus ntshai, koj yuav tsum nkag mus rau koj cov ntaub ntawv them nqi ua ntej yuav mus. Nco ntsoov, koj yuav raug them yog tias koj mus dhau 1000 hu. Ib zaug ntxiv, yog tias koj tshaj koj li 1,000 qhov kev hu dawb koj yuav raug them. (Dab tsi? Kuv tau hais tias twb tau lawm? Auj.)
Kauj Ruam 3: Qhib API Lub Tsev Qiv Ntawv
Tom qab teeb tsa cov ntaub ntawv them nqi peb tseem xav tau los ua kom Cloud Vision API. Qhov no yog kev nyab xeeb, qhov tseem ceeb, txhua tus Google APIs tau xiam los ntawm lub neej ntawd yog tias ib tus neeg yuam kev tau txais kev nkag mus lawv tsis tso lub ntuj raug txim nyob txhua qhov chaw.
Kauj Ruam 4: Tshawb rau Google Vision API
Tam sim no tshawb rau Vision thiab nyem lub pob. Ntawm no yuav tsum muaj lub ntsej muag Enable khawm. Nias nws.
Kauj ruam 5: Nkag mus rau Daim Ntawv Pov Thawj
Qhov kawg peb yuav tsum tau ua yog tau txais tus lej API. Qhov no yuav tsum tau suav nrog hauv API hu lub taub hau rau kev txheeb xyuas qhov tseeb.
Tsis txhob cia leej twg tau txais koj tus lej API. Thiab tsis txhob nyuaj nws hauv koj cov cai. Ntseeg kuv, qhov no yuav tom koj. Yog tias qhov xwm txheej no raug thawb mus rau hauv lub vev xaib, lub web crawler yuav pom nws sai thiab koj yuav tau them nyiaj ntau daus las.
Cia tsab xov xwm no ua rau koj ntshai me ntsis.
Tus tsim tawm Muab AWS Keys rau Github
Ok! Cia peb mus txais koj tus lej API. Nrhiav ntu Cov Ntawv Pov Thawj
Kauj Ruam 6: Tsim Google Vision API Key
Tej zaum koj yuav tsis pom ib daim ntawv pov thawj tsim, raws li koj tej zaum tseem tsis tau tsim ib qho twg.
Cia peb tsim tus lej API tshiab. Kuv yuav lub npe qhov tseem ceeb muaj txiaj ntsig thiab txwv nws tsuas yog Google Cloud API. Mus tom ntej thiab luam koj tus lej API, vim peb yuav xav tau nws hauv cov kauj ruam tom ntej.
Kauj Ruam 7: Raspberry Pi Sab Teeb
Cov kab lus teev nyob rau sab saum toj ntawm qhov no yuav pab koj teeb tsa Raspberry Pi rau theem no. Tab sis yog tias koj ua qee yam sib txawv, feem ntau ntawm qhov no tseem yuav ua haujlwm rau koj. Txawm li cas los xij, thaum peb mus rau ib feem ntawm kev hloov pauv ib puag ncig, qhov ntawd yuav txawv rau lwm qhov Linux tsw.
Pib los ntawm SSH'ing rau hauv koj tus Pi.
Thiab hloov kho txhua pob
sudo pacman -Syu
Peb tab tom yuav tsim ib puag ncig sib txawv rau Google Cloud Vision API. Qhov no yog kom tsis txhob nyuaj rau koj tus lej API tus lej nkag mus rau cov cai ntxiv. Qhov ntawd yuav ua haujlwm, tab sis kuv pom zoo kom koj lo nrog kuv thiab teeb tsa tus tswj hwm ib puag ncig ib puag ncig los tswj hwm API.
Hloov mus rau tus neeg siv hauv paus los ntawm kev ntaus ntawv
su
Sau koj tus password.
Qhov tom ntej peb ua yog ntxiv koj li Google Vision API Key raws li ib puag ncig sib txawv rau
/thiab/profile
cov ntaub ntawv, qhov no yuav tsum ua rau nws raug intialized ntawm khau raj.
Hom, hloov
KOJ_API_KEY
nrog koj tus lej API tseeb.
ncha 'export GOOGLE_CLOUD_VISION_API_KEY = YOUR_API_KEY' >> /etc /profile
Tam sim no reboot Pi yog li ntawd siv tau.
sudo rov pib dua
Nkag mus rau hauv. Cia saib kom paub tseeb tias nws tau rub tus lej API.
ncha $ GOOGLE_CLOUD_VISION_API_KEY
Yog tias koj tus lej API tau rov qab rov qab, koj yuav tsum zoo mus.
Kauj Ruam 8: Teeb tsa Txoj Haujlwm
Cia peb tsim cov phiaj xwm phiaj xwm.
mkdir google-vis
cd google-mus
Tam sim no cia pib ua qhov project Node tshiab.
npm pib
Xav tias dawb los kho cov ntsiab lus pob yog tias koj nyiam. Yog tias koj tub nkeeg li kuv, ntaus nkag mus kom txog thaum koj rov qab mus rau qhov hais kom sai.
Cia peb ntxiv qhov xav tau ntawm cov tsev qiv ntawv. Nws yog ib tug. Lub tsev qiv ntawv axios, uas ua rau async web thov.
npm os
Tsis tas li, cia peb tsim cov peev txheej npe thiab rub tawm peb cov duab ntsuas zoo nkauj. Ah, nco Hepburn!
Xyuas kom tseeb tias koj nyob hauv
google-vis/cov peev txheej
project npe thaum rub tawm cov duab.
mkdir cov peev txheej
cov peev txheej cd wget
Kauj ruam 9:
Tsim ib daim ntawv hauv
mus-vis
npe hu ua
app.js ua
nano app.js
Tom qab ntawv muab tshuaj txhuam rau hauv kab ntawv hauv qab no thiab khaws cov ntaub ntawv los ntawm kev ntaus CTRL+O thiab tawm mus siv CTRL+X.
//
const const axios = xav tau ('axios'); const fs = xav tau ('fs');
const API_KEY = txheej txheem.env. GOOGLE_CLOUD_VISION_API_KEY
yog (! API_KEY) {
console.log ('Tsis muaj tus lej API muab')}
muaj nuj nqi base64_encode (file) {
// nyeem binary cov ntaub ntawv var bitmap = fs.readFileSync (file); // hloov cov ntaub ntawv binary rau base64 encoded hlua rov tshiab Tsis (bitmap).toString ('base64'); } var base64str = base64_encode ('./ resources/audrey.jpg');
const apiCall = `https://vision.googleapis.com/v1/images:annotate?key=$ {API_KEY}`;
const reqObj = {
thov: [{"duab": {"ntsiab lus": base64str}, "nta": [{"yam": "LABEL_DETECTION", "maxResults": 5}, {"hom": "FACE_DETECTION", "maxResults": 5}, {"hom": "IMAGE_PROPERTIES", "maxResults": 5}]}]}
axios.post (apiCall, reqObj).then ((teb) => {
console.log (teb); console.log (JSON.stringify (response.data.responses, tsis tau txhais, 4)); }). ntes ((e) => {console.log (e.response);});
Txoj cai no tuav API qhov tseem ceeb ib puag ncig sib txawv thiab tsim cov haujlwm tsis tu ncua los ntawm nws.
const API_KEY = txheej txheem.env. GOOGLE_CLOUD_VISION_API_KEY
Nov yog yuav ua li cas peb zam kev hardcoding tus yuam sij API.
Kauj ruam 10:
Cia peb khiav qhov program.
ntawm app.js
Yog tias txhua yam mus tau zoo koj yuav tsum tau txais cov txiaj ntsig zoo sib xws rau hauv qab no
cov ntaub ntawv: {cov lus teb:
Kauj Ruam 11: Thiab Ntau Ntxiv …
Kab lus no luv-pib dhia. Txawm li cas los xij, muaj ntau txoj hauv kev ntawm no. Piv txwv li, xa koj cov duab siv Raspberry Pi Lub Koob Yees Duab
- raspicam
- pi-lub koob yees duab
Thov koj xav nug cov lus nug txog yuav siv cov zis li cas.
Muaj lwm qhov kev thov nrhiav kom pom.
Google Vision API - Lwm Yam
Txawm li cas los xij, Kuv yuav xaus tsab xov xwm thiab txav mus rau qhov ua rau kuv pom ntawm lub tshuab pom kev pom. Sai li kuv paub qhov stochastic gradient qhovntsej thiaj tsis mob.
Pom zoo:
Kev Ntsuas Kub thiab Vaum Siv NODE MCU THIAB BLYNK: 5 Kauj Ruam
Kev Ntsuas Kub thiab Vaum Kev Siv NODE MCU THIAB BLYNK: Nyob Zoo Cov Neeg Hauv qhov kev qhia no qhia rau peb kawm paub yuav ua li cas thiaj li tau txais qhov kub thiab txias ntawm huab cua siv DHT11-Kub thiab Qhov ntsuas huab cua siv Node MCU thiab BLYNK app
Saib Xyuas Kev Siv Sijhawm Siv Raspberry Pi thiab AIS328DQTR Siv Python: 6 Cov Kauj Ruam
Saib Xyuas Kev Siv Sijhawm Siv Raspberry Pi thiab AIS328DQTR Siv Python: Kev nrawm yog qhov kawg, Kuv xav raws li qee txoj cai ntawm Physics.- Terry Riley Tus cheetah siv qhov nrawm nrawm thiab hloov pauv sai thaum caum. Tus tsiaj nrawm tshaj plaws nyob ntawm ntug hiav txwv ib zaug hauv ib lub sijhawm siv nws qhov nrawm tshaj plaws kom ntes tau cov tsiaj txhu. Qhov
Tswj Cov Khoom Siv Hauv Tsev Siv Node MCU thiab Google Assistant - IOT - ib Blynk - Cov IFTTT: 8 Kauj Ruam
Tswj Cov Khoom Siv Hauv Tsev Siv Node MCU thiab Google Assistant | IOT | ib Blynk | Cov IFTTT: Ib txoj haujlwm yooj yim los tswj Cov Khoom Siv Google Assistant: Ceeb Toom: Kev Siv Hluav Taws Xob Hluav Taws Xob tuaj yeem ua rau phom sij. Kov nrog kev saib xyuas hnyav. Ntiav tus kws tshaj lij hluav taws xob thaum ua haujlwm nrog qhib hluav taws xob. Kuv yuav tsis lees paub lub luag haujlwm rau
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
8 Relay Tswj Nrog NodeMCU thiab IR Txais Txais Siv WiFi thiab IR Chaw Taws Teeb thiab Android App: 5 Kauj Ruam (nrog Duab)
8 Relay Tswj Nrog NodeMCU thiab IR Txais Txais Siv WiFi thiab IR Chaw Taws Teeb thiab Android App: Tswj 8 qhov hloov pauv hloov siv nodemcu thiab ir tus txais tshaj wifi thiab ir chaw taws teeb thiab hauv app.the ir tej thaj chaw deb ua haujlwm ywj pheej ntawm wifi txuas. NTUJ