|
| 1 | +<!-- |
| 2 | + Copyright 2013,2015 IBM Corp. |
| 3 | +
|
| 4 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + you may not use this file except in compliance with the License. |
| 6 | + You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + Unless required by applicable law or agreed to in writing, software |
| 11 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + See the License for the specific language governing permissions and |
| 14 | + limitations under the License. |
| 15 | +--> |
| 16 | + |
| 17 | +<script type="text/x-red" data-template-name="visual-recognition-v3"> |
| 18 | + <div id="credentials-check" class="form-row"> |
| 19 | + <div class="form-tips"> |
| 20 | + <i class="fa fa-question-circle"></i><b> Please wait: </b> Checking for bound service credentials... |
| 21 | + </div> |
| 22 | + </div> |
| 23 | + <div class="form-row credentials" style="display: none;"> |
| 24 | + <label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label> |
| 25 | + <input type="password" id="node-input-apikey" placeholder="API Key"> |
| 26 | + </div> |
| 27 | + <div class="form-row"> |
| 28 | + <label for="node-input-image-feature"><i class="fa fa-book"></i> Detect: </label> |
| 29 | + <select type="text" id="node-input-image-feature" style="display: inline-block; width: 70%;"> |
| 30 | + <option value="classifyImage">Classify an image</option> |
| 31 | + <option value="detectFaces">Detect Faces</option> |
| 32 | + <option value="recognizeText">Recognize Text</option> |
| 33 | + </select> |
| 34 | + </div> |
| 35 | + <div class="form-row"> |
| 36 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 37 | + <input type="text" id="node-input-name" placeholder="Name"> |
| 38 | + </div> |
| 39 | +</script> |
| 40 | + |
| 41 | +<script type="text/x-red" data-template-name="visual-recognition-util-v3"> |
| 42 | + <div id="credentials-check" class="form-row"> |
| 43 | + <div class="form-tips"> |
| 44 | + <i class="fa fa-question-circle"></i><b> Please wait: </b> Checking for bound service credentials... |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + <div class="form-row credentials" style="display: none;"> |
| 48 | + <label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label> |
| 49 | + <input type="password" id="node-input-apikey" placeholder="API Key"> |
| 50 | + </div> |
| 51 | + <div class="form-row"> |
| 52 | + <label for="node-input-image-feature"><i class="fa fa-book"></i> Detect: </label> |
| 53 | + <select type="text" id="node-input-image-feature" style="display: inline-block; width: 70%;"> |
| 54 | + <option value="createClassifier">Create a classifier</option> |
| 55 | + <option value="retrieveClassifiersList">Retrieve a list of classifiers</option> |
| 56 | + <option value="retrieveClassifierDetails">Retrieve Classifier Details</option> |
| 57 | + <option value="deleteClassifier">Delete a classifier</option> |
| 58 | + </select> |
| 59 | + </div> |
| 60 | + <div class="form-row"> |
| 61 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 62 | + <input type="text" id="node-input-name" placeholder="Name"> |
| 63 | + </div> |
| 64 | +</script> |
| 65 | + |
| 66 | +<script type="text/x-red" data-help-name="visual-recognition-v3"> |
| 67 | + <p>Using the Visual Recognition v3 node, you can use the Watson Visual Recognition service V3 to identify scenes, objects, faces, and text in images you upload to the service. You can create and train a custom classifier to identify subjects that suit your needs.</p> |
| 68 | + <p>The following features are available :</p> |
| 69 | + <ul> |
| 70 | + <li><b>Classify an image</b> Upload images or URLs to identify built-in classifiers by default. To identify custom classifiers, include the classifier_ids or owners parameters. Images must be in .jpeg, .jpg or .png format.</li> |
| 71 | + <li><b>Detect Faces</b> : analyze faces in images and get data about them, such as estimated age and gender. Images must be in .jpeg, .jpg or .png format.</li> |
| 72 | + <li><b>Recognize Text</b> : recognizes text in images. This is a beta function of the Visual Recognition service that supports only English language text identification</li> |
| 73 | + </ul> |
| 74 | + |
| 75 | + <p>Results from the Watson Visual Recognition service APIs below will made available at <code>msg.result</code></p> |
| 76 | + <p>Important : Maximum image size is 2 MB</p> |
| 77 | + <br/> |
| 78 | + |
| 79 | + <p><b>Classify an image</b></p> |
| 80 | + <p>This feature should be provided in input : </p> |
| 81 | + <ul> |
| 82 | + <li><code>msg.payload</code> : the URL or the Node.js Buffer of an image. Redirects are followed, so you can use shortened URLs. (Required)</li> |
| 83 | + <li><code>msg.params["classifier_ids"]</code> : A comma-separated list of the classifier IDs used to classify the images. "Default" is the classifier_id of the built-in classifier. (string) (Optional)</li> |
| 84 | + <li><code>msg.params["owners"]</code> : A comma-separated list with the value(s) "IBM" and/or "me" to specify which classifiers to run. (string) (Optional)</li> |
| 85 | + <li><code>msg.params["threshold"]</code> : A floating value (in string format) that specifies the minimum score a class must have to be displayed in the response (Optional)</li> |
| 86 | + </ul> |
| 87 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#classify_an_image">API documentation</a>.</p> |
| 88 | + |
| 89 | + <p><b>Detect Faces</b></p> |
| 90 | + <p>This feature should be provided in input : </p> |
| 91 | + <ul> |
| 92 | + <li><code>msg.payload</code> : the URL or the Node.js Buffer of an image. Redirects are followed, so you can use shortened URLs. (Required)</li> |
| 93 | + </ul> |
| 94 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#detect_faces">API documentation</a>.</p> |
| 95 | + |
| 96 | + <p><b>Text Recognition</b></p> |
| 97 | + <p>This feature should be provided in input : </p> |
| 98 | + <ul> |
| 99 | + <li><code>msg.payload</code> : the URL or the Node.js Buffer of an image. Redirects are followed, so you can use shortened URLs. (Required)</li> |
| 100 | + </ul> |
| 101 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#recognize_text">API documentation</a>.</p> |
| 102 | + |
| 103 | + |
| 104 | + <p>For full details on the feature details and response values, please see the <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/">Watson Visual Recognition (v3) API documentation</a></p> |
| 105 | + |
| 106 | + <p>Check the sample Flow for this node on <a href="https://github.com/watson-developer-cloud/node-red-bluemix-starter">Watson Node-RED Starter</a></p> |
| 107 | +</script> |
| 108 | + |
| 109 | + |
| 110 | +<script type="text/x-red" data-help-name="visual-recognition-util-v3"> |
| 111 | + <p> This node enables you to use the training features of the Watson Visual Recognition service V3 that aims to identify scenes, objects, faces, and text in images you upload to the service. Using this node you can create and train a custom classifier to identify subjects that suit your needs.</p> |
| 112 | + <p>The following features are available :</p> |
| 113 | + <ul> |
| 114 | + <li><b>Create a classifier</b> </li> |
| 115 | + <li><b>Retrieve a list of custom classifier</b></li> |
| 116 | + <li><b>Retrieve classifier details</b></li> |
| 117 | + <li><b>Delete a classifier</b></li> |
| 118 | + </ul> |
| 119 | + |
| 120 | + <p><b>Create a Classifier</b></p> |
| 121 | + <p>this feature should be provided in input : </p> |
| 122 | + <ul> |
| 123 | + <li><code>msg.params["name"]</code> : a string name that will be used as prefix for the returned classifier_id (Required)</li> |
| 124 | + <li><code>msg.params["{classname}_positive_examples"]</code> : a Node.js binary Buffer of the ZIP that contains a minimum of 10 images. (Required)</li> |
| 125 | + <li><code>msg.params["negative_examples"]</code> : a Node.js binary Buffer of the ZIP that contains a minimum of 10 images.(Optional)</li> |
| 126 | + </ul> |
| 127 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#create_a_classifier">API documentation</a>.</p> |
| 128 | + |
| 129 | + <p><b>Retrieve classifiers list</b></p> |
| 130 | + <p>this feature does not need input params.</p> |
| 131 | + |
| 132 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#retrieve_a_list_of_classifiers">API documentation</a>.</p> |
| 133 | + |
| 134 | + <p><b>Retrieve a classifier details</b></p> |
| 135 | + <p>this feature should be provided in input : </p> |
| 136 | + <ul> |
| 137 | + <li><code>msg.params["classifier_id"]</code> : the classifier_id (string) (Required)</li> |
| 138 | + </ul> |
| 139 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#retrieve_classifier_details">API documentation</a>.</p> |
| 140 | + |
| 141 | + <p><b>Delete a classifier </b></p> |
| 142 | + <p>this feature should be provided in input : </p> |
| 143 | + <ul> |
| 144 | + <li><code>msg.params["classifier_id"]</code> : the classifier_id (string) (Required)</li> |
| 145 | + </ul> |
| 146 | + <p>More information on this <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/?curl#delete_a_classifier">API documentation</a>.</p> |
| 147 | + |
| 148 | + <p>For full details on the feature details and response values, please see the <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/">Watson Visual Recognition (v3) API documentation</a></p> |
| 149 | + |
| 150 | + <p>The content to be analysed should be passed in on <code>msg.payload</code>.</p> |
| 151 | + <p>Valid <code>msg.payload</code> types: URL or Buffer containing raw image bytes.</p> |
| 152 | + |
| 153 | + <br> |
| 154 | + <p>Results from the Watson Visual Recognition service will made available at <code>msg.result</code>.</p> |
| 155 | + |
| 156 | + <p>Check the sample Flow for this node on <a href="https://github.com/watson-developer-cloud/node-red-bluemix-starter">Watson Node-RED Starter</a></p> |
| 157 | + |
| 158 | +</script> |
| 159 | + |
| 160 | + |
| 161 | +<script type="text/javascript"> |
| 162 | + (function() { |
| 163 | + RED.nodes.registerType('visual-recognition-v3', { |
| 164 | + category: 'IBM Watson', |
| 165 | + defaults: { |
| 166 | + name: {value: ""}, |
| 167 | + apikey: {value: ""}, |
| 168 | + "image-feature": {value: ""} |
| 169 | + }, |
| 170 | + credentials: { |
| 171 | + apikey: {type:"password"} |
| 172 | + }, |
| 173 | + color: 'rgb(72, 232, 211)', |
| 174 | + inputs: 1, |
| 175 | + outputs: 1, |
| 176 | + icon: "VR-v3-25x25.png", |
| 177 | + paletteLabel: "visual recognition v3", |
| 178 | + label: function() { |
| 179 | + return this.name || "visual recognition v3"; |
| 180 | + }, |
| 181 | + labelStyle: function() { |
| 182 | + return this.name ? "node_label_italic" : ""; |
| 183 | + }, |
| 184 | + oneditprepare: function() { |
| 185 | + $.getJSON('watson-visual-recognition/vcap/') |
| 186 | + .done(function (service) { |
| 187 | + $('.credentials').toggle(!service); |
| 188 | + }) |
| 189 | + .fail(function () { |
| 190 | + $('.credentials').show(); |
| 191 | + }) |
| 192 | + .always(function () { |
| 193 | + $('#credentials-check').hide(); |
| 194 | + }) |
| 195 | + } |
| 196 | + }); |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + RED.nodes.registerType('visual-recognition-util-v3', { |
| 201 | + category: 'IBM Watson', |
| 202 | + defaults: { |
| 203 | + name: {value: ""}, |
| 204 | + apikey: {value: ""}, |
| 205 | + "image-feature": {value: ""} |
| 206 | + }, |
| 207 | + credentials: { |
| 208 | + apikey: {type:"password"} |
| 209 | + }, |
| 210 | + color: 'rgb(72, 232, 211)', |
| 211 | + inputs: 1, |
| 212 | + outputs: 1, |
| 213 | + icon: "VR-v3-25x25.png", |
| 214 | + paletteLabel: "visual recognition util v3", |
| 215 | + label: function() { |
| 216 | + return this.name || "visual recognition util v3"; |
| 217 | + }, |
| 218 | + labelStyle: function() { |
| 219 | + return this.name ? "node_label_italic" : ""; |
| 220 | + }, |
| 221 | + oneditprepare: function() { |
| 222 | + $.getJSON('watson-visual-recognition/vcap/') |
| 223 | + .done(function (service) { |
| 224 | + $('.credentials').toggle(!service); |
| 225 | + }) |
| 226 | + .fail(function () { |
| 227 | + $('.credentials').show(); |
| 228 | + }) |
| 229 | + .always(function () { |
| 230 | + $('#credentials-check').hide(); |
| 231 | + }) |
| 232 | + } |
| 233 | + }); |
| 234 | + |
| 235 | + |
| 236 | + })(); |
| 237 | +</script> |
0 commit comments