How to Train and Use Three Custom Image Classifiers of Watson Visual Recognition Api with Demo Webpage

This flow shows how different custom classifiers can be trained and used in parallel to categorize images based on different aspects. In this example the classifiers are used to classify ship portraits. We get results from the classifiers how shure the classifiers are, in percent, that if is a threemast or a twomast ship and if there is a storm going on on the picture.

This example assumes that you have a free IBM Bluemix account with one free api key for one custon classifier of Visual Recognition in every Datacenter, so basically you have three different custom classifiers, one in each IBM Bluemix Datacenters. ust fill in the right api keys at the training and the classification nodes of visual recognition and you are good to go.

This is an advanced Version of an example Flow from Node-Red-Labs: https://github.com/watson-developer-cloud/node-red-labs

[{"id":"650044d9.8b65fc","type":"comment","z":"8a789b93.971048","name":"TRAINING Threemast Classifier","info":"Api Key - US\n\n\n\n","x":190,"y":640,"wires":[]},{"id":"e66a6183.b9a7d","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"create a classifier","apikey":"__PWRD__","image-feature":"createClassifier","x":570,"y":760,"wires":[["a241b3f5.99579"]]},{"id":"dcb68933.dad538","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifiers list","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"retrieveClassifiersList","x":580,"y":800,"wires":[["a241b3f5.99579"]]},{"id":"42f525c.a9a7fdc","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifier details","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"retrieveClassifierDetails","x":590,"y":840,"wires":[["a241b3f5.99579"]]},{"id":"b24a84d0.95dab8","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete a classifier","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"deleteClassifier","x":570,"y":880,"wires":[["a241b3f5.99579"]]},{"id":"ddb76ae3.7cd648","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":680,"wires":[["8edcfd57.c4e49"]]},{"id":"c66f676e.ab7f78","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":800,"wires":[["dcb68933.dad538"]]},{"id":"3ff65744.a7dcb8","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":840,"wires":[["9d4c42f9.607b9"]]},{"id":"99449eb7.575b1","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":880,"wires":[["15edd3b2.12940c"]]},{"id":"aa7ad0da.bcb03","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"threemast_positive.zip","name":"threemast_positive.zip","x":180,"y":720,"wires":[["915021e3.7868f"]]},{"id":"49398687.dc73e8","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"threemast_negative.zip","name":"threemast_negative.zip","x":190,"y":760,"wires":[["f5d03460.6636d8"]]},{"id":"915021e3.7868f","type":"change","z":"8a789b93.971048","name":"set positives","rules":[{"t":"set","p":"params.threemast_positive_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":720,"wires":[["49398687.dc73e8"]]},{"id":"f5d03460.6636d8","type":"change","z":"8a789b93.971048","name":"set negatives","rules":[{"t":"set","p":"params.negative_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":760,"wires":[["e66a6183.b9a7d"]]},{"id":"8edcfd57.c4e49","type":"function","z":"8a789b93.971048","name":"set name","func":"msg.params={'name':'threemast'};\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":680,"wires":[["aa7ad0da.bcb03"]]},{"id":"a241b3f5.99579","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"false","complete":"result","x":822,"y":866.9999942779541,"wires":[]},{"id":"9d4c42f9.607b9","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":840,"wires":[["42f525c.a9a7fdc"]]},{"id":"15edd3b2.12940c","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":880,"wires":[["b24a84d0.95dab8"]]},{"id":"ed25415f.e7ffd","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":1040,"wires":[["86fc4094.7dfeb"]]},{"id":"3ca53bbb.d1f554","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_04.jpg","name":"ship_04.jpg","x":570,"y":1120,"wires":[["3baa842.ea01c7c"]]},{"id":"86fc4094.7dfeb","type":"function","z":"8a789b93.971048","name":"set classifier_ids","func":"msg.params={};\nmsg.params[\"classifier_ids\"]=\"threemast_448399683\";\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":1040,"wires":[["4c04fd78.593014"]]},{"id":"fd70da99.01ac38","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"true","complete":"true","x":950,"y":1080,"wires":[]},{"id":"1563c730.c92d39","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":1080,"wires":[["77252393.f6d3ac"]]},{"id":"77252393.f6d3ac","type":"function","z":"8a789b93.971048","name":"set owners","func":"msg.params={};\nmsg.params[\"owners\"]=\"me\";\nmsg.params[\"classifier_ids\"]=\"threemast_448399683\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":1080,"wires":[["541e5731.5e6bf8"]]},{"id":"670b6c00.ffd8b4","type":"comment","z":"8a789b93.971048","name":"Advanced Options","info":"build new Specific Classifier to be used.","x":170,"y":1000,"wires":[]},{"id":"5f35b4a9.e9a7dc","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":1120,"wires":[["87b320e0.670e7"]]},{"id":"87b320e0.670e7","type":"function","z":"8a789b93.971048","name":"set threshold","func":"msg.params={};\nmsg.params[\"threshold\"]=\"0.3\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":1120,"wires":[["3ca53bbb.d1f554"]]},{"id":"1437e1dd.9bf00e","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":920,"wires":[["56fb4d51.2e6134"]]},{"id":"56fb4d51.2e6134","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete All classifiers","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"deleteAllClassifiers","x":570,"y":920,"wires":[["a241b3f5.99579"]]},{"id":"3baa842.ea01c7c","type":"visual-recognition-v3","z":"8a789b93.971048","name":"Classify an image","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"classifyImage","lang":"en","x":770,"y":1080,"wires":[["fd70da99.01ac38"]]},{"id":"9eee27d7.0794e8","type":"inject","z":"8a789b93.971048","name":"URL","topic":"","payload":"http://visual-recognition-demo.mybluemix.net/images/samples/2.jpg","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":580,"wires":[["4eb1a096.124ef"]]},{"id":"4eb1a096.124ef","type":"visual-recognition-v3","z":"8a789b93.971048","name":"Classify an image (en)","apikey":"__PWRD__","image-feature":"classifyImage","lang":"en","x":380,"y":580,"wires":[["72bf09b4.ab9458"]]},{"id":"72bf09b4.ab9458","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"false","complete":"result","x":610,"y":580,"wires":[]},{"id":"fc592867.16df68","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":129,"y":419.0000009536743,"wires":[["8b5805e3.c06338"]]},{"id":"8b5805e3.c06338","type":"http request","z":"8a789b93.971048","name":"","method":"GET","ret":"bin","url":"https://visual-recognition-demo.mybluemix.net/images/samples/2.jpg","tls":"","x":350,"y":420,"wires":[["4eb1a096.124ef"]]},{"id":"33ac766d.c0fe7a","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_01.jpg","name":"ship_01.jpg","x":350,"y":460,"wires":[["4eb1a096.124ef"]]},{"id":"65064d89.abec14","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":460,"wires":[["33ac766d.c0fe7a"]]},{"id":"f975b891.a4e9e8","type":"comment","z":"8a789b93.971048","name":"Image Analysis","info":"See corresponding Lab instructions in the link below :\n\n[Watson Visual Recognition](https://github.com/watson-developer-cloud/node-red-labs/tree/master/basic_examples/visual_recognition_v3)\n","x":120,"y":120,"wires":[]},{"id":"8df519e4.a0c178","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_02.jpg","name":"ship_02.jpg","x":350,"y":500,"wires":[["4eb1a096.124ef"]]},{"id":"5eedb29e.850d4c","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":500,"wires":[["8df519e4.a0c178"]]},{"id":"be36494.70d9bb8","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_03.jpg","name":"ship_03.jpg","x":350,"y":540,"wires":[["4eb1a096.124ef"]]},{"id":"c9bea1d2.eb10d","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":540,"wires":[["be36494.70d9bb8"]]},{"id":"541e5731.5e6bf8","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_02.jpg","name":"ship_02.jpg","x":570,"y":1080,"wires":[["3baa842.ea01c7c"]]},{"id":"ddfb58b9.151c78","type":"function","z":"8a789b93.971048","name":"set Classifier","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\ncount %= 40;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\n\nmsg.filename=\"Ship (\" + (count) + \").jpg\";\nmsg.params={};\nmsg.params[\"owners\"]=\"me\";\nmsg.params[\"classifier_ids\"]=\"threemast_872793386\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["326478ea.bd1528"]]},{"id":"326478ea.bd1528","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"","name":"","x":500,"y":120,"wires":[["19251fb6.0ad61"]]},{"id":"19251fb6.0ad61","type":"visual-recognition-v3","z":"8a789b93.971048","name":"Threemast Classifier","apikey":"__PWRD__","image-feature":"classifyImage","lang":"en","x":700,"y":120,"wires":[["d7071e15.bb18c","2c7ddf05.1109f"]]},{"id":"d7071e15.bb18c","type":"debug","z":"8a789b93.971048","name":"","active":false,"console":"true","complete":"true","x":890,"y":100,"wires":[]},{"id":"2c7ddf05.1109f","type":"function","z":"8a789b93.971048","name":"","func":"if(msg.result.images.classifiers !== null)\n{\n    if(msg.result.images[0].classifiers[0].classes[0].score) {\n        msg.payload = msg.result.images[0].classifiers[0].classes[0].score;\n        return msg;\n    } else {\n        msg.payload = 0\n        return msg;\n    }\n} else {\n    msg.payload = 0\n    return msg;\n}","outputs":1,"noerr":0,"x":890,"y":140,"wires":[["773be7ba.510148"]]},{"id":"773be7ba.510148","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"true","complete":"true","x":1030,"y":140,"wires":[]},{"id":"e811c2a7.59a05","type":"function","z":"8a789b93.971048","name":"set Classifier","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\ncount %= 40;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\n\nmsg.filename=\"Ship (\" + (count) + \").jpg\";\n\nmsg.params={};\nmsg.params[\"owners\"]=\"me\";\nmsg.params[\"classifier_ids\"]=\"twomast_17832223\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":200,"wires":[["cff965ef.3a1a08"]]},{"id":"cff965ef.3a1a08","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"","name":"","x":500,"y":200,"wires":[["539816e9.80f0b8"]]},{"id":"539816e9.80f0b8","type":"visual-recognition-v3","z":"8a789b93.971048","name":"Twomast Classifier","apikey":"__PWRD__","image-feature":"classifyImage","lang":"en","x":690,"y":200,"wires":[["724543df.c9e51c","5dce2779.8629f8"]]},{"id":"724543df.c9e51c","type":"debug","z":"8a789b93.971048","name":"","active":false,"console":"true","complete":"true","x":890,"y":180,"wires":[]},{"id":"5dce2779.8629f8","type":"function","z":"8a789b93.971048","name":"","func":"if(msg.result.images.classifiers !== null)\n{\n    if(msg.result.images[0].classifiers[0].classes[0].score) {\n        msg.payload = msg.result.images[0].classifiers[0].classes[0].score;\n        return msg;\n    } else {\n        msg.payload = 0\n        return msg;\n    }\n} else {\n    msg.payload = 0\n    return msg;\n}","outputs":1,"noerr":0,"x":890,"y":220,"wires":[["d843b81f.58f568"]]},{"id":"d843b81f.58f568","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"true","complete":"true","x":1030,"y":220,"wires":[]},{"id":"ea07ccf5.83dd9","type":"function","z":"8a789b93.971048","name":"set Classifier","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\ncount %= 40;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\n\nmsg.filename=\"Ship (\" + (count) + \").jpg\";\n\nmsg.params={};\nmsg.params[\"owners\"]=\"me\";\nmsg.params[\"classifier_ids\"]=\"onemast_261820213\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":280,"wires":[["74b90621.7a2f98"]]},{"id":"74b90621.7a2f98","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"","name":"","x":500,"y":280,"wires":[["cbbd1d0a.de65a"]]},{"id":"cbbd1d0a.de65a","type":"visual-recognition-v3","z":"8a789b93.971048","name":"Storm Classifier","apikey":"__PWRD__","image-feature":"classifyImage","lang":"en","x":680,"y":280,"wires":[["9de42f6d.314a2","d3951dfa.5f82c"]]},{"id":"9de42f6d.314a2","type":"debug","z":"8a789b93.971048","name":"","active":false,"console":"true","complete":"true","x":890,"y":260,"wires":[]},{"id":"d3951dfa.5f82c","type":"function","z":"8a789b93.971048","name":"","func":"if(msg.result.images.classifiers !== null)\n{\n    if(msg.result.images[0].classifiers[0].classes[0].score) {\n        msg.payload = msg.result.images[0].classifiers[0].classes[0].score;\n        return msg;\n    } else {\n        msg.payload = 0\n        return msg;\n    }\n} else {\n    msg.payload = 0\n    return msg;\n}","outputs":1,"noerr":0,"x":890,"y":300,"wires":[["16431236.a810ee"]]},{"id":"16431236.a810ee","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"true","complete":"true","x":1030,"y":300,"wires":[]},{"id":"ffe08676.cc7588","type":"comment","z":"8a789b93.971048","name":"TRAINING Twomast Classifier","info":"","x":1100,"y":640,"wires":[]},{"id":"872350c6.ccf3d","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"create a classifier","apikey":"__PWRD__","image-feature":"createClassifier","x":1470,"y":760,"wires":[["d7578590.6a6f68"]]},{"id":"39bb4c55.f51bb4","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifiers list","apikey":"c5c6200b533752538fbaf2a9a525f2a00cd16a79","image-feature":"retrieveClassifiersList","x":1480,"y":800,"wires":[["d7578590.6a6f68"]]},{"id":"6102419d.2709e","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifier details","apikey":"c5c6200b533752538fbaf2a9a525f2a00cd16a79","image-feature":"retrieveClassifierDetails","x":1490,"y":840,"wires":[["d7578590.6a6f68"]]},{"id":"e736c081.e1245","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete a classifier","apikey":"c5c6200b533752538fbaf2a9a525f2a00cd16a79","image-feature":"deleteClassifier","x":1470,"y":880,"wires":[["d7578590.6a6f68"]]},{"id":"643c03c9.61d8ac","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1040,"y":680,"wires":[["35f60120.5b3d7e"]]},{"id":"b80d83b2.6b1d2","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1040,"y":800,"wires":[["39bb4c55.f51bb4"]]},{"id":"a3a838a0.b89dc8","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1040,"y":840,"wires":[["e7cb41ce.6082b"]]},{"id":"f09ed3d.6df393","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1040,"y":880,"wires":[["52f41b7a.ce6c64"]]},{"id":"bf8be12c.e89db","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"twomast_positive.zip","name":"","x":1100,"y":720,"wires":[["61b92577.92c94c"]]},{"id":"6719e29e.9d3bcc","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"twomast_negative.zip","name":"","x":1100,"y":760,"wires":[["4a6c06e.1b610f8"]]},{"id":"61b92577.92c94c","type":"change","z":"8a789b93.971048","name":"set positives","rules":[{"t":"set","p":"params.threemast_positive_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":720,"wires":[["6719e29e.9d3bcc"]]},{"id":"4a6c06e.1b610f8","type":"change","z":"8a789b93.971048","name":"set negatives","rules":[{"t":"set","p":"params.negative_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":760,"wires":[["872350c6.ccf3d"]]},{"id":"35f60120.5b3d7e","type":"function","z":"8a789b93.971048","name":"set name","func":"msg.params={'name':'twomast'};\nreturn msg;","outputs":1,"noerr":0,"x":1200,"y":680,"wires":[["bf8be12c.e89db"]]},{"id":"d7578590.6a6f68","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"false","complete":"result","x":1750.8125,"y":873.8187198638916,"wires":[]},{"id":"e7cb41ce.6082b","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":1240,"y":840,"wires":[["6102419d.2709e"]]},{"id":"52f41b7a.ce6c64","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":1240,"y":880,"wires":[["e736c081.e1245"]]},{"id":"5363fded.997a84","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1040,"y":920,"wires":[["30b17862.997c68"]]},{"id":"30b17862.997c68","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete All classifiers","apikey":"c5c6200b533752538fbaf2a9a525f2a00cd16a79","image-feature":"deleteAllClassifiers","x":1470,"y":920,"wires":[["d7578590.6a6f68"]]},{"id":"6a881b7.f1b1be4","type":"comment","z":"8a789b93.971048","name":"TRAINING Weather Classifier","info":"","x":2040,"y":640,"wires":[]},{"id":"eae59db9.d1887","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"create a classifier","apikey":"95f20d40f439dc11d47ccb8c4d2e11c1994086ab","image-feature":"createClassifier","x":2370,"y":760,"wires":[["e52aa010.30506"]]},{"id":"1214a45f.c292dc","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifiers list","apikey":"95f20d40f439dc11d47ccb8c4d2e11c1994086ab","image-feature":"retrieveClassifiersList","x":2380,"y":800,"wires":[["e52aa010.30506"]]},{"id":"3619bdde.61cfd2","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"retrieve classifier details","apikey":"95f20d40f439dc11d47ccb8c4d2e11c1994086ab","image-feature":"retrieveClassifierDetails","x":2390,"y":840,"wires":[["e52aa010.30506"]]},{"id":"a47452fb.a876","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete a classifier","apikey":"95f20d40f439dc11d47ccb8c4d2e11c1994086ab","image-feature":"deleteClassifier","x":2370,"y":880,"wires":[["e52aa010.30506"]]},{"id":"29dba773.6d8848","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1980,"y":680,"wires":[["562cc5ad.17119c"]]},{"id":"eef7888e.c5f1d8","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1980,"y":800,"wires":[["1214a45f.c292dc"]]},{"id":"ed612b39.2d8328","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1980,"y":840,"wires":[["918cc3fa.cbdd2"]]},{"id":"aa3e1a5f.360e58","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1980,"y":880,"wires":[["bbdfb427.892468"]]},{"id":"1dd50abf.684085","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"storm_positive.zip","name":"","x":2010,"y":720,"wires":[["b36bdd74.64db3"]]},{"id":"19e9df38.f3ac91","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"storm_negative.zip","name":"","x":2010,"y":760,"wires":[["5a6a6987.3938b8"]]},{"id":"b36bdd74.64db3","type":"change","z":"8a789b93.971048","name":"set positives","rules":[{"t":"set","p":"params.threemast_positive_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2190,"y":720,"wires":[["19e9df38.f3ac91"]]},{"id":"5a6a6987.3938b8","type":"change","z":"8a789b93.971048","name":"set negatives","rules":[{"t":"set","p":"params.negative_examples","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2190,"y":760,"wires":[["eae59db9.d1887"]]},{"id":"562cc5ad.17119c","type":"function","z":"8a789b93.971048","name":"set name","func":"msg.params={'name':'storm'};\nreturn msg;","outputs":1,"noerr":0,"x":2140,"y":680,"wires":[["1dd50abf.684085"]]},{"id":"e52aa010.30506","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"false","complete":"result","x":2661.21240234375,"y":861.8187198638916,"wires":[]},{"id":"918cc3fa.cbdd2","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":2160,"y":840,"wires":[["3619bdde.61cfd2"]]},{"id":"bbdfb427.892468","type":"function","z":"8a789b93.971048","name":"set classifier_id","func":"msg.params={'classifier_id':'threemast_1167630302'};\nreturn msg;","outputs":1,"noerr":0,"x":2160,"y":880,"wires":[["a47452fb.a876"]]},{"id":"4c1fb8c2.9391e8","type":"inject","z":"8a789b93.971048","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":1980,"y":920,"wires":[["514e1d81.fce2f4"]]},{"id":"514e1d81.fce2f4","type":"visual-recognition-util-v3","z":"8a789b93.971048","name":"delete All classifiers","apikey":"95f20d40f439dc11d47ccb8c4d2e11c1994086ab","image-feature":"deleteAllClassifiers","x":2370,"y":920,"wires":[["e52aa010.30506"]]},{"id":"11acee70.83a1a2","type":"inject","z":"8a789b93.971048","name":"binary buffer","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":160,"wires":[["d73ec5e.bfc6038","ddfb58b9.151c78","e811c2a7.59a05","ea07ccf5.83dd9"]]},{"id":"7268d772.887228","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"","name":"","x":500,"y":40,"wires":[["42eb8240.0a507c"]]},{"id":"42eb8240.0a507c","type":"visual-recognition-v3","z":"8a789b93.971048","name":"","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"classifyImage","lang":"en","x":690,"y":40,"wires":[["15dc7c88.8cc303","49cfb8cb.80c668"]]},{"id":"15dc7c88.8cc303","type":"debug","z":"8a789b93.971048","name":"","active":false,"console":"true","complete":"true","x":890,"y":20,"wires":[]},{"id":"49cfb8cb.80c668","type":"function","z":"8a789b93.971048","name":"","func":"if(msg.result.images.classifiers !== null)\n{\n    if(msg.result.images[0].classifiers[0].classes[0].score) {\n        msg.payload = msg.result.images[0].classifiers[0].classes[0].score;\n        return msg;\n    } else {\n        msg.payload = 0\n        return msg;\n    }\n} else {\n    msg.payload = 0\n    return msg;\n}","outputs":1,"noerr":0,"x":890,"y":60,"wires":[["c145a6ca.bcfb98"]]},{"id":"c145a6ca.bcfb98","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"true","complete":"true","x":1030,"y":60,"wires":[]},{"id":"d73ec5e.bfc6038","type":"function","z":"8a789b93.971048","name":"count Ships","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\ncount %= 40;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\n\nmsg.filename=\"Ship (\" + (count) + \").jpg\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":40,"wires":[["7268d772.887228"]]},{"id":"df542288.2ab74","type":"http in","z":"8a789b93.971048","name":"","url":"/reco","method":"get","swaggerDoc":"","x":720,"y":420,"wires":[["8588c616.199aa8"]]},{"id":"5bfe2f21.f130d","type":"http response","z":"8a789b93.971048","name":"HTTP Response","x":1240,"y":500,"wires":[]},{"id":"8588c616.199aa8","type":"switch","z":"8a789b93.971048","name":"Check image param","property":"payload.imageurl","propertyType":"msg","rules":[{"t":"null"},{"t":"else"}],"checkall":"false","outputs":2,"x":784,"y":462,"wires":[["92e0794e.6b09d8"],["fac87400.8100f8"]]},{"id":"92e0794e.6b09d8","type":"template","z":"8a789b93.971048","name":"Get Image URL","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<html>\n<head><title>Watson Visual Recognition on Node-RED</title></head>\n<body>\n<h1>Welcome to the Watson Visual Recognition Demo on Node-RED</h1>\n<h2>Select an image URL</h2>\n<form  action=\"{{req._parsedUrl.pathname}}\">\n    <img src=\"http://visual-recognition-demo.mybluemix.net/images/horses.jpg\" height='100'/>\n    <img src=\"http://visual-recognition-demo.mybluemix.net/images/73388.jpg\" height='100'/>\n    <img src=\"http://visual-recognition-demo.mybluemix.net/images/26537.jpg\" height='100'/>\n    <img src=\"http://visual-recognition-demo.mybluemix.net/images/4068.jpg\" height='100'/>\n    <br/>Copy above image location URL or enter any image URL:<br/>\n    <input type=\"text\" name=\"imageurl\"/>\n    <input type=\"submit\" value=\"Analyze\"/>\n</form>\n</body>\n</html>","x":1140,"y":460,"wires":[["5bfe2f21.f130d"]]},{"id":"925bad00.148d5","type":"template","z":"8a789b93.971048","name":"Report","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<html>\n<head><title>Watson Visual Recognition on Node-RED</title></head>\n<body>\n<h1>Node-RED Watson Visual Recognition output</h1>\n<p>Analyzed image: {{payload}}<br/><img src=\"{{payload}}\" height='100'/></p>\n<table border='1'>\n    <thead><tr><th>Name</th><th>Score</th></tr></thead>\n{{#labels}}\n  <tr><td><b>{{label_name}}</b></td><td><i>{{label_score}}</i></td></tr>\n{{/labels}}\n</table>\n<form  action=\"{{req._parsedUrl.pathname}}\">\n    <input type=\"submit\" value=\"Try again\"/>\n</form>\n</body>\n</html>","x":1130,"y":540,"wires":[["5bfe2f21.f130d"]]},{"id":"fac87400.8100f8","type":"change","z":"8a789b93.971048","name":"Extract img URL","rules":[{"t":"set","p":"payload","to":"msg.payload.imageurl"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":500,"wires":[["e1af2426.4580a8"]]},{"id":"1369aca2.168923","type":"debug","z":"8a789b93.971048","name":"","active":true,"console":"false","complete":"labels","x":1250,"y":580,"wires":[]},{"id":"43586a1.f785394","type":"visual-recognition-v3","z":"8a789b93.971048","name":"","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"classifyImage","lang":"en","x":1030,"y":580,"wires":[["925bad00.148d5","1369aca2.168923"]]},{"id":"e1af2426.4580a8","type":"function","z":"8a789b93.971048","name":"set Classifier","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\ncount %= 40;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\n\nmsg.filename=\"Ship (\" + (count) + \").jpg\";\n\nmsg.params={};\nmsg.params[\"owners\"]=\"me\";\nmsg.params[\"classifier_ids\"]=\"onemast_261820213\";\nreturn msg;","outputs":1,"noerr":0,"x":930,"y":540,"wires":[["43586a1.f785394"]]},{"id":"84507345.eba42","type":"comment","z":"8a789b93.971048","name":"Image Analysis","info":"See corresponding Lab instructions in the link below :\n\n[Watson Visual Recognition](https://github.com/watson-developer-cloud/node-red-labs/tree/master/basic_examples/visual_recognition_v3)\n","x":140,"y":380,"wires":[]},{"id":"fb31cd6f.06a0e","type":"comment","z":"8a789b93.971048","name":"Website","info":"See corresponding Lab instructions in the link below :\n\n[Watson Visual Recognition](https://github.com/watson-developer-cloud/node-red-labs/tree/master/basic_examples/visual_recognition_v3)\n","x":710,"y":380,"wires":[]},{"id":"4c04fd78.593014","type":"dropbox","z":"8a789b93.971048","dropbox":"","filename":"ship_01.jpg","name":"ship_01.jpg","x":570,"y":1040,"wires":[["3baa842.ea01c7c"]]}]

Flow Info

Created 8 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x7)
  • comment (x7)
  • debug (x14)
  • function (x21)
  • http in (x1)
  • http request (x1)
  • http response (x1)
  • inject (x24)
  • switch (x1)
  • template (x2)
Other
  • dropbox (x16)
  • visual-recognition-util-v3 (x15)
  • visual-recognition-v3 (x7)

Tags

  • Visual
  • Recognition
  • image
  • classifier
  • ibm
  • watson
  • bluemix
  • custom
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option