Mudanças entre as edições de "Oficina de Computacao Cognitiva/Visual Recognition IBM Watson"

De LHC
Ir para navegação Ir para pesquisar
(Criou página com ' '''Para reconhecimento de imagem:''' Dentro do IBM Bluemix: Criar um app de Visual Recognition Clique em Service Credentials View Credentials { "url": "https://gateway...')
 
Linha 222: Linha 222:
 
     }
 
     }
 
]
 
]
 +
 +
 +
As imagens utilizadas para o teste foram:
 +
 +
[http://r.ddmcdn.com/s_f/o_1/cx_633/cy_0/cw_1725/ch_1725/w_720/APL/uploads/2014/11/too-cute-doggone-it-video-playlist.jpg]
 +
[https://sd.keepcalm-o-matic.co.uk/i-w600/too-much-love-will-kill-you-everytime.jpg]
 +
[http://hypescience.com/wp-content/uploads/2016/07/obama.jpg]
  
  

Edição das 04h09min de 5 de abril de 2017


Para reconhecimento de imagem:

Dentro do IBM Bluemix:

Criar um app de Visual Recognition

Clique em Service Credentials View Credentials

{

 "url": "https://gateway-a.watsonplatform.net/visual-recognition/api",
 "note": "It may take up to 5 minutes for this key to become active",
 "api_key": "9e27a30f3c6e32e42cd6cbbacf5006451c333efx"

}


No Terminal de comando, no linux:


Para instalar:

$ npm install watson-developer-cloud --save


Comandos para Classificacao de imagem:

$ image_url=http://r.ddmcdn.com/s_f/o_1/APL/uploads/2015/07/cecil-AP463227356214-1000x400.jpg

$ api_key=9e27a30f3c6e32e42cd6cbbacf5006451c333efx

$ curl -X GET "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key=${api_key}&version=2016-05-20&url=${image_url}"


Resultado:

Watson-classificacao-1-1.png


Comandos para reconhecimento de imagem:

$ image_url=http://hypescience.com/wp-content/uploads/2016/07/obama.jpg

$ api_key=9e27a30f3c6e32e42cd6cbbacf5006451c333efx

$ curl -X GET "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/detect_faces?api_key=${api_key}&version=2016-05-20&url=${image_url}"


Resultado:

Watson-classificacao-2-1.png


Para trabalhar no NodeRed com reconhecimento de imagem, classificacao ou deteccao de texto, inicie um novo app no Watson IoT Platform e associe ele ao Visual Recognition do Watson.


Visual-recognition-ibm-watson-1.png

Crie o seguinte aplicativo em Node Red:

Visual-recognition-ibm-watson-2.png

Para cria-lo de forma rapida, copie e cole o JSON abaixo na sessao import -> clipboard.


[

   {
       "id": "dba7f7ca.9b6f58",
       "type": "tab",
       "label": "Flow 1"
   },
   {
       "id": "a9bb9560.630f5",
       "type": "ibmiot",
       "z": "",
       "name": "",
       "keepalive": "60",
       "domain": "",
       "cleansession": true,
       "appId": "",
       "shared": false
   },
   {
       "id": "d7501fec.f671",
       "type": "ibmiot",
       "z": "",
       "name": "",
       "keepalive": "60",
       "domain": "",
       "cleansession": true,
       "appId": "",
       "shared": false
   },
   {
       "id": "53a902f7.0483e4",
       "type": "ibmiot",
       "z": "",
       "name": "iot-lhc",
       "keepalive": "60",
       "domain": "",
       "cleansession": true,
       "appId": "",
       "shared": false
   },
   {
       "id": "997d054e.50b3",
       "type": "inject",
       "z": "dba7f7ca.9b6f58",
       "name": "URL",
       "topic": "",
       "payload": "http://r.ddmcdn.com/s_f/o_1/cx_633/cy_0/cw_1725/ch_1725/w_720/APL/uploads/2014/11/too-cute-doggone-it-video-playlist.jpg",
       "payloadType": "str",
       "repeat": "",
       "crontab": "",
       "once": false,
       "x": 383.5,
       "y": 105.5,
       "wires": [
           [
               "1f0ef5e5.bbc442"
           ]
       ]
   },
   {
       "id": "1f0ef5e5.bbc442",
       "type": "visual-recognition-v3",
       "z": "dba7f7ca.9b6f58",
       "name": "Classify an image",
       "apikey": "__PWRD__",
       "image-feature": "classifyImage",
       "lang": "en",
       "x": 777.5,
       "y": 104.5,
       "wires": [
           [
               "e817c082.941738"
           ]
       ]
   },
   {
       "id": "dcc39aab.4a483",
       "type": "inject",
       "z": "dba7f7ca.9b6f58",
       "name": "URL",
       "topic": "",
       "payload": "https://sd.keepcalm-o-matic.co.uk/i-w600/too-much-love-will-kill-you-everytime.jpg",
       "payloadType": "str",
       "repeat": "",
       "crontab": "",
       "once": false,
       "x": 383,
       "y": 187.5,
       "wires": [
           [
               "b062078e.4eb698"
           ]
       ]
   },
   {
       "id": "b062078e.4eb698",
       "type": "visual-recognition-v3",
       "z": "dba7f7ca.9b6f58",
       "name": "Recognize Text",
       "apikey": "__PWRD__",
       "image-feature": "recognizeText",
       "x": 788,
       "y": 186.5,
       "wires": [
           [
               "e817c082.941738"
           ]
       ]
   },
   {
       "id": "3eeb983b.ffbf1",
       "type": "visual-recognition-v3",
       "z": "dba7f7ca.9b6f58",
       "name": "Detect Faces",
       "apikey": "__PWRD__",
       "image-feature": "detectFaces",
       "x": 769.5,
       "y": 294.5,
       "wires": [
           [
               "e817c082.941738"
           ]
       ]
   },
   {
       "id": "4c738167.7a20a8",
       "type": "inject",
       "z": "dba7f7ca.9b6f58",
       "name": "URL",
       "topic": "",
       "payload": "http://hypescience.com/wp-content/uploads/2016/07/obama.jpg",
       "payloadType": "str",
       "repeat": "",
       "crontab": "",
       "once": false,
       "x": 386,
       "y": 294.5,
       "wires": [
           [
               "3eeb983b.ffbf1"
           ]
       ]
   },
   {
       "id": "e817c082.941738",
       "type": "debug",
       "z": "dba7f7ca.9b6f58",
       "name": "",
       "active": true,
       "console": "false",
       "complete": "result",
       "x": 1087.5,
       "y": 150.5,
       "wires": []
   }

]


As imagens utilizadas para o teste foram:

[1] [2] [3]



Links de Referencia para Classificacao de imagens e Reconhecimento de faces:

https://watson-api-explorer.mybluemix.net/apis/visual-recognition-v3?cm_mc_uid=95153737794014878920994&cm_mc_sid_50200000=1490747250&cm_mc_sid_52640000=1490748126#/

https://www.youtube.com/watch?v=U-yJYHks1_s

https://www.npmjs.com/package/watson-developer-cloud